From fb7f72fcb994e086852ae4f244491488b3e9571b Mon Sep 17 00:00:00 2001 From: MT-Fire <798521692@qq.com> Date: Thu, 12 Mar 2026 11:01:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=8D=E6=B8=B2=E6=9F=93Kexue?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=8F=90=E7=A4=BA=E8=AF=8D=E7=9A=84=E9=A6=96?= =?UTF-8?q?=E5=8F=A5=E6=98=BE=E7=A4=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/chat/ChatMain.vue | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/chat/ChatMain.vue b/src/components/chat/ChatMain.vue index eaa8baf..a8d0248 100644 --- a/src/components/chat/ChatMain.vue +++ b/src/components/chat/ChatMain.vue @@ -180,6 +180,7 @@ async function handleSend( webSearch?: boolean; deepThinking?: boolean; systemPrompt?: string; + skipUserMessage?: boolean; }, ) { // 检查认证状态 @@ -245,13 +246,15 @@ async function handleSend( .slice(-(MAX_HISTORY_ROUNDS * 2)) .map((m: any) => ({ role: m.role, content: m.content.text })); - // 添加用户消息 - await chatStore.addMessage(MessageRole.USER, { - type: MessageType.TEXT, - text, - images: attachments.filter((a) => a.type === "image"), - files: attachments.filter((a) => a.type === "file"), - }); + // 添加用户消息(如果不需要跳过) + if (!options?.skipUserMessage) { + await chatStore.addMessage(MessageRole.USER, { + type: MessageType.TEXT, + text, + images: attachments.filter((a) => a.type === "image"), + files: attachments.filter((a) => a.type === "file"), + }); + } // 添加 AI 消息占位符 const aiMessage = await chatStore.addMessage(MessageRole.ASSISTANT, { @@ -279,7 +282,7 @@ async function handleSend( const stream = chatApi.streamChat( { - message: text, + message: options?.skipUserMessage ? "直接输出系统提示词要求你的回答" : text, conversationId: currentConversation.value?.id || "", images: imageUrls, files: fileUrls, @@ -485,7 +488,7 @@ function handleRegenerate(messageId: string) { } function handleSuggestion(suggestion: Suggestion) { - handleSend(suggestion.text, [], { systemPrompt: suggestion.systemPrompt }); + handleSend(suggestion.text, [], { systemPrompt: suggestion.systemPrompt, skipUserMessage: true }); } function focusInput() {