Commit 89aa960c by Liu

fix:编译报错

parent bcc6ee16
...@@ -380,3 +380,12 @@ export async function waitForToken(maxWaitTime = 3000): Promise<boolean> { ...@@ -380,3 +380,12 @@ export async function waitForToken(maxWaitTime = 3000): Promise<boolean> {
await new Promise(resolve => setTimeout(resolve, 300)) await new Promise(resolve => setTimeout(resolve, 300))
return true return true
} }
export function normalizeToolIdForApi(toolId: unknown): string {
if (typeof toolId !== 'string')
return ''
const normalized = toolId.trim()
if (!normalized || normalized === 'null' || normalized === 'undefined')
return ''
return normalized
}
...@@ -898,7 +898,7 @@ export const Chat: React.FC = () => { ...@@ -898,7 +898,7 @@ export const Chat: React.FC = () => {
// 缓存无效或找不到工具时才调用接口 // 缓存无效或找不到工具时才调用接口
await waitForToken() await waitForToken()
const res = await fetchToolList({ userRoles }) const res = await fetchToolList()
if (res?.data) { if (res?.data) {
const tool = res.data.find((t: any) => t.toolId === currentToolId) const tool = res.data.find((t: any) => t.toolId === currentToolId)
if (tool?.toolName) { if (tool?.toolName) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment