From 6a3e3c37538b229d6c5b86679f2746539e65f84e Mon Sep 17 00:00:00 2001 From: kuaifan Date: Wed, 12 Nov 2025 01:23:34 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20AI=20=E5=8A=A9=E6=89=8B=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=9C=80=E5=A4=A7=E5=93=8D=E5=BA=94=E6=95=B0=E8=87=B3?= =?UTF-8?q?50=EF=BC=8C=E5=B9=B6=E6=B7=BB=E5=8A=A0=E4=B8=8A=E4=B8=8B?= =?UTF-8?q?=E6=96=87=E7=AA=97=E5=8F=A3=E5=A4=A7=E5=B0=8F=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/components/AIAssistant.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/assets/js/components/AIAssistant.vue b/resources/assets/js/components/AIAssistant.vue index 509dd7878..1dfc9ea51 100644 --- a/resources/assets/js/components/AIAssistant.vue +++ b/resources/assets/js/components/AIAssistant.vue @@ -131,7 +131,8 @@ export default { // 响应渲染 responses: [], responseSeed: 1, - maxResponses: 5, + maxResponses: 50, + contextWindowSize: 10, activeSSEClients: [], } }, @@ -416,7 +417,11 @@ export default { context.push([role, content]); }; const context = []; - this.responses.forEach(item => { + const windowSize = Number(this.contextWindowSize) || 0; + const recentResponses = windowSize > 0 + ? this.responses.slice(-windowSize) + : this.responses; + recentResponses.forEach(item => { if (item.prompt) { pushEntry(context, 'human', item.prompt); }