From 1b9bb1090c6071a6b5dc4e69321ce0e0793f76b3 Mon Sep 17 00:00:00 2001 From: hubian <908234780@qq.com> Date: Mon, 13 Apr 2026 12:18:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=B0=E5=BB=BA=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=97=B6=E6=A3=80=E6=9F=A5=E6=98=AF=E5=90=A6=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E6=98=AF=E6=96=B0=E5=BB=BA=E7=8A=B6=E6=80=81=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E9=87=8D=E5=A4=8D=E5=88=9B=E5=BB=BA=E7=A9=BA=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/index.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/templates/index.html b/templates/index.html index 74c7784..ddc3f72 100644 --- a/templates/index.html +++ b/templates/index.html @@ -644,6 +644,16 @@ } async function createNewConversation() { + // 检查是否已经是新建对话状态 + const container = document.getElementById('messagesContainer'); + const welcomeDiv = container.querySelector('.welcome'); + const hasMessages = container.querySelectorAll('.message').length > 0; + + // 如果当前没有对话ID,且显示欢迎界面,且没有消息,则不创建新对话 + if (!currentConversationId && welcomeDiv && !hasMessages) { + return; // 已经是新建对话状态,无需创建 + } + const res = await fetch('/api/conversations', { method: 'POST' }); const data = await res.json(); currentConversationId = data.id;