-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(tui): allow localPassword-only management auth for standalone mode #2253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -380,6 +380,10 @@ func (e *GeminiCLIExecutor) ExecuteStream(ctx context.Context, auth *cliproxyaut | |
| return nil, err | ||
| } | ||
|
|
||
| if attemptModel != baseModel { | ||
| reporter.setActualModel(attemptModel) | ||
| } | ||
|
|
||
| out := make(chan cliproxyexecutor.StreamChunk) | ||
| go func(resp *http.Response, reqBody []byte, attemptModel string) { | ||
| defer close(out) | ||
|
|
@@ -439,7 +443,11 @@ func (e *GeminiCLIExecutor) ExecuteStream(ctx context.Context, auth *cliproxyaut | |
| } | ||
| }(httpResp, append([]byte(nil), payload...), attemptModel) | ||
|
|
||
| return &cliproxyexecutor.StreamResult{Headers: httpResp.Header.Clone(), Chunks: out}, nil | ||
| headers := httpResp.Header.Clone() | ||
| if attemptModel != baseModel { | ||
| headers.Set("x-cliproxy-model-fallback", fmt.Sprintf("requested=%s,actual=%s", baseModel, attemptModel)) | ||
| } | ||
| return &cliproxyexecutor.StreamResult{Headers: headers, Chunks: out}, nil | ||
| } | ||
|
|
||
| if len(lastBody) > 0 { | ||
|
|
@@ -747,19 +755,36 @@ func applyGeminiCLIHeaders(r *http.Request, model string) { | |
| // cliPreviewFallbackOrder returns preview model candidates for a base model. | ||
| func cliPreviewFallbackOrder(model string) []string { | ||
| switch model { | ||
| case "gemini-2.0-pro-exp-02-05": | ||
| return []string{ | ||
| "gemini-2.0-flash", | ||
| "gemini-1.5-pro", | ||
| "gemini-1.5-flash", | ||
| } | ||
| case "gemini-2.0-flash": | ||
| return []string{ | ||
| "gemini-1.5-pro", | ||
| "gemini-1.5-flash", | ||
| } | ||
| case "gemini-1.5-pro": | ||
| return []string{ | ||
| "gemini-1.5-flash", | ||
| } | ||
| case "gemini-2.5-pro": | ||
| return []string{ | ||
| // "gemini-2.5-pro-preview-05-06", | ||
| // "gemini-2.5-pro-preview-06-05", | ||
| "gemini-2.0-pro-exp-02-05", | ||
| "gemini-2.0-flash", | ||
| "gemini-1.5-pro", | ||
| } | ||
|
Comment on lines
774
to
778
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Adding extra candidates here makes Useful? React with 👍 / 👎. |
||
| case "gemini-2.5-flash": | ||
| return []string{ | ||
| // "gemini-2.5-flash-preview-04-17", | ||
| // "gemini-2.5-flash-preview-05-20", | ||
| "gemini-2.0-flash", | ||
| "gemini-1.5-pro", | ||
| "gemini-1.5-flash", | ||
| } | ||
| case "gemini-2.5-flash-lite": | ||
| return []string{ | ||
| // "gemini-2.5-flash-lite-preview-06-17", | ||
| "gemini-1.5-flash", | ||
| } | ||
| default: | ||
| return nil | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only updates
actualModelforExecuteStream. The non-streamExecutepath uses the same 429 fallback loop but still publishes usage withRequestedModel == ActualModeland returns upstream headers unchanged, so regular chat/completions requests that fall back fromgemini-2.5-*to2.0/1.5are invisible to both clients and the newtotal_failoversaccounting. The reporting now depends on whether the caller setstream=true.Useful? React with 👍 / 👎.