Skip to content

A Simple and Universal Swarm Intelligence Engine, Predicting Anything. 简洁通用的群体智能引擎,预测万物

fix: don't drop earlier user messages with same content from chat history

au-sf442d5fd6cfbc
diff --git a/frontend/src/components/Step5Interaction.vue b/frontend/src/components/Step5Interaction.vue
index 9eb791a1..2cdd5d5c 100644
--- a/frontend/src/components/Step5Interaction.vue
+++ b/frontend/src/components/Step5Interaction.vue
@@ -684,7 +684,7 @@ const sendToReportAgent = async (message) => {
// Build chat history for API
const historyForApi = chatHistory.value
- .filter(msg => msg.role !== 'user' || msg.content !== message)
+ .slice(0, -1)
.slice(-10) // Keep last 10 messages
.map(msg => ({
role: msg.role,
@@ -720,7 +720,7 @@ const sendToAgent = async (message) => {
let prompt = message
if (chatHistory.value.length > 1) {
const historyContext = chatHistory.value
- .filter(msg => msg.content !== message)
+ .slice(0, -1)
.slice(-6)
.map(msg => `${msg.role === 'user' ? '提问者' : '你'}:${msg.content}`)
.join('\n')