From e6065c56fd5e8da62e8cb1cc904f15fb1597e174 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 4 Aug 2026 18:04:15 +0800 Subject: [PATCH] fix: optimize chat ID retrieval to prevent multiple concurrent requests --- .../ai-chat/component/chat-input-operate/index.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/src/components/ai-chat/component/chat-input-operate/index.vue b/ui/src/components/ai-chat/component/chat-input-operate/index.vue index ecedd17fa8a..31f1dd2da45 100644 --- a/ui/src/components/ai-chat/component/chat-input-operate/index.vue +++ b/ui/src/components/ai-chat/component/chat-input-operate/index.vue @@ -435,6 +435,7 @@ const props = withDefaults( ) const emit = defineEmits(['update:chatId', 'update:loading', 'update:showUserInput', 'backBottom']) const chartOpenId = ref() +let chatIdPromise: Promise | null = null const chatId_context = computed({ get: () => { if (chartOpenId.value) { @@ -549,7 +550,12 @@ const uploadFile = async (file: any, fileList: any) => { const inner = reactive(file) fileAllList.value.push(inner) if (!chatId_context.value) { - chatId_context.value = await props.openChatId() + if (!chatIdPromise) { + chatIdPromise = props.openChatId().finally(() => { + chatIdPromise = null + }) + } + chatId_context.value = await chatIdPromise } const api = props.type === 'debug-ai-chat'