diff options
Diffstat (limited to 'packages/ui/src/components')
| -rw-r--r-- | packages/ui/src/components/message-part.css | 17 | ||||
| -rw-r--r-- | packages/ui/src/components/message-part.tsx | 37 |
2 files changed, 45 insertions, 9 deletions
diff --git a/packages/ui/src/components/message-part.css b/packages/ui/src/components/message-part.css index 56fe9cf41..2bef792a2 100644 --- a/packages/ui/src/components/message-part.css +++ b/packages/ui/src/components/message-part.css @@ -809,3 +809,20 @@ display: none; } } + +[data-component="tool-loaded-file"] { + display: flex; + align-items: center; + gap: 8px; + padding: 4px 0 4px 28px; + font-family: var(--font-family-sans); + font-size: var(--font-size-small); + font-weight: var(--font-weight-regular); + line-height: var(--line-height-large); + color: var(--text-weak); + + [data-component="icon"] { + flex-shrink: 0; + color: var(--icon-weak); + } +} diff --git a/packages/ui/src/components/message-part.tsx b/packages/ui/src/components/message-part.tsx index 3fde255c8..7aad01ace 100644 --- a/packages/ui/src/components/message-part.tsx +++ b/packages/ui/src/components/message-part.tsx @@ -724,20 +724,39 @@ PART_MAPPING["reasoning"] = function ReasoningPartDisplay(props) { ToolRegistry.register({ name: "read", render(props) { + const data = useData() const i18n = useI18n() const args: string[] = [] if (props.input.offset) args.push("offset=" + props.input.offset) if (props.input.limit) args.push("limit=" + props.input.limit) + const loaded = createMemo(() => { + if (props.status !== "completed") return [] + const value = props.metadata.loaded + if (!value || !Array.isArray(value)) return [] + return value.filter((p): p is string => typeof p === "string") + }) return ( - <BasicTool - {...props} - icon="glasses" - trigger={{ - title: i18n.t("ui.tool.read"), - subtitle: props.input.filePath ? getFilename(props.input.filePath) : "", - args, - }} - /> + <> + <BasicTool + {...props} + icon="glasses" + trigger={{ + title: i18n.t("ui.tool.read"), + subtitle: props.input.filePath ? getFilename(props.input.filePath) : "", + args, + }} + /> + <For each={loaded()}> + {(filepath) => ( + <div data-component="tool-loaded-file"> + <Icon name="enter" size="small" /> + <span> + {i18n.t("ui.tool.loaded")} {relativizeProjectPaths(filepath, data.directory)} + </span> + </div> + )} + </For> + </> ) }, }) |
