mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-05 08:02:53 +00:00
feat: 新增模型轮转、额度看板和密钥管理
This commit is contained in:
1 parent
e5f4e3a583
commit
3440273f43
32 files changed
+2918
-32
No files matched your search
@@ -115,11 +115,11 @@ func (a *Server) handleDebugInference(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
cfg := a.manager.Config()
|
||||
if len(cfg.ServerKeys) == 0 {
|
||||
if cfg.FirstEnabledServerKey() == "" {
|
||||
writeAdminError(w, http.StatusServiceUnavailable, "debug_unavailable", "no local server key is configured")
|
||||
return
|
||||
}
|
||||
request.Header.Set("Authorization", "Bearer "+cfg.ServerKeys[0])
|
||||
request.Header.Set("Authorization", "Bearer "+cfg.FirstEnabledServerKey())
|
||||
if selectedKey != nil {
|
||||
request = request.WithContext(gateway.WithDebugKeyOverride(request.Context(), gateway.DebugKeyOverride{Tier: selectedKey.Tier, KeyID: selectedKey.ID}))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user