mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-19 04:40:52 +08:00
refactor(gemini-web): Rename flash image preview model ID
This commit is contained in:
@@ -225,7 +225,7 @@ func MaskToken28(s string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var NanoBananaModel = map[string]struct{}{
|
var NanoBananaModel = map[string]struct{}{
|
||||||
"gemini-2.5-flash-image-preview": {},
|
"gemini-2.5-flash-image-web": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGeminiClient creates a client. Pass empty strings to auto-detect via browser cookies (not implemented in Go port).
|
// NewGeminiClient creates a client. Pass empty strings to auto-detect via browser cookies (not implemented in Go port).
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func EnsureGeminiWebAliasMap() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if m.ID == "gemini-2.5-flash" {
|
if m.ID == "gemini-2.5-flash" {
|
||||||
aliasMap["gemini-2.5-flash-image-preview"] = "gemini-2.5-flash"
|
aliasMap["gemini-2.5-flash-image-web"] = "gemini-2.5-flash"
|
||||||
}
|
}
|
||||||
alias := AliasFromModelID(m.ID)
|
alias := AliasFromModelID(m.ID)
|
||||||
aliasMap[strings.ToLower(alias)] = strings.ToLower(m.ID)
|
aliasMap[strings.ToLower(alias)] = strings.ToLower(m.ID)
|
||||||
@@ -65,8 +65,8 @@ func GetGeminiWebAliasedModels() []*registry.ModelInfo {
|
|||||||
continue
|
continue
|
||||||
} else if m.ID == "gemini-2.5-flash" {
|
} else if m.ID == "gemini-2.5-flash" {
|
||||||
cpy := *m
|
cpy := *m
|
||||||
cpy.ID = "gemini-2.5-flash-image-preview"
|
cpy.ID = "gemini-2.5-flash-image-web"
|
||||||
cpy.Name = "gemini-2.5-flash-image-preview"
|
cpy.Name = "gemini-2.5-flash-image-web"
|
||||||
cpy.DisplayName = "Nano Banana"
|
cpy.DisplayName = "Nano Banana"
|
||||||
cpy.Description = "Gemini 2.5 Flash Preview Image"
|
cpy.Description = "Gemini 2.5 Flash Preview Image"
|
||||||
aliased = append(aliased, &cpy)
|
aliased = append(aliased, &cpy)
|
||||||
|
|||||||
@@ -460,10 +460,10 @@ func (s *GeminiWebState) Send(ctx context.Context, modelName string, reqPayload
|
|||||||
return nil, s.wrapSendError(err), nil
|
return nil, s.wrapSendError(err), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook: For gemini-2.5-flash-image-preview, if the API returns only images without any text,
|
// Hook: For gemini-2.5-flash-image-web, if the API returns only images without any text,
|
||||||
// inject a small textual summary so that conversation persistence has non-empty assistant text.
|
// inject a small textual summary so that conversation persistence has non-empty assistant text.
|
||||||
// This helps conversation recovery (conv store) to match sessions reliably.
|
// This helps conversation recovery (conv store) to match sessions reliably.
|
||||||
if strings.EqualFold(modelName, "gemini-2.5-flash-image-preview") {
|
if strings.EqualFold(modelName, "gemini-2.5-flash-image-web") {
|
||||||
if len(output.Candidates) > 0 {
|
if len(output.Candidates) > 0 {
|
||||||
c := output.Candidates[output.Chosen]
|
c := output.Candidates[output.Chosen]
|
||||||
hasNoText := strings.TrimSpace(c.Text) == ""
|
hasNoText := strings.TrimSpace(c.Text) == ""
|
||||||
|
|||||||
Reference in New Issue
Block a user