fix(claude): 修复模块区域初始化并标准化内容处理

当凭据中未找到区域时,将 Claude 模块的区域明确设置为 'us-east-1',并移除 URL 构建中的冗余区域回退。
将工具结果内容提取标准化为使用 'getContentText' 方法。
更新 .gitignore 文件以忽略 Claude 和 Serena 相关的临时目录及文件。
This commit is contained in:
hex2077 2025-08-02 18:28:25 +08:00
parent b031ca4286
commit 17cfce1f03
2 changed files with 12 additions and 10 deletions

5
.gitignore vendored
View file

@ -1,2 +1,5 @@
node_modules
config.json
config.json
.serena/
.claude/
CLAUDE.md

View file

@ -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
});