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'