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
|
||||
index 9325a2e0..74847c22 100644
|
||||
index 9325a2e0..48049521 100644
|
||||
--- a/web/src/views/AgentEditorPage.tsx
|
||||
+++ b/web/src/views/AgentEditorPage.tsx
|
||||
@@ -1,6 +1,7 @@
|
||||
|
|
@ -14265,7 +14265,15 @@ index 9325a2e0..74847c22 100644
|
|||
</LineItem>,
|
||||
null,
|
||||
<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 (
|
||||
<Disabled
|
||||
disabled={!server.can_attach}
|
||||
|
|
@ -14274,7 +14282,7 @@ index 9325a2e0..74847c22 100644
|
|||
>
|
||||
<Card
|
||||
expandable
|
||||
@@ -387,7 +389,7 @@ function MCPServerCard({
|
||||
@@ -387,7 +390,7 @@ function MCPServerCard({
|
||||
bottomChildren={
|
||||
<GeneralLayouts.Section flexDirection="row" gap={0.5}>
|
||||
<InputTypeIn
|
||||
|
|
@ -14283,7 +14291,7 @@ index 9325a2e0..74847c22 100644
|
|||
variant="internal"
|
||||
searchIcon
|
||||
value={query}
|
||||
@@ -547,6 +549,7 @@ export default function AgentEditorPage({
|
||||
@@ -547,6 +550,7 @@ export default function AgentEditorPage({
|
||||
agent: existingAgent,
|
||||
refreshAgent,
|
||||
}: AgentEditorPageProps) {
|
||||
|
|
@ -14291,7 +14299,7 @@ index 9325a2e0..74847c22 100644
|
|||
const router = useRouter();
|
||||
const appRouter = useAppRouter();
|
||||
const { refresh: refreshAgents } = useAgents();
|
||||
@@ -1224,8 +1227,8 @@ export default function AgentEditorPage({
|
||||
@@ -1224,8 +1228,8 @@ export default function AgentEditorPage({
|
||||
|
||||
<userFilesModal.Provider>
|
||||
<UserFilesModal
|
||||
|
|
@ -14302,7 +14310,7 @@ index 9325a2e0..74847c22 100644
|
|||
recentFiles={values.user_file_ids
|
||||
.map((userFileId: string) => {
|
||||
const rf = allRecentFiles.find(
|
||||
@@ -1296,7 +1299,7 @@ export default function AgentEditorPage({
|
||||
@@ -1296,7 +1300,7 @@ export default function AgentEditorPage({
|
||||
{deleteAgentModal.isOpen && (
|
||||
<ConfirmationModalLayout
|
||||
icon={SvgTrash}
|
||||
|
|
@ -14311,7 +14319,7 @@ index 9325a2e0..74847c22 100644
|
|||
submit={
|
||||
<Button variant="danger" onClick={handleDeleteAgent}>
|
||||
Delete Agent
|
||||
@@ -1319,7 +1322,7 @@ export default function AgentEditorPage({
|
||||
@@ -1319,7 +1323,7 @@ export default function AgentEditorPage({
|
||||
<SettingsLayouts.Root>
|
||||
<SettingsLayouts.Header
|
||||
icon={SvgOnyxOctagon}
|
||||
|
|
@ -14320,7 +14328,7 @@ index 9325a2e0..74847c22 100644
|
|||
rightChildren={
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
@@ -1327,7 +1330,7 @@ export default function AgentEditorPage({
|
||||
@@ -1327,7 +1331,7 @@ export default function AgentEditorPage({
|
||||
type="button"
|
||||
onClick={() => router.back()}
|
||||
>
|
||||
|
|
@ -14329,7 +14337,7 @@ index 9325a2e0..74847c22 100644
|
|||
</Button>
|
||||
<Tooltip
|
||||
tooltip={
|
||||
@@ -1352,7 +1355,9 @@ export default function AgentEditorPage({
|
||||
@@ -1352,7 +1356,9 @@ export default function AgentEditorPage({
|
||||
}
|
||||
type="submit"
|
||||
>
|
||||
|
|
@ -14340,7 +14348,7 @@ index 9325a2e0..74847c22 100644
|
|||
</Button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
@@ -1377,21 +1382,28 @@ export default function AgentEditorPage({
|
||||
@@ -1377,21 +1383,28 @@ export default function AgentEditorPage({
|
||||
alignItems="start"
|
||||
>
|
||||
<GeneralLayouts.Section>
|
||||
|
|
@ -14374,7 +14382,7 @@ index 9325a2e0..74847c22 100644
|
|||
/>
|
||||
</InputVertical>
|
||||
</GeneralLayouts.Section>
|
||||
@@ -1399,7 +1411,7 @@ export default function AgentEditorPage({
|
||||
@@ -1399,7 +1412,7 @@ export default function AgentEditorPage({
|
||||
<GeneralLayouts.Section width="fit">
|
||||
<InputVertical
|
||||
withLabel="agent_avatar"
|
||||
|
|
@ -14383,7 +14391,7 @@ index 9325a2e0..74847c22 100644
|
|||
>
|
||||
<AgentIconEditor existingAgent={existingAgent} />
|
||||
</InputVertical>
|
||||
@@ -1414,13 +1426,13 @@ export default function AgentEditorPage({
|
||||
@@ -1414,13 +1427,13 @@ export default function AgentEditorPage({
|
||||
<GeneralLayouts.Section>
|
||||
<InputVertical
|
||||
withLabel="instructions"
|
||||
|
|
@ -14401,7 +14409,7 @@ index 9325a2e0..74847c22 100644
|
|||
rightSection={
|
||||
<InsertUserVariableMenu fieldName="instructions" />
|
||||
}
|
||||
@@ -1429,9 +1441,9 @@ export default function AgentEditorPage({
|
||||
@@ -1429,9 +1442,9 @@ export default function AgentEditorPage({
|
||||
|
||||
<InputVertical
|
||||
withLabel="starter_messages"
|
||||
|
|
@ -14414,7 +14422,7 @@ index 9325a2e0..74847c22 100644
|
|||
>
|
||||
<AgentStarterMessages />
|
||||
</InputVertical>
|
||||
@@ -1496,15 +1508,15 @@ export default function AgentEditorPage({
|
||||
@@ -1496,15 +1509,15 @@ export default function AgentEditorPage({
|
||||
height="auto"
|
||||
>
|
||||
<Content
|
||||
|
|
@ -14433,7 +14441,7 @@ index 9325a2e0..74847c22 100644
|
|||
center
|
||||
>
|
||||
<Button
|
||||
@@ -1519,21 +1531,21 @@ export default function AgentEditorPage({
|
||||
@@ -1519,21 +1532,21 @@ export default function AgentEditorPage({
|
||||
<>
|
||||
<InputHorizontal
|
||||
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}
|
||||
onChange={setLabelInputValue}
|
||||
|
|
@ -14474,7 +14482,7 @@ index 9325a2e0..74847c22 100644
|
|||
</Text>
|
||||
</GeneralLayouts.Section>
|
||||
</GeneralLayouts.Section>
|
||||
@@ -1587,8 +1598,8 @@ export default function AgentEditorPage({
|
||||
@@ -1587,8 +1599,8 @@ export default function AgentEditorPage({
|
||||
|
||||
<SimpleCollapsible>
|
||||
<SimpleCollapsible.Header
|
||||
|
|
@ -14485,7 +14493,7 @@ index 9325a2e0..74847c22 100644
|
|||
/>
|
||||
<SimpleCollapsible.Content>
|
||||
<GeneralLayouts.Section
|
||||
@@ -1602,8 +1613,12 @@ export default function AgentEditorPage({
|
||||
@@ -1602,8 +1614,12 @@ export default function AgentEditorPage({
|
||||
<Card border="solid" rounding="lg">
|
||||
<InputHorizontal
|
||||
withLabel="image_generation"
|
||||
|
|
@ -14500,7 +14508,7 @@ index 9325a2e0..74847c22 100644
|
|||
disabled={!isImageGenerationAvailable}
|
||||
>
|
||||
<SwitchField
|
||||
@@ -1618,8 +1633,12 @@ export default function AgentEditorPage({
|
||||
@@ -1618,8 +1634,12 @@ export default function AgentEditorPage({
|
||||
<Card border="solid" rounding="lg">
|
||||
<InputHorizontal
|
||||
withLabel="web_search"
|
||||
|
|
@ -14515,7 +14523,7 @@ index 9325a2e0..74847c22 100644
|
|||
disabled={!webSearchTool}
|
||||
>
|
||||
<SwitchField
|
||||
@@ -1634,8 +1653,12 @@ export default function AgentEditorPage({
|
||||
@@ -1634,8 +1654,12 @@ export default function AgentEditorPage({
|
||||
<Card border="solid" rounding="lg">
|
||||
<InputHorizontal
|
||||
withLabel="open_url"
|
||||
|
|
@ -14530,7 +14538,7 @@ index 9325a2e0..74847c22 100644
|
|||
disabled={!openURLTool}
|
||||
>
|
||||
<SwitchField
|
||||
@@ -1650,8 +1673,12 @@ export default function AgentEditorPage({
|
||||
@@ -1650,8 +1674,12 @@ export default function AgentEditorPage({
|
||||
<Card border="solid" rounding="lg">
|
||||
<InputHorizontal
|
||||
withLabel="code_interpreter"
|
||||
|
|
@ -14545,7 +14553,7 @@ index 9325a2e0..74847c22 100644
|
|||
disabled={!codeInterpreterTool}
|
||||
>
|
||||
<SwitchField
|
||||
@@ -1666,8 +1693,12 @@ export default function AgentEditorPage({
|
||||
@@ -1666,8 +1694,12 @@ export default function AgentEditorPage({
|
||||
<Card border="solid" rounding="lg">
|
||||
<InputHorizontal
|
||||
withLabel="coding_agent"
|
||||
|
|
@ -14560,7 +14568,7 @@ index 9325a2e0..74847c22 100644
|
|||
disabled={!codingAgentTool}
|
||||
>
|
||||
<SwitchField
|
||||
@@ -1731,8 +1762,8 @@ export default function AgentEditorPage({
|
||||
@@ -1731,8 +1763,8 @@ export default function AgentEditorPage({
|
||||
|
||||
<SimpleCollapsible>
|
||||
<SimpleCollapsible.Header
|
||||
|
|
@ -14571,7 +14579,7 @@ index 9325a2e0..74847c22 100644
|
|||
/>
|
||||
<SimpleCollapsible.Content>
|
||||
<GeneralLayouts.Section>
|
||||
@@ -1740,8 +1771,10 @@ export default function AgentEditorPage({
|
||||
@@ -1740,8 +1772,10 @@ export default function AgentEditorPage({
|
||||
<GeneralLayouts.Section>
|
||||
<InputHorizontal
|
||||
withLabel="llm_model"
|
||||
|
|
@ -14584,7 +14592,7 @@ index 9325a2e0..74847c22 100644
|
|||
>
|
||||
<ModelSelector
|
||||
value={
|
||||
@@ -1760,9 +1793,9 @@ export default function AgentEditorPage({
|
||||
@@ -1760,9 +1794,9 @@ export default function AgentEditorPage({
|
||||
</InputHorizontal>
|
||||
<InputHorizontal
|
||||
withLabel="knowledge_cutoff_date"
|
||||
|
|
@ -14597,7 +14605,7 @@ index 9325a2e0..74847c22 100644
|
|||
>
|
||||
<InputDatePickerField
|
||||
name="knowledge_cutoff_date"
|
||||
@@ -1771,7 +1804,7 @@ export default function AgentEditorPage({
|
||||
@@ -1771,7 +1805,7 @@ export default function AgentEditorPage({
|
||||
</InputHorizontal>
|
||||
<InputHorizontal
|
||||
withLabel="replace_base_system_prompt"
|
||||
|
|
@ -14606,7 +14614,7 @@ index 9325a2e0..74847c22 100644
|
|||
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.'
|
||||
>
|
||||
@@ -1783,23 +1816,19 @@ export default function AgentEditorPage({
|
||||
@@ -1783,23 +1817,19 @@ export default function AgentEditorPage({
|
||||
<GeneralLayouts.Section gap={0.25}>
|
||||
<InputVertical
|
||||
withLabel="reminders"
|
||||
|
|
@ -14634,7 +14642,7 @@ index 9325a2e0..74847c22 100644
|
|||
</Text>
|
||||
</GeneralLayouts.Section>
|
||||
</GeneralLayouts.Section>
|
||||
@@ -1846,8 +1875,8 @@ export default function AgentEditorPage({
|
||||
@@ -1846,8 +1876,8 @@ export default function AgentEditorPage({
|
||||
</InputHorizontal>
|
||||
)}
|
||||
<InputHorizontal
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue