From 55059fc6c7e7f7db79a9340f5ae6657fb8af1c13 Mon Sep 17 00:00:00 2001 From: Sanyela Date: Wed, 3 Dec 2025 14:25:45 +0800 Subject: [PATCH] fix: only include history when non-empty --- src/claude/claude-kiro.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/claude/claude-kiro.js b/src/claude/claude-kiro.js index 59cb417..a8f6473 100644 --- a/src/claude/claude-kiro.js +++ b/src/claude/claude-kiro.js @@ -752,10 +752,14 @@ async initializeAuth(forceRefresh = false) { conversationState: { chatTriggerType: KIRO_CONSTANTS.CHAT_TRIGGER_TYPE_MANUAL, conversationId: conversationId, - currentMessage: {}, // Will be populated as userInputMessage - history: history + currentMessage: {} // Will be populated as userInputMessage } }; + + // 只有当 history 非空时才添加(API 可能不接受空数组) + if (history.length > 0) { + request.conversationState.history = history; + } // currentMessage 始终是 userInputMessage 类型 // 注意:API 不接受 null 值,空字段应该完全不包含