From 17cfce1f03007570ef07c577a1451677b1621e74 Mon Sep 17 00:00:00 2001 From: hex2077 Date: Sat, 2 Aug 2025 18:28:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(claude):=20=E4=BF=AE=E5=A4=8D=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=8C=BA=E5=9F=9F=E5=88=9D=E5=A7=8B=E5=8C=96=E5=B9=B6?= =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=96=E5=86=85=E5=AE=B9=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当凭据中未找到区域时,将 Claude 模块的区域明确设置为 'us-east-1',并移除 URL 构建中的冗余区域回退。 将工具结果内容提取标准化为使用 'getContentText' 方法。 更新 .gitignore 文件以忽略 Claude 和 Serena 相关的临时目录及文件。 --- .gitignore | 5 ++++- src/claude/claude-kiro.js | 17 ++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 36420af..a867f90 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ node_modules -config.json \ No newline at end of file +config.json +.serena/ +.claude/ +CLAUDE.md \ No newline at end of file diff --git a/src/claude/claude-kiro.js b/src/claude/claude-kiro.js index 3dbcb1b..3b9feae 100644 --- a/src/claude/claude-kiro.js +++ b/src/claude/claude-kiro.js @@ -375,15 +375,14 @@ async initializeAuth(forceRefresh = false) { // Ensure region is set before using it in URLs if (!this.region) { - console.warn('[Kiro Auth] Region not found in credentials. Using default region for URLs.'); - // You might want to set a default region here if it's critical - // For example: this.region = 'us-east-1'; + console.warn('[Kiro Auth] Region not found in credentials. Using default region us-east-1 for URLs.'); + this.region = 'us-east-1'; // Set default region } - this.refreshUrl = KIRO_CONSTANTS.REFRESH_URL.replace("{{region}}", this.region || 'us-east-1'); // Fallback to a default region - this.refreshIDCUrl = KIRO_CONSTANTS.REFRESH_IDC_URL.replace("{{region}}", this.region || 'us-east-1'); - this.baseUrl = KIRO_CONSTANTS.BASE_URL.replace("{{region}}", this.region || 'us-east-1'); - this.amazonQUrl = KIRO_CONSTANTS.AMAZON_Q_URL.replace("{{region}}", this.region || 'us-east-1'); + this.refreshUrl = KIRO_CONSTANTS.REFRESH_URL.replace("{{region}}", this.region); + this.refreshIDCUrl = KIRO_CONSTANTS.REFRESH_IDC_URL.replace("{{region}}", this.region); + this.baseUrl = KIRO_CONSTANTS.BASE_URL.replace("{{region}}", this.region); + this.amazonQUrl = KIRO_CONSTANTS.AMAZON_Q_URL.replace("{{region}}", this.region); } catch (error) { console.warn(`[Kiro Auth] Could not read credential directory ${this.credPath}: ${error.message}`); } @@ -542,7 +541,7 @@ async initializeAuth(forceRefresh = false) { userInputMessage.userInputMessageContext.toolResults = []; } userInputMessage.userInputMessageContext.toolResults.push({ - content: [{ text: part.content }], + content: [{ text: this.getContentText(part.content) }], status: 'success', toolUseId: part.tool_use_id }); @@ -596,7 +595,7 @@ async initializeAuth(forceRefresh = false) { currentContent += part.text; } else if (part.type === 'tool_result') { currentToolResults.push({ - content: [{ text: part.content }], + content: [{ text: this.getContentText(part.content) }], status: 'success', toolUseId: part.tool_use_id });