Skip to content

Commit 16b16ba

Browse files
committed
feature/1.7-MCP
1 parent b872e69 commit 16b16ba

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

frontend/packages/core/src/pages/mcpService/IntegrationAIContainer.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export const IntegrationAIContainer = forwardRef<IntegrationAIContainerRef, Inte
7777
const [configContent, setConfigContent] = useState<string>('')
7878
const [apiKey, setApiKey] = useState<string>('')
7979
const [apiKeyList, setApiKeyList] = useState<any[]>([])
80+
const [cascaderKeyList, setCascaderKeyList] = useState<string[]>([])
8081
const [mcpServerUrl, setMcpServerUrl] = useState<string>('')
8182
const { state } = useGlobalContext()
8283
const navigator = useNavigate()
@@ -131,6 +132,7 @@ export const IntegrationAIContainer = forwardRef<IntegrationAIContainerRef, Inte
131132
}
132133
const handleChange: CascaderProps<Option>['onChange'] = (value) => {
133134
setApiKey(value.at(-1) || '')
135+
setCascaderKeyList(value)
134136
}
135137

136138
/**
@@ -218,6 +220,10 @@ export const IntegrationAIContainer = forwardRef<IntegrationAIContainerRef, Inte
218220
}))
219221
}))
220222
setApiKeyList(transformedData)
223+
if (data.apps[0].apikeys?.length) {
224+
setApiKey(data.apps[0].apikeys[0].value)
225+
setCascaderKeyList([data.apps[0].id, data.apps[0].apikeys[0].value])
226+
}
221227
}
222228
} else {
223229
message.error(msg || $t(RESPONSE_TIPS.error))
@@ -510,8 +516,10 @@ export const IntegrationAIContainer = forwardRef<IntegrationAIContainerRef, Inte
510516
) : (
511517
<>
512518
<Cascader
519+
className='w-full'
513520
allowClear={false}
514521
options={apiKeyList}
522+
value={cascaderKeyList}
515523
onChange={handleChange}
516524
placeholder={$t('选择 API Key')}
517525
/>

0 commit comments

Comments
 (0)