Skip to content

Commit d71bf09

Browse files
committed
chore: bump version to 1.0.3 and refactor model mapping
1 parent 6151888 commit d71bf09

File tree

3 files changed

+41
-39
lines changed

3 files changed

+41
-39
lines changed

config/config.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ type Account struct {
8686
// Config represents the global application configuration.
8787
type Config struct {
8888
// Server settings
89-
Password string `json:"password"` // Admin panel password
90-
Port int `json:"port"` // HTTP server port (default: 8080)
91-
Host string `json:"host"` // HTTP server bind address (default: 0.0.0.0)
92-
ApiKey string `json:"apiKey,omitempty"` // API key for client authentication
93-
RequireApiKey bool `json:"requireApiKey"` // Whether to enforce API key validation
94-
Accounts []Account `json:"accounts"` // Registered Kiro accounts
89+
Password string `json:"password"` // Admin panel password
90+
Port int `json:"port"` // HTTP server port (default: 8080)
91+
Host string `json:"host"` // HTTP server bind address (default: 0.0.0.0)
92+
ApiKey string `json:"apiKey,omitempty"` // API key for client authentication
93+
RequireApiKey bool `json:"requireApiKey"` // Whether to enforce API key validation
94+
Accounts []Account `json:"accounts"` // Registered Kiro accounts
9595

9696
// Thinking mode configuration for extended reasoning output
9797
ThinkingSuffix string `json:"thinkingSuffix,omitempty"` // Model suffix to trigger thinking mode (default: "-thinking")
@@ -130,7 +130,7 @@ type AccountInfo struct {
130130
}
131131

132132
// Version 当前版本号
133-
const Version = "1.0.2"
133+
const Version = "1.0.3"
134134

135135
var (
136136
cfg *Config
@@ -389,7 +389,7 @@ type ThinkingConfig struct {
389389
func GetThinkingConfig() ThinkingConfig {
390390
cfgLock.RLock()
391391
defer cfgLock.RUnlock()
392-
392+
393393
suffix := cfg.ThinkingSuffix
394394
if suffix == "" {
395395
suffix = "-thinking"
@@ -402,7 +402,7 @@ func GetThinkingConfig() ThinkingConfig {
402402
if claudeFormat == "" {
403403
claudeFormat = "thinking"
404404
}
405-
405+
406406
return ThinkingConfig{
407407
Suffix: suffix,
408408
OpenAIFormat: openaiFormat,

proxy/translator.go

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,33 @@ import (
1010
"github.com/google/uuid"
1111
)
1212

13-
type modelRule struct {
14-
pattern string
15-
target string
13+
// 模型映射(有序,长 key 优先匹配,避免 "claude-sonnet-4" 误匹配 "claude-sonnet-4.5")
14+
type modelMapping struct {
15+
key string
16+
value string
1617
}
1718

18-
var modelRules = []modelRule{
19-
{pattern: "claude-sonnet-4-20250514", target: "claude-sonnet-4"},
20-
{pattern: "claude-sonnet-4-6", target: "claude-sonnet-4.6"},
21-
{pattern: "claude-sonnet-4.6", target: "claude-sonnet-4.6"},
22-
{pattern: "claude-sonnet-4-5", target: "claude-sonnet-4.5"},
23-
{pattern: "claude-sonnet-4.5", target: "claude-sonnet-4.5"},
24-
{pattern: "claude-haiku-4-5", target: "claude-haiku-4.5"},
25-
{pattern: "claude-haiku-4.5", target: "claude-haiku-4.5"},
26-
{pattern: "claude-opus-4-6", target: "claude-opus-4.6"},
27-
{pattern: "claude-opus-4.6", target: "claude-opus-4.6"},
28-
{pattern: "claude-opus-4-5", target: "claude-opus-4.5"},
29-
{pattern: "claude-opus-4.5", target: "claude-opus-4.5"},
30-
{pattern: "claude-3-5-sonnet", target: "claude-sonnet-4.5"},
31-
{pattern: "claude-3-opus", target: "claude-sonnet-4.5"},
32-
{pattern: "claude-3-sonnet", target: "claude-sonnet-4"},
33-
{pattern: "claude-3-haiku", target: "claude-haiku-4.5"},
34-
{pattern: "gpt-4o", target: "claude-sonnet-4.5"},
35-
{pattern: "gpt-4-turbo", target: "claude-sonnet-4.5"},
36-
{pattern: "gpt-3.5-turbo", target: "claude-sonnet-4.5"},
37-
{pattern: "gpt-4", target: "claude-sonnet-4.5"},
38-
{pattern: "claude-sonnet-4", target: "claude-sonnet-4"},
19+
var modelMapOrdered = []modelMapping{
20+
{"claude-sonnet-4-20250514", "claude-sonnet-4"},
21+
{"claude-sonnet-4-5", "claude-sonnet-4.5"},
22+
{"claude-sonnet-4.5", "claude-sonnet-4.5"},
23+
{"claude-sonnet-4-6", "claude-sonnet-4.6"},
24+
{"claude-sonnet-4.6", "claude-sonnet-4.6"},
25+
{"claude-haiku-4-5", "claude-haiku-4.5"},
26+
{"claude-haiku-4.5", "claude-haiku-4.5"},
27+
{"claude-opus-4-5", "claude-opus-4.5"},
28+
{"claude-opus-4.5", "claude-opus-4.5"},
29+
{"claude-opus-4-6", "claude-opus-4.6"},
30+
{"claude-opus-4.6", "claude-opus-4.6"},
31+
{"claude-sonnet-4", "claude-sonnet-4"},
32+
{"claude-3-5-sonnet", "claude-sonnet-4.5"},
33+
{"claude-3-opus", "claude-sonnet-4.5"},
34+
{"claude-3-sonnet", "claude-sonnet-4"},
35+
{"claude-3-haiku", "claude-haiku-4.5"},
36+
{"gpt-4-turbo", "claude-sonnet-4.5"},
37+
{"gpt-4o", "claude-sonnet-4.5"},
38+
{"gpt-4", "claude-sonnet-4.5"},
39+
{"gpt-3.5-turbo", "claude-sonnet-4.5"},
3940
}
4041

4142
// Thinking 模式提示
@@ -57,9 +58,10 @@ func ParseModelAndThinking(model string, thinkingSuffix string) (string, bool) {
5758
lower = strings.ToLower(model)
5859
}
5960

60-
for _, rule := range modelRules {
61-
if strings.Contains(lower, rule.pattern) {
62-
return rule.target, thinking
61+
// 映射模型(有序匹配,长 key 优先)
62+
for _, m := range modelMapOrdered {
63+
if strings.Contains(lower, m.key) {
64+
return m.value, thinking
6365
}
6466
}
6567

version.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0.2",
3-
"changelog": "🐛 修复流式响应缺少 usage 字段 (#10)\n🚫 新增账号封禁检测,自动禁用被封账号并标记状态 (#11)\n🔄 更新模型映射列表\n🎨 管理面板显示封禁状态与原因",
2+
"version": "1.0.3",
3+
"changelog": "✅ 新增 clientID/clientSecret 校验\n⚖️ 新增账号权重字段,支持加权轮询策略\n🔄 批量账号管理(启用/禁用/刷新/详情)\n🚫 自动跳过用量耗尽的账号\n🔧 重构模型映射为有序列表,避免误匹配",
44
"download": "https://github.com/Quorinex/Kiro-Go"
5-
}
5+
}

0 commit comments

Comments
 (0)