mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 13:00:52 +08:00
**Fix model switch logic when quota is exceeded**
Ensure `modelName` is updated after switching to a new model, avoiding inconsistencies in subsequent iterations.
This commit is contained in:
@@ -484,6 +484,7 @@ func (c *GeminiCLIClient) SendRawMessage(ctx context.Context, modelName string,
|
|||||||
if newModelName != "" {
|
if newModelName != "" {
|
||||||
log.Debugf("Model %s is quota exceeded. Switch to preview model %s", modelName, newModelName)
|
log.Debugf("Model %s is quota exceeded. Switch to preview model %s", modelName, newModelName)
|
||||||
rawJSON, _ = sjson.SetBytes(rawJSON, "model", newModelName)
|
rawJSON, _ = sjson.SetBytes(rawJSON, "model", newModelName)
|
||||||
|
modelName = newModelName
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -563,6 +564,7 @@ func (c *GeminiCLIClient) SendRawMessageStream(ctx context.Context, modelName st
|
|||||||
if newModelName != "" {
|
if newModelName != "" {
|
||||||
log.Debugf("Model %s is quota exceeded. Switch to preview model %s", modelName, newModelName)
|
log.Debugf("Model %s is quota exceeded. Switch to preview model %s", modelName, newModelName)
|
||||||
rawJSON, _ = sjson.SetBytes(rawJSON, "model", newModelName)
|
rawJSON, _ = sjson.SetBytes(rawJSON, "model", newModelName)
|
||||||
|
modelName = newModelName
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user