diff --git a/homepage/index.html b/homepage/index.html index 35469a8..30da15a 100644 --- a/homepage/index.html +++ b/homepage/index.html @@ -482,6 +482,7 @@ table.tool-table td:last-child{text-align:right}
霜砚 对话
+
@@ -606,7 +607,9 @@ let currentEngine = 'deepseek'; let isStreaming = false; let isTempUser = false; let tempCode = ''; -let chatHistory = []; +let syHistory = []; let zyHistory = []; +function getH(){return currentPersona=="zhuyuan"?zyHistory:syHistory} +function clrH(){if(currentPersona=="zhuyuan")zyHistory=[];else syHistory=[]} // ===== 人格体选择 ===== function selectPersona(p) { @@ -653,6 +656,13 @@ function openChat() { setTimeout(() => document.getElementById('modal-input').focus(), 100); } +function newChat() { + clrH(); + const b = document.getElementById("modal-body"); + if(b) b.innerHTML = "
新对话已开始,选择人格体和引擎。
"; + document.getElementById("modal-status").textContent = "新对话"; +} + function closeChat() { const modal = document.getElementById('chat-modal'); modal.classList.remove('open'); @@ -666,7 +676,7 @@ async function modalSend() { if (!msg || isStreaming) return; input.value = ''; appendMsg('user', msg); - chatHistory.push({role:'user', content: msg}); + getH().push({role:'user', content: msg}); const body = document.getElementById('modal-body'); const hint = body.querySelector('.empty-hint'); @@ -702,7 +712,7 @@ async function modalSend() { persona: currentPersona, engine: currentEngine, message: msg, - history: chatHistory.slice(-60), + history: getH().slice(-60), user: user, isTemp: isTempUser }) @@ -761,7 +771,7 @@ async function modalSend() { document.getElementById('modal-send').disabled = false; if (fullText) { - chatHistory.push({role:'assistant', content: fullText}); + getH().push({role:'assistant', content: fullText}); } bubble.removeAttribute('id'); } @@ -960,4 +970,10 @@ async function sendMessage() { })(); + + +
+ +
+ \ No newline at end of file