fix(app): don't rely on metadata.summary in task tool render (#12497)
This commit is contained in:
@@ -876,16 +876,18 @@ ToolRegistry.register({
|
||||
render(props) {
|
||||
const data = useData()
|
||||
const i18n = useI18n()
|
||||
const summary = () =>
|
||||
(props.metadata.summary ?? []) as { id: string; tool: string; state: { status: string; title?: string } }[]
|
||||
const childSessionId = () => props.metadata.sessionId as string | undefined
|
||||
const childToolParts = createMemo(() => {
|
||||
const sessionId = childSessionId()
|
||||
if (!sessionId) return []
|
||||
return getSessionToolParts(data.store, sessionId)
|
||||
})
|
||||
|
||||
const autoScroll = createAutoScroll({
|
||||
working: () => true,
|
||||
overflowAnchor: "auto",
|
||||
})
|
||||
|
||||
const childSessionId = () => props.metadata.sessionId as string | undefined
|
||||
|
||||
const childPermission = createMemo(() => {
|
||||
const sessionId = childSessionId()
|
||||
if (!sessionId) return undefined
|
||||
@@ -1006,15 +1008,21 @@ ToolRegistry.register({
|
||||
data-scrollable
|
||||
>
|
||||
<div ref={autoScroll.contentRef} data-component="task-tools">
|
||||
<For each={summary()}>
|
||||
<For each={childToolParts()}>
|
||||
{(item) => {
|
||||
const info = getToolInfo(item.tool)
|
||||
const info = createMemo(() => getToolInfo(item.tool, item.state.input))
|
||||
const subtitle = createMemo(() => {
|
||||
if (info().subtitle) return info().subtitle
|
||||
if (item.state.status === "completed" || item.state.status === "running") {
|
||||
return item.state.title
|
||||
}
|
||||
})
|
||||
return (
|
||||
<div data-slot="task-tool-item">
|
||||
<Icon name={info.icon} size="small" />
|
||||
<span data-slot="task-tool-title">{info.title}</span>
|
||||
<Show when={item.state.title}>
|
||||
<span data-slot="task-tool-subtitle">{item.state.title}</span>
|
||||
<Icon name={info().icon} size="small" />
|
||||
<span data-slot="task-tool-title">{info().title}</span>
|
||||
<Show when={subtitle()}>
|
||||
<span data-slot="task-tool-subtitle">{subtitle()}</span>
|
||||
</Show>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user