i18n: fix type error — add useTranslation hook to MCPServerCard
Build failed type-check: AgentEditorPage.tsx MCPServerCard used t() without the useTranslation() hook (Cannot find name 't'). Added the hook. Scanned every function the patch touches for the same class; MCPServerCard was the only real one.
This commit is contained in:
parent
33c549bfca
commit
f11db110d4
1 changed files with 36 additions and 28 deletions
|
|
@ -14237,7 +14237,7 @@ index 0a8b2597..24140167 100644
|
||||||
)}
|
)}
|
||||||
|
|
||||||
diff --git a/web/src/views/AgentEditorPage.tsx b/web/src/views/AgentEditorPage.tsx
|
diff --git a/web/src/views/AgentEditorPage.tsx b/web/src/views/AgentEditorPage.tsx
|
||||||
index 9325a2e0..74847c22 100644
|
index 9325a2e0..48049521 100644
|
||||||
--- a/web/src/views/AgentEditorPage.tsx
|
--- a/web/src/views/AgentEditorPage.tsx
|
||||||
+++ b/web/src/views/AgentEditorPage.tsx
|
+++ b/web/src/views/AgentEditorPage.tsx
|
||||||
@@ -1,6 +1,7 @@
|
@@ -1,6 +1,7 @@
|
||||||
|
|
@ -14265,7 +14265,15 @@ index 9325a2e0..74847c22 100644
|
||||||
</LineItem>,
|
</LineItem>,
|
||||||
null,
|
null,
|
||||||
<div key="icon-grid" className="grid grid-cols-4 gap-1">
|
<div key="icon-grid" className="grid grid-cols-4 gap-1">
|
||||||
@@ -373,7 +375,7 @@ function MCPServerCard({
|
@@ -311,6 +313,7 @@ function MCPServerCard({
|
||||||
|
tools: enabledTools,
|
||||||
|
isLoading,
|
||||||
|
}: MCPServerCardProps) {
|
||||||
|
+ const { t } = useTranslation();
|
||||||
|
const [isFolded, setIsFolded] = useState(false);
|
||||||
|
const { values, setFieldValue, getFieldMeta } = useFormikContext<any>();
|
||||||
|
const serverFieldName = `mcp_server_${server.id}`;
|
||||||
|
@@ -373,7 +376,7 @@ function MCPServerCard({
|
||||||
return (
|
return (
|
||||||
<Disabled
|
<Disabled
|
||||||
disabled={!server.can_attach}
|
disabled={!server.can_attach}
|
||||||
|
|
@ -14274,7 +14282,7 @@ index 9325a2e0..74847c22 100644
|
||||||
>
|
>
|
||||||
<Card
|
<Card
|
||||||
expandable
|
expandable
|
||||||
@@ -387,7 +389,7 @@ function MCPServerCard({
|
@@ -387,7 +390,7 @@ function MCPServerCard({
|
||||||
bottomChildren={
|
bottomChildren={
|
||||||
<GeneralLayouts.Section flexDirection="row" gap={0.5}>
|
<GeneralLayouts.Section flexDirection="row" gap={0.5}>
|
||||||
<InputTypeIn
|
<InputTypeIn
|
||||||
|
|
@ -14283,7 +14291,7 @@ index 9325a2e0..74847c22 100644
|
||||||
variant="internal"
|
variant="internal"
|
||||||
searchIcon
|
searchIcon
|
||||||
value={query}
|
value={query}
|
||||||
@@ -547,6 +549,7 @@ export default function AgentEditorPage({
|
@@ -547,6 +550,7 @@ export default function AgentEditorPage({
|
||||||
agent: existingAgent,
|
agent: existingAgent,
|
||||||
refreshAgent,
|
refreshAgent,
|
||||||
}: AgentEditorPageProps) {
|
}: AgentEditorPageProps) {
|
||||||
|
|
@ -14291,7 +14299,7 @@ index 9325a2e0..74847c22 100644
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const appRouter = useAppRouter();
|
const appRouter = useAppRouter();
|
||||||
const { refresh: refreshAgents } = useAgents();
|
const { refresh: refreshAgents } = useAgents();
|
||||||
@@ -1224,8 +1227,8 @@ export default function AgentEditorPage({
|
@@ -1224,8 +1228,8 @@ export default function AgentEditorPage({
|
||||||
|
|
||||||
<userFilesModal.Provider>
|
<userFilesModal.Provider>
|
||||||
<UserFilesModal
|
<UserFilesModal
|
||||||
|
|
@ -14302,7 +14310,7 @@ index 9325a2e0..74847c22 100644
|
||||||
recentFiles={values.user_file_ids
|
recentFiles={values.user_file_ids
|
||||||
.map((userFileId: string) => {
|
.map((userFileId: string) => {
|
||||||
const rf = allRecentFiles.find(
|
const rf = allRecentFiles.find(
|
||||||
@@ -1296,7 +1299,7 @@ export default function AgentEditorPage({
|
@@ -1296,7 +1300,7 @@ export default function AgentEditorPage({
|
||||||
{deleteAgentModal.isOpen && (
|
{deleteAgentModal.isOpen && (
|
||||||
<ConfirmationModalLayout
|
<ConfirmationModalLayout
|
||||||
icon={SvgTrash}
|
icon={SvgTrash}
|
||||||
|
|
@ -14311,7 +14319,7 @@ index 9325a2e0..74847c22 100644
|
||||||
submit={
|
submit={
|
||||||
<Button variant="danger" onClick={handleDeleteAgent}>
|
<Button variant="danger" onClick={handleDeleteAgent}>
|
||||||
Delete Agent
|
Delete Agent
|
||||||
@@ -1319,7 +1322,7 @@ export default function AgentEditorPage({
|
@@ -1319,7 +1323,7 @@ export default function AgentEditorPage({
|
||||||
<SettingsLayouts.Root>
|
<SettingsLayouts.Root>
|
||||||
<SettingsLayouts.Header
|
<SettingsLayouts.Header
|
||||||
icon={SvgOnyxOctagon}
|
icon={SvgOnyxOctagon}
|
||||||
|
|
@ -14320,7 +14328,7 @@ index 9325a2e0..74847c22 100644
|
||||||
rightChildren={
|
rightChildren={
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Button
|
<Button
|
||||||
@@ -1327,7 +1330,7 @@ export default function AgentEditorPage({
|
@@ -1327,7 +1331,7 @@ export default function AgentEditorPage({
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => router.back()}
|
onClick={() => router.back()}
|
||||||
>
|
>
|
||||||
|
|
@ -14329,7 +14337,7 @@ index 9325a2e0..74847c22 100644
|
||||||
</Button>
|
</Button>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
tooltip={
|
tooltip={
|
||||||
@@ -1352,7 +1355,9 @@ export default function AgentEditorPage({
|
@@ -1352,7 +1356,9 @@ export default function AgentEditorPage({
|
||||||
}
|
}
|
||||||
type="submit"
|
type="submit"
|
||||||
>
|
>
|
||||||
|
|
@ -14340,7 +14348,7 @@ index 9325a2e0..74847c22 100644
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
@@ -1377,21 +1382,28 @@ export default function AgentEditorPage({
|
@@ -1377,21 +1383,28 @@ export default function AgentEditorPage({
|
||||||
alignItems="start"
|
alignItems="start"
|
||||||
>
|
>
|
||||||
<GeneralLayouts.Section>
|
<GeneralLayouts.Section>
|
||||||
|
|
@ -14374,7 +14382,7 @@ index 9325a2e0..74847c22 100644
|
||||||
/>
|
/>
|
||||||
</InputVertical>
|
</InputVertical>
|
||||||
</GeneralLayouts.Section>
|
</GeneralLayouts.Section>
|
||||||
@@ -1399,7 +1411,7 @@ export default function AgentEditorPage({
|
@@ -1399,7 +1412,7 @@ export default function AgentEditorPage({
|
||||||
<GeneralLayouts.Section width="fit">
|
<GeneralLayouts.Section width="fit">
|
||||||
<InputVertical
|
<InputVertical
|
||||||
withLabel="agent_avatar"
|
withLabel="agent_avatar"
|
||||||
|
|
@ -14383,7 +14391,7 @@ index 9325a2e0..74847c22 100644
|
||||||
>
|
>
|
||||||
<AgentIconEditor existingAgent={existingAgent} />
|
<AgentIconEditor existingAgent={existingAgent} />
|
||||||
</InputVertical>
|
</InputVertical>
|
||||||
@@ -1414,13 +1426,13 @@ export default function AgentEditorPage({
|
@@ -1414,13 +1427,13 @@ export default function AgentEditorPage({
|
||||||
<GeneralLayouts.Section>
|
<GeneralLayouts.Section>
|
||||||
<InputVertical
|
<InputVertical
|
||||||
withLabel="instructions"
|
withLabel="instructions"
|
||||||
|
|
@ -14401,7 +14409,7 @@ index 9325a2e0..74847c22 100644
|
||||||
rightSection={
|
rightSection={
|
||||||
<InsertUserVariableMenu fieldName="instructions" />
|
<InsertUserVariableMenu fieldName="instructions" />
|
||||||
}
|
}
|
||||||
@@ -1429,9 +1441,9 @@ export default function AgentEditorPage({
|
@@ -1429,9 +1442,9 @@ export default function AgentEditorPage({
|
||||||
|
|
||||||
<InputVertical
|
<InputVertical
|
||||||
withLabel="starter_messages"
|
withLabel="starter_messages"
|
||||||
|
|
@ -14414,7 +14422,7 @@ index 9325a2e0..74847c22 100644
|
||||||
>
|
>
|
||||||
<AgentStarterMessages />
|
<AgentStarterMessages />
|
||||||
</InputVertical>
|
</InputVertical>
|
||||||
@@ -1496,15 +1508,15 @@ export default function AgentEditorPage({
|
@@ -1496,15 +1509,15 @@ export default function AgentEditorPage({
|
||||||
height="auto"
|
height="auto"
|
||||||
>
|
>
|
||||||
<Content
|
<Content
|
||||||
|
|
@ -14433,7 +14441,7 @@ index 9325a2e0..74847c22 100644
|
||||||
center
|
center
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
@@ -1519,21 +1531,21 @@ export default function AgentEditorPage({
|
@@ -1519,21 +1532,21 @@ export default function AgentEditorPage({
|
||||||
<>
|
<>
|
||||||
<InputHorizontal
|
<InputHorizontal
|
||||||
withLabel="is_featured"
|
withLabel="is_featured"
|
||||||
|
|
@ -14459,7 +14467,7 @@ index 9325a2e0..74847c22 100644
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@@ -1568,12 +1580,11 @@ export default function AgentEditorPage({
|
@@ -1568,12 +1581,11 @@ export default function AgentEditorPage({
|
||||||
}
|
}
|
||||||
value={labelInputValue}
|
value={labelInputValue}
|
||||||
onChange={setLabelInputValue}
|
onChange={setLabelInputValue}
|
||||||
|
|
@ -14474,7 +14482,7 @@ index 9325a2e0..74847c22 100644
|
||||||
</Text>
|
</Text>
|
||||||
</GeneralLayouts.Section>
|
</GeneralLayouts.Section>
|
||||||
</GeneralLayouts.Section>
|
</GeneralLayouts.Section>
|
||||||
@@ -1587,8 +1598,8 @@ export default function AgentEditorPage({
|
@@ -1587,8 +1599,8 @@ export default function AgentEditorPage({
|
||||||
|
|
||||||
<SimpleCollapsible>
|
<SimpleCollapsible>
|
||||||
<SimpleCollapsible.Header
|
<SimpleCollapsible.Header
|
||||||
|
|
@ -14485,7 +14493,7 @@ index 9325a2e0..74847c22 100644
|
||||||
/>
|
/>
|
||||||
<SimpleCollapsible.Content>
|
<SimpleCollapsible.Content>
|
||||||
<GeneralLayouts.Section
|
<GeneralLayouts.Section
|
||||||
@@ -1602,8 +1613,12 @@ export default function AgentEditorPage({
|
@@ -1602,8 +1614,12 @@ export default function AgentEditorPage({
|
||||||
<Card border="solid" rounding="lg">
|
<Card border="solid" rounding="lg">
|
||||||
<InputHorizontal
|
<InputHorizontal
|
||||||
withLabel="image_generation"
|
withLabel="image_generation"
|
||||||
|
|
@ -14500,7 +14508,7 @@ index 9325a2e0..74847c22 100644
|
||||||
disabled={!isImageGenerationAvailable}
|
disabled={!isImageGenerationAvailable}
|
||||||
>
|
>
|
||||||
<SwitchField
|
<SwitchField
|
||||||
@@ -1618,8 +1633,12 @@ export default function AgentEditorPage({
|
@@ -1618,8 +1634,12 @@ export default function AgentEditorPage({
|
||||||
<Card border="solid" rounding="lg">
|
<Card border="solid" rounding="lg">
|
||||||
<InputHorizontal
|
<InputHorizontal
|
||||||
withLabel="web_search"
|
withLabel="web_search"
|
||||||
|
|
@ -14515,7 +14523,7 @@ index 9325a2e0..74847c22 100644
|
||||||
disabled={!webSearchTool}
|
disabled={!webSearchTool}
|
||||||
>
|
>
|
||||||
<SwitchField
|
<SwitchField
|
||||||
@@ -1634,8 +1653,12 @@ export default function AgentEditorPage({
|
@@ -1634,8 +1654,12 @@ export default function AgentEditorPage({
|
||||||
<Card border="solid" rounding="lg">
|
<Card border="solid" rounding="lg">
|
||||||
<InputHorizontal
|
<InputHorizontal
|
||||||
withLabel="open_url"
|
withLabel="open_url"
|
||||||
|
|
@ -14530,7 +14538,7 @@ index 9325a2e0..74847c22 100644
|
||||||
disabled={!openURLTool}
|
disabled={!openURLTool}
|
||||||
>
|
>
|
||||||
<SwitchField
|
<SwitchField
|
||||||
@@ -1650,8 +1673,12 @@ export default function AgentEditorPage({
|
@@ -1650,8 +1674,12 @@ export default function AgentEditorPage({
|
||||||
<Card border="solid" rounding="lg">
|
<Card border="solid" rounding="lg">
|
||||||
<InputHorizontal
|
<InputHorizontal
|
||||||
withLabel="code_interpreter"
|
withLabel="code_interpreter"
|
||||||
|
|
@ -14545,7 +14553,7 @@ index 9325a2e0..74847c22 100644
|
||||||
disabled={!codeInterpreterTool}
|
disabled={!codeInterpreterTool}
|
||||||
>
|
>
|
||||||
<SwitchField
|
<SwitchField
|
||||||
@@ -1666,8 +1693,12 @@ export default function AgentEditorPage({
|
@@ -1666,8 +1694,12 @@ export default function AgentEditorPage({
|
||||||
<Card border="solid" rounding="lg">
|
<Card border="solid" rounding="lg">
|
||||||
<InputHorizontal
|
<InputHorizontal
|
||||||
withLabel="coding_agent"
|
withLabel="coding_agent"
|
||||||
|
|
@ -14560,7 +14568,7 @@ index 9325a2e0..74847c22 100644
|
||||||
disabled={!codingAgentTool}
|
disabled={!codingAgentTool}
|
||||||
>
|
>
|
||||||
<SwitchField
|
<SwitchField
|
||||||
@@ -1731,8 +1762,8 @@ export default function AgentEditorPage({
|
@@ -1731,8 +1763,8 @@ export default function AgentEditorPage({
|
||||||
|
|
||||||
<SimpleCollapsible>
|
<SimpleCollapsible>
|
||||||
<SimpleCollapsible.Header
|
<SimpleCollapsible.Header
|
||||||
|
|
@ -14571,7 +14579,7 @@ index 9325a2e0..74847c22 100644
|
||||||
/>
|
/>
|
||||||
<SimpleCollapsible.Content>
|
<SimpleCollapsible.Content>
|
||||||
<GeneralLayouts.Section>
|
<GeneralLayouts.Section>
|
||||||
@@ -1740,8 +1771,10 @@ export default function AgentEditorPage({
|
@@ -1740,8 +1772,10 @@ export default function AgentEditorPage({
|
||||||
<GeneralLayouts.Section>
|
<GeneralLayouts.Section>
|
||||||
<InputHorizontal
|
<InputHorizontal
|
||||||
withLabel="llm_model"
|
withLabel="llm_model"
|
||||||
|
|
@ -14584,7 +14592,7 @@ index 9325a2e0..74847c22 100644
|
||||||
>
|
>
|
||||||
<ModelSelector
|
<ModelSelector
|
||||||
value={
|
value={
|
||||||
@@ -1760,9 +1793,9 @@ export default function AgentEditorPage({
|
@@ -1760,9 +1794,9 @@ export default function AgentEditorPage({
|
||||||
</InputHorizontal>
|
</InputHorizontal>
|
||||||
<InputHorizontal
|
<InputHorizontal
|
||||||
withLabel="knowledge_cutoff_date"
|
withLabel="knowledge_cutoff_date"
|
||||||
|
|
@ -14597,7 +14605,7 @@ index 9325a2e0..74847c22 100644
|
||||||
>
|
>
|
||||||
<InputDatePickerField
|
<InputDatePickerField
|
||||||
name="knowledge_cutoff_date"
|
name="knowledge_cutoff_date"
|
||||||
@@ -1771,7 +1804,7 @@ export default function AgentEditorPage({
|
@@ -1771,7 +1805,7 @@ export default function AgentEditorPage({
|
||||||
</InputHorizontal>
|
</InputHorizontal>
|
||||||
<InputHorizontal
|
<InputHorizontal
|
||||||
withLabel="replace_base_system_prompt"
|
withLabel="replace_base_system_prompt"
|
||||||
|
|
@ -14606,7 +14614,7 @@ index 9325a2e0..74847c22 100644
|
||||||
suffix="(Not Recommended)"
|
suffix="(Not Recommended)"
|
||||||
description='Remove the base system prompt which includes useful instructions (e.g. "You can use Markdown tables"). This may affect response quality.'
|
description='Remove the base system prompt which includes useful instructions (e.g. "You can use Markdown tables"). This may affect response quality.'
|
||||||
>
|
>
|
||||||
@@ -1783,23 +1816,19 @@ export default function AgentEditorPage({
|
@@ -1783,23 +1817,19 @@ export default function AgentEditorPage({
|
||||||
<GeneralLayouts.Section gap={0.25}>
|
<GeneralLayouts.Section gap={0.25}>
|
||||||
<InputVertical
|
<InputVertical
|
||||||
withLabel="reminders"
|
withLabel="reminders"
|
||||||
|
|
@ -14634,7 +14642,7 @@ index 9325a2e0..74847c22 100644
|
||||||
</Text>
|
</Text>
|
||||||
</GeneralLayouts.Section>
|
</GeneralLayouts.Section>
|
||||||
</GeneralLayouts.Section>
|
</GeneralLayouts.Section>
|
||||||
@@ -1846,8 +1875,8 @@ export default function AgentEditorPage({
|
@@ -1846,8 +1876,8 @@ export default function AgentEditorPage({
|
||||||
</InputHorizontal>
|
</InputHorizontal>
|
||||||
)}
|
)}
|
||||||
<InputHorizontal
|
<InputHorizontal
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue