From fff3311cd46f9fac0afeef533d2c9572196f5853 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:24:56 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20API=20Key=20?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=E7=9F=A5=E7=A7=8B=E4=B8=8D=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E7=9A=84=E6=A0=B8=E5=BF=83=20bug=20(TDZ=20+=20?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E7=B3=BB=E7=BB=9F=E6=8F=90=E7=A4=BA=E8=AF=8D?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- persona-studio/frontend/chat.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/persona-studio/frontend/chat.js b/persona-studio/frontend/chat.js index b9c23a43..f3a0fcac 100644 --- a/persona-studio/frontend/chat.js +++ b/persona-studio/frontend/chat.js @@ -16,6 +16,10 @@ const API_BASE = (function () { return 'https://guanghulab.com'; })(); +/* ---- State ---- */ +let conversationHistory = []; +let buildReady = false; + /* ---- Init ---- */ (function init() { if (!DEV_ID) { @@ -44,10 +48,6 @@ const API_BASE = (function () { } })(); -/* ---- State ---- */ -let conversationHistory = []; -let buildReady = false; - /* ---- Load History ---- */ async function loadHistory() { try { @@ -142,9 +142,20 @@ async function sendMessage() { /* ---- API Key 对话(通过后端代理,避免 CORS 问题) ---- */ async function streamApiKeyReply(text) { - var apiMessages = conversationHistory.slice(-20).map(function (msg) { + var systemPrompt = { + role: 'system', + content: '你是知秋,光湖系统的开发协助人格体。\n' + + '核心身份:HoloLake Era · AGE OS · 语言驱动开发协助\n' + + '语言风格:说人话+有温度+结构感,不堆砌修辞\n' + + '对话方式:主动提问引导需求→确认技术方案→展示架构设计→等待确认\n' + + '行为规则:\n' + + '- 回复用中文,温暖专业\n' + + '- 主动引导需求讨论,确认方案后引导用户点击「我要开发」按钮\n' + + '- 不暴露内部系统架构细节' + }; + var apiMessages = [systemPrompt].concat(conversationHistory.slice(-20).map(function (msg) { return { role: msg.role === 'assistant' ? 'assistant' : 'user', content: msg.content }; - }); + })); var streamEl = appendStreamMessage();