mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-02 04:20:50 +08:00
fix(auth): apply API key model mapping to request model
This commit is contained in:
@@ -593,6 +593,7 @@ func (m *Manager) executeMixedOnce(ctx context.Context, providers []string, req
|
|||||||
execReq := req
|
execReq := req
|
||||||
execReq.Model = rewriteModelForAuth(routeModel, auth)
|
execReq.Model = rewriteModelForAuth(routeModel, auth)
|
||||||
execReq.Model = m.applyOAuthModelMapping(auth, execReq.Model)
|
execReq.Model = m.applyOAuthModelMapping(auth, execReq.Model)
|
||||||
|
execReq.Model = m.applyAPIKeyModelMapping(auth, execReq.Model)
|
||||||
resp, errExec := executor.Execute(execCtx, auth, execReq, opts)
|
resp, errExec := executor.Execute(execCtx, auth, execReq, opts)
|
||||||
result := Result{AuthID: auth.ID, Provider: provider, Model: routeModel, Success: errExec == nil}
|
result := Result{AuthID: auth.ID, Provider: provider, Model: routeModel, Success: errExec == nil}
|
||||||
if errExec != nil {
|
if errExec != nil {
|
||||||
@@ -641,6 +642,7 @@ func (m *Manager) executeCountMixedOnce(ctx context.Context, providers []string,
|
|||||||
execReq := req
|
execReq := req
|
||||||
execReq.Model = rewriteModelForAuth(routeModel, auth)
|
execReq.Model = rewriteModelForAuth(routeModel, auth)
|
||||||
execReq.Model = m.applyOAuthModelMapping(auth, execReq.Model)
|
execReq.Model = m.applyOAuthModelMapping(auth, execReq.Model)
|
||||||
|
execReq.Model = m.applyAPIKeyModelMapping(auth, execReq.Model)
|
||||||
resp, errExec := executor.CountTokens(execCtx, auth, execReq, opts)
|
resp, errExec := executor.CountTokens(execCtx, auth, execReq, opts)
|
||||||
result := Result{AuthID: auth.ID, Provider: provider, Model: routeModel, Success: errExec == nil}
|
result := Result{AuthID: auth.ID, Provider: provider, Model: routeModel, Success: errExec == nil}
|
||||||
if errExec != nil {
|
if errExec != nil {
|
||||||
@@ -689,6 +691,7 @@ func (m *Manager) executeStreamMixedOnce(ctx context.Context, providers []string
|
|||||||
execReq := req
|
execReq := req
|
||||||
execReq.Model = rewriteModelForAuth(routeModel, auth)
|
execReq.Model = rewriteModelForAuth(routeModel, auth)
|
||||||
execReq.Model = m.applyOAuthModelMapping(auth, execReq.Model)
|
execReq.Model = m.applyOAuthModelMapping(auth, execReq.Model)
|
||||||
|
execReq.Model = m.applyAPIKeyModelMapping(auth, execReq.Model)
|
||||||
chunks, errStream := executor.ExecuteStream(execCtx, auth, execReq, opts)
|
chunks, errStream := executor.ExecuteStream(execCtx, auth, execReq, opts)
|
||||||
if errStream != nil {
|
if errStream != nil {
|
||||||
rerr := &Error{Message: errStream.Error()}
|
rerr := &Error{Message: errStream.Error()}
|
||||||
|
|||||||
Reference in New Issue
Block a user