Default to remote Kimi mode
This commit is contained in:
@@ -286,10 +286,10 @@ func (s *Server) handleCapabilities(w http.ResponseWriter, r *http.Request) {
|
||||
"request_log_image_redact": true,
|
||||
},
|
||||
"recommended_models": map[string]any{
|
||||
"default": "MiniMax-M2.7",
|
||||
"agent_tools": []string{"MiniMax-M2.7", "Kimi-K2.6", "Qwen3-Coder", "Qwen3.6-Plus"},
|
||||
"default": "kmodel",
|
||||
"agent_tools": []string{"kmodel", "MiniMax-M2.7", "Qwen3-Coder", "Qwen3.6-Plus"},
|
||||
"vision": []string{"Kimi-K2.6", "Qwen3-Max", "Qwen3.6-Plus", "MiniMax-M2.7", "Auto"},
|
||||
"coding": []string{"MiniMax-M2.7", "Qwen3-Coder", "Kimi-K2.6"},
|
||||
"coding": []string{"kmodel", "Qwen3-Coder", "MiniMax-M2.7"},
|
||||
},
|
||||
"model_metadata": map[string]any{
|
||||
"Kimi-K2.6": map[string]any{
|
||||
@@ -418,7 +418,7 @@ func (s *Server) handleModelProps(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
model := strings.TrimSpace(s.svc.DefaultModel())
|
||||
if model == "" {
|
||||
model = "MiniMax-M2.7"
|
||||
model = "kmodel"
|
||||
}
|
||||
writeJSON(w, http.StatusOK, map[string]any{
|
||||
"model_alias": model,
|
||||
|
||||
@@ -172,8 +172,9 @@ func New(cfg Config) *Service {
|
||||
cfg.Transport = lingmaipc.TransportAuto
|
||||
}
|
||||
if cfg.Backend == "" {
|
||||
cfg.Backend = BackendIPC
|
||||
cfg.Backend = BackendRemote
|
||||
}
|
||||
cfg.Model = normalizeModelForBackend(cfg.Backend, cfg.Model)
|
||||
if cfg.SessionMode == "" {
|
||||
cfg.SessionMode = SessionModeAuto
|
||||
}
|
||||
@@ -183,7 +184,7 @@ func New(cfg Config) *Service {
|
||||
func (s *Service) SetDefaultModel(model string) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
s.cfg.Model = strings.TrimSpace(model)
|
||||
s.cfg.Model = normalizeModelForBackend(s.cfg.Backend, model)
|
||||
}
|
||||
|
||||
func (s *Service) DefaultModel() string {
|
||||
@@ -233,9 +234,8 @@ func (s *Service) ListModels(ctx context.Context) ([]Model, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out := make([]Model, 0, len(models)+1)
|
||||
seen := map[string]bool{"Auto": true}
|
||||
out = append(out, Model{ID: "Auto", Name: "Auto"})
|
||||
out := make([]Model, 0, len(models))
|
||||
seen := map[string]bool{}
|
||||
for _, model := range models {
|
||||
id := strings.TrimSpace(model.Key)
|
||||
if id == "" || seen[id] {
|
||||
@@ -337,6 +337,7 @@ func (s *Service) generateRemote(
|
||||
if strings.TrimSpace(req.Model) == "" {
|
||||
req.Model = s.DefaultModel()
|
||||
}
|
||||
req.Model = normalizeModelForBackend(BackendRemote, req.Model)
|
||||
prompt, err := buildLingmaPrompt(req, SessionModeFresh)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -1183,3 +1184,30 @@ func valueOr(value string, fallback string) string {
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
func normalizeModelForBackend(backend BackendMode, model string) string {
|
||||
model = strings.TrimSpace(model)
|
||||
if backend != BackendRemote {
|
||||
return model
|
||||
}
|
||||
switch strings.ToLower(model) {
|
||||
case "":
|
||||
return ""
|
||||
case "kimi-k2.6":
|
||||
return "kmodel"
|
||||
case "minimax-m2.7":
|
||||
return "mmodel"
|
||||
case "qwen3-coder":
|
||||
return "dashscope_qwen3_coder"
|
||||
case "qwen3-max":
|
||||
return "dashscope_qwen_max_latest"
|
||||
case "qwen3-thinking":
|
||||
return "dashscope_qwen_plus_20250428_thinking"
|
||||
case "qwen3.6-plus":
|
||||
return "dashscope_qmodel"
|
||||
case "auto":
|
||||
return "org_auto"
|
||||
default:
|
||||
return model
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user