Skip to content

Commit 7dd6369

Browse files
committed
fix(app): task agent title
1 parent 06f60af commit 7dd6369

18 files changed

Lines changed: 33 additions & 6 deletions

File tree

packages/ui/src/components/message-part.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
import { useData } from "../context"
2020
import { useFileComponent } from "../context/file"
2121
import { useDialog } from "../context/dialog"
22-
import { useI18n } from "../context/i18n"
22+
import { type UiI18n, useI18n } from "../context/i18n"
2323
import { GenericTool, ToolCall } from "./basic-tool"
2424
import { Accordion } from "./accordion"
2525
import { StickyAccordionHeader } from "./sticky-accordion-header"
@@ -123,6 +123,11 @@ export type ToolInfo = {
123123
subtitle?: string
124124
}
125125

126+
function agentTitle(i18n: UiI18n, type?: string) {
127+
if (!type) return i18n.t("ui.tool.agent.default")
128+
return i18n.t("ui.tool.agent", { type })
129+
}
130+
126131
export function getToolInfo(tool: string, input: any = {}): ToolInfo {
127132
const i18n = useI18n()
128133
switch (tool) {
@@ -168,12 +173,17 @@ export function getToolInfo(tool: string, input: any = {}): ToolInfo {
168173
title: i18n.t("ui.tool.codesearch"),
169174
subtitle: input.query,
170175
}
171-
case "task":
176+
case "task": {
177+
const type =
178+
typeof input.subagent_type === "string" && input.subagent_type
179+
? input.subagent_type[0]!.toUpperCase() + input.subagent_type.slice(1)
180+
: undefined
172181
return {
173182
icon: "task",
174-
title: i18n.t("ui.tool.agent"),
183+
title: agentTitle(i18n, type),
175184
subtitle: input.description,
176185
}
186+
}
177187
case "bash":
178188
return {
179189
icon: "console",
@@ -1475,11 +1485,12 @@ ToolRegistry.register({
14751485
const data = useData()
14761486
const i18n = useI18n()
14771487
const childSessionId = () => props.metadata.sessionId as string | undefined
1478-
const agentType = createMemo(() => {
1488+
const type = createMemo(() => {
14791489
const raw = props.input.subagent_type
14801490
if (typeof raw !== "string" || !raw) return undefined
14811491
return raw[0]!.toUpperCase() + raw.slice(1)
14821492
})
1493+
const title = createMemo(() => agentTitle(i18n, type()))
14831494
const description = createMemo(() => {
14841495
const value = props.input.description
14851496
if (typeof value === "string") return value
@@ -1527,9 +1538,8 @@ ToolRegistry.register({
15271538
<div data-slot="basic-tool-tool-info-structured">
15281539
<div data-slot="basic-tool-tool-info-main">
15291540
<span data-slot="basic-tool-tool-title">
1530-
<TextShimmer text={i18n.t("ui.tool.agent")} active={running()} />
1541+
<TextShimmer text={title()} active={running()} />
15311542
</span>
1532-
<Show when={agentType()}>{(type) => <ToolText text={type()} animate={reveal()} />}</Show>
15331543
<Show when={description()}>
15341544
<Switch>
15351545
<Match when={href()}>

packages/ui/src/i18n/ar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const dict = {
102102
"ui.tool.todos.read": "قراءة المهام",
103103
"ui.tool.questions": "أسئلة",
104104
"ui.tool.agent": "وكيل {{type}}",
105+
"ui.tool.agent.default": "وكيل",
105106

106107
"ui.common.file.one": "ملف",
107108
"ui.common.file.other": "ملفات",

packages/ui/src/i18n/br.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const dict = {
102102
"ui.tool.todos.read": "Ler tarefas",
103103
"ui.tool.questions": "Perguntas",
104104
"ui.tool.agent": "Agente {{type}}",
105+
"ui.tool.agent.default": "Agente",
105106

106107
"ui.common.file.one": "arquivo",
107108
"ui.common.file.other": "arquivos",

packages/ui/src/i18n/bs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export const dict = {
106106
"ui.tool.todos.read": "Čitanje liste zadataka",
107107
"ui.tool.questions": "Pitanja",
108108
"ui.tool.agent": "{{type}} agent",
109+
"ui.tool.agent.default": "agent",
109110

110111
"ui.common.file.one": "datoteka",
111112
"ui.common.file.other": "datoteke",

packages/ui/src/i18n/da.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export const dict = {
101101
"ui.tool.todos.read": "Læs opgaver",
102102
"ui.tool.questions": "Spørgsmål",
103103
"ui.tool.agent": "{{type}} Agent",
104+
"ui.tool.agent.default": "Agent",
104105

105106
"ui.common.file.one": "fil",
106107
"ui.common.file.other": "filer",

packages/ui/src/i18n/de.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export const dict = {
107107
"ui.tool.todos.read": "Aufgaben lesen",
108108
"ui.tool.questions": "Fragen",
109109
"ui.tool.agent": "{{type}} Agent",
110+
"ui.tool.agent.default": "Agent",
110111

111112
"ui.common.file.one": "Datei",
112113
"ui.common.file.other": "Dateien",

packages/ui/src/i18n/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export const dict: Record<string, string> = {
103103
"ui.tool.todos.read": "Read to-dos",
104104
"ui.tool.questions": "Questions",
105105
"ui.tool.agent": "{{type}} Agent",
106+
"ui.tool.agent.default": "Agent",
106107

107108
"ui.common.file.one": "file",
108109
"ui.common.file.other": "files",

packages/ui/src/i18n/es.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const dict = {
102102
"ui.tool.todos.read": "Leer tareas",
103103
"ui.tool.questions": "Preguntas",
104104
"ui.tool.agent": "Agente {{type}}",
105+
"ui.tool.agent.default": "Agente",
105106

106107
"ui.common.file.one": "archivo",
107108
"ui.common.file.other": "archivos",

packages/ui/src/i18n/fr.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const dict = {
102102
"ui.tool.todos.read": "Lire les tâches",
103103
"ui.tool.questions": "Questions",
104104
"ui.tool.agent": "Agent {{type}}",
105+
"ui.tool.agent.default": "Agent",
105106

106107
"ui.common.file.one": "fichier",
107108
"ui.common.file.other": "fichiers",

packages/ui/src/i18n/ja.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export const dict = {
101101
"ui.tool.todos.read": "Todo読み込み",
102102
"ui.tool.questions": "質問",
103103
"ui.tool.agent": "{{type}}エージェント",
104+
"ui.tool.agent.default": "エージェント",
104105

105106
"ui.common.file.one": "ファイル",
106107
"ui.common.file.other": "ファイル",

0 commit comments

Comments
 (0)