mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-04-24 08:31:10 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7e3ca1efb | ||
|
|
4b00312fef | ||
|
|
c5fd3db01e | ||
|
|
e35ffaa925 | ||
|
|
f870a9d2a7 | ||
|
|
14f044ce4f | ||
|
|
88872baffc | ||
|
|
706590c62a |
@@ -15,7 +15,7 @@ func GetClaudeModels() []*ModelInfo {
|
|||||||
DisplayName: "Claude 4.5 Haiku",
|
DisplayName: "Claude 4.5 Haiku",
|
||||||
ContextLength: 200000,
|
ContextLength: 200000,
|
||||||
MaxCompletionTokens: 64000,
|
MaxCompletionTokens: 64000,
|
||||||
// Thinking: not supported for Haiku models
|
Thinking: &ThinkingSupport{Min: 1024, Max: 128000, ZeroAllowed: true, DynamicAllowed: false},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: "claude-sonnet-4-5-20250929",
|
ID: "claude-sonnet-4-5-20250929",
|
||||||
@@ -29,15 +29,15 @@ func GetClaudeModels() []*ModelInfo {
|
|||||||
Thinking: &ThinkingSupport{Min: 1024, Max: 128000, ZeroAllowed: true, DynamicAllowed: false},
|
Thinking: &ThinkingSupport{Min: 1024, Max: 128000, ZeroAllowed: true, DynamicAllowed: false},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: "claude-opus-4-6-20260205",
|
ID: "claude-opus-4-6",
|
||||||
Object: "model",
|
Object: "model",
|
||||||
Created: 1770318000, // 2026-02-05
|
Created: 1770318000, // 2026-02-05
|
||||||
OwnedBy: "anthropic",
|
OwnedBy: "anthropic",
|
||||||
Type: "claude",
|
Type: "claude",
|
||||||
DisplayName: "Claude 4.6 Opus",
|
DisplayName: "Claude 4.6 Opus",
|
||||||
Description: "Premium model combining maximum intelligence with practical performance",
|
Description: "Premium model combining maximum intelligence with practical performance",
|
||||||
ContextLength: 200000,
|
ContextLength: 1000000,
|
||||||
MaxCompletionTokens: 64000,
|
MaxCompletionTokens: 128000,
|
||||||
Thinking: &ThinkingSupport{Min: 1024, Max: 128000, ZeroAllowed: true, DynamicAllowed: false},
|
Thinking: &ThinkingSupport{Min: 1024, Max: 128000, ZeroAllowed: true, DynamicAllowed: false},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -866,7 +866,7 @@ func GetAntigravityModelConfig() map[string]*AntigravityModelConfig {
|
|||||||
"gemini-3-flash": {Thinking: &ThinkingSupport{Min: 128, Max: 32768, ZeroAllowed: false, DynamicAllowed: true, Levels: []string{"minimal", "low", "medium", "high"}}},
|
"gemini-3-flash": {Thinking: &ThinkingSupport{Min: 128, Max: 32768, ZeroAllowed: false, DynamicAllowed: true, Levels: []string{"minimal", "low", "medium", "high"}}},
|
||||||
"claude-sonnet-4-5-thinking": {Thinking: &ThinkingSupport{Min: 1024, Max: 128000, ZeroAllowed: true, DynamicAllowed: true}, MaxCompletionTokens: 64000},
|
"claude-sonnet-4-5-thinking": {Thinking: &ThinkingSupport{Min: 1024, Max: 128000, ZeroAllowed: true, DynamicAllowed: true}, MaxCompletionTokens: 64000},
|
||||||
"claude-opus-4-5-thinking": {Thinking: &ThinkingSupport{Min: 1024, Max: 128000, ZeroAllowed: true, DynamicAllowed: true}, MaxCompletionTokens: 64000},
|
"claude-opus-4-5-thinking": {Thinking: &ThinkingSupport{Min: 1024, Max: 128000, ZeroAllowed: true, DynamicAllowed: true}, MaxCompletionTokens: 64000},
|
||||||
"claude-opus-4-6-thinking": {Thinking: &ThinkingSupport{Min: 1024, Max: 128000, ZeroAllowed: true, DynamicAllowed: true}, MaxCompletionTokens: 64000},
|
"claude-opus-4-6-thinking": {Thinking: &ThinkingSupport{Min: 1024, Max: 128000, ZeroAllowed: true, DynamicAllowed: true}, MaxCompletionTokens: 128000},
|
||||||
"claude-sonnet-4-5": {MaxCompletionTokens: 64000},
|
"claude-sonnet-4-5": {MaxCompletionTokens: 64000},
|
||||||
"gpt-oss-120b-medium": {},
|
"gpt-oss-120b-medium": {},
|
||||||
"tab_flash_lite_preview": {},
|
"tab_flash_lite_preview": {},
|
||||||
|
|||||||
@@ -883,8 +883,21 @@ func BuildAssistantMessageStruct(msg gjson.Result) KiroAssistantResponseMessage
|
|||||||
contentBuilder.WriteString(content.String())
|
contentBuilder.WriteString(content.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CRITICAL FIX: Kiro API requires non-empty content for assistant messages
|
||||||
|
// This can happen with compaction requests where assistant messages have only tool_use
|
||||||
|
// (no text content). Without this fix, Kiro API returns "Improperly formed request" error.
|
||||||
|
finalContent := contentBuilder.String()
|
||||||
|
if strings.TrimSpace(finalContent) == "" {
|
||||||
|
if len(toolUses) > 0 {
|
||||||
|
finalContent = kirocommon.DefaultAssistantContentWithTools
|
||||||
|
} else {
|
||||||
|
finalContent = kirocommon.DefaultAssistantContent
|
||||||
|
}
|
||||||
|
log.Debugf("kiro: assistant content was empty, using default: %s", finalContent)
|
||||||
|
}
|
||||||
|
|
||||||
return KiroAssistantResponseMessage{
|
return KiroAssistantResponseMessage{
|
||||||
Content: contentBuilder.String(),
|
Content: finalContent,
|
||||||
ToolUses: toolUses,
|
ToolUses: toolUses,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,14 @@ const (
|
|||||||
// InlineCodeMarker is the markdown inline code marker (backtick).
|
// InlineCodeMarker is the markdown inline code marker (backtick).
|
||||||
InlineCodeMarker = "`"
|
InlineCodeMarker = "`"
|
||||||
|
|
||||||
|
// DefaultAssistantContentWithTools is the fallback content for assistant messages
|
||||||
|
// that have tool_use but no text content. Kiro API requires non-empty content.
|
||||||
|
DefaultAssistantContentWithTools = "I'll help you with that."
|
||||||
|
|
||||||
|
// DefaultAssistantContent is the fallback content for assistant messages
|
||||||
|
// that have no content at all. Kiro API requires non-empty content.
|
||||||
|
DefaultAssistantContent = "I understand."
|
||||||
|
|
||||||
// KiroAgenticSystemPrompt is injected only for -agentic models to prevent timeouts on large writes.
|
// KiroAgenticSystemPrompt is injected only for -agentic models to prevent timeouts on large writes.
|
||||||
// AWS Kiro API has a 2-3 minute timeout for large file write operations.
|
// AWS Kiro API has a 2-3 minute timeout for large file write operations.
|
||||||
KiroAgenticSystemPrompt = `
|
KiroAgenticSystemPrompt = `
|
||||||
|
|||||||
@@ -718,13 +718,10 @@ func buildAssistantMessageFromOpenAI(msg gjson.Result) KiroAssistantResponseMess
|
|||||||
// This can happen with compaction requests or error recovery scenarios
|
// This can happen with compaction requests or error recovery scenarios
|
||||||
finalContent := contentBuilder.String()
|
finalContent := contentBuilder.String()
|
||||||
if strings.TrimSpace(finalContent) == "" {
|
if strings.TrimSpace(finalContent) == "" {
|
||||||
const defaultAssistantContentWithTools = "I'll help you with that."
|
|
||||||
const defaultAssistantContent = "I understand."
|
|
||||||
|
|
||||||
if len(toolUses) > 0 {
|
if len(toolUses) > 0 {
|
||||||
finalContent = defaultAssistantContentWithTools
|
finalContent = kirocommon.DefaultAssistantContentWithTools
|
||||||
} else {
|
} else {
|
||||||
finalContent = defaultAssistantContent
|
finalContent = kirocommon.DefaultAssistantContent
|
||||||
}
|
}
|
||||||
log.Debugf("kiro-openai: assistant content was empty, using default: %s", finalContent)
|
log.Debugf("kiro-openai: assistant content was empty, using default: %s", finalContent)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user