chore: bump version to 1.0.3 and refactor model mapping

This commit is contained in:
Quorinex
2026-02-23 21:46:42 +08:00
parent 6151888df5
commit d71bf09dde
3 changed files with 41 additions and 39 deletions

View File

@@ -86,12 +86,12 @@ type Account struct {
// Config represents the global application configuration.
type Config struct {
// Server settings
Password string `json:"password"` // Admin panel password
Port int `json:"port"` // HTTP server port (default: 8080)
Host string `json:"host"` // HTTP server bind address (default: 0.0.0.0)
ApiKey string `json:"apiKey,omitempty"` // API key for client authentication
RequireApiKey bool `json:"requireApiKey"` // Whether to enforce API key validation
Accounts []Account `json:"accounts"` // Registered Kiro accounts
Password string `json:"password"` // Admin panel password
Port int `json:"port"` // HTTP server port (default: 8080)
Host string `json:"host"` // HTTP server bind address (default: 0.0.0.0)
ApiKey string `json:"apiKey,omitempty"` // API key for client authentication
RequireApiKey bool `json:"requireApiKey"` // Whether to enforce API key validation
Accounts []Account `json:"accounts"` // Registered Kiro accounts
// Thinking mode configuration for extended reasoning output
ThinkingSuffix string `json:"thinkingSuffix,omitempty"` // Model suffix to trigger thinking mode (default: "-thinking")
@@ -130,7 +130,7 @@ type AccountInfo struct {
}
// Version 当前版本号
const Version = "1.0.2"
const Version = "1.0.3"
var (
cfg *Config
@@ -389,7 +389,7 @@ type ThinkingConfig struct {
func GetThinkingConfig() ThinkingConfig {
cfgLock.RLock()
defer cfgLock.RUnlock()
suffix := cfg.ThinkingSuffix
if suffix == "" {
suffix = "-thinking"
@@ -402,7 +402,7 @@ func GetThinkingConfig() ThinkingConfig {
if claudeFormat == "" {
claudeFormat = "thinking"
}
return ThinkingConfig{
Suffix: suffix,
OpenAIFormat: openaiFormat,

View File

@@ -10,32 +10,33 @@ import (
"github.com/google/uuid"
)
type modelRule struct {
pattern string
target string
// 模型映射(有序,长 key 优先匹配,避免 "claude-sonnet-4" 误匹配 "claude-sonnet-4.5"
type modelMapping struct {
key string
value string
}
var modelRules = []modelRule{
{pattern: "claude-sonnet-4-20250514", target: "claude-sonnet-4"},
{pattern: "claude-sonnet-4-6", target: "claude-sonnet-4.6"},
{pattern: "claude-sonnet-4.6", target: "claude-sonnet-4.6"},
{pattern: "claude-sonnet-4-5", target: "claude-sonnet-4.5"},
{pattern: "claude-sonnet-4.5", target: "claude-sonnet-4.5"},
{pattern: "claude-haiku-4-5", target: "claude-haiku-4.5"},
{pattern: "claude-haiku-4.5", target: "claude-haiku-4.5"},
{pattern: "claude-opus-4-6", target: "claude-opus-4.6"},
{pattern: "claude-opus-4.6", target: "claude-opus-4.6"},
{pattern: "claude-opus-4-5", target: "claude-opus-4.5"},
{pattern: "claude-opus-4.5", target: "claude-opus-4.5"},
{pattern: "claude-3-5-sonnet", target: "claude-sonnet-4.5"},
{pattern: "claude-3-opus", target: "claude-sonnet-4.5"},
{pattern: "claude-3-sonnet", target: "claude-sonnet-4"},
{pattern: "claude-3-haiku", target: "claude-haiku-4.5"},
{pattern: "gpt-4o", target: "claude-sonnet-4.5"},
{pattern: "gpt-4-turbo", target: "claude-sonnet-4.5"},
{pattern: "gpt-3.5-turbo", target: "claude-sonnet-4.5"},
{pattern: "gpt-4", target: "claude-sonnet-4.5"},
{pattern: "claude-sonnet-4", target: "claude-sonnet-4"},
var modelMapOrdered = []modelMapping{
{"claude-sonnet-4-20250514", "claude-sonnet-4"},
{"claude-sonnet-4-5", "claude-sonnet-4.5"},
{"claude-sonnet-4.5", "claude-sonnet-4.5"},
{"claude-sonnet-4-6", "claude-sonnet-4.6"},
{"claude-sonnet-4.6", "claude-sonnet-4.6"},
{"claude-haiku-4-5", "claude-haiku-4.5"},
{"claude-haiku-4.5", "claude-haiku-4.5"},
{"claude-opus-4-5", "claude-opus-4.5"},
{"claude-opus-4.5", "claude-opus-4.5"},
{"claude-opus-4-6", "claude-opus-4.6"},
{"claude-opus-4.6", "claude-opus-4.6"},
{"claude-sonnet-4", "claude-sonnet-4"},
{"claude-3-5-sonnet", "claude-sonnet-4.5"},
{"claude-3-opus", "claude-sonnet-4.5"},
{"claude-3-sonnet", "claude-sonnet-4"},
{"claude-3-haiku", "claude-haiku-4.5"},
{"gpt-4-turbo", "claude-sonnet-4.5"},
{"gpt-4o", "claude-sonnet-4.5"},
{"gpt-4", "claude-sonnet-4.5"},
{"gpt-3.5-turbo", "claude-sonnet-4.5"},
}
// Thinking 模式提示
@@ -57,9 +58,10 @@ func ParseModelAndThinking(model string, thinkingSuffix string) (string, bool) {
lower = strings.ToLower(model)
}
for _, rule := range modelRules {
if strings.Contains(lower, rule.pattern) {
return rule.target, thinking
// 映射模型(有序匹配,长 key 优先)
for _, m := range modelMapOrdered {
if strings.Contains(lower, m.key) {
return m.value, thinking
}
}

View File

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