mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-02 20:40:52 +08:00
fix(gemini-web): Correct stream translation and reduce auth refresh lead
This commit is contained in:
@@ -95,12 +95,16 @@ func (e *GeminiWebExecutor) ExecuteStream(ctx context.Context, auth *cliproxyaut
|
|||||||
defer mutex.Unlock()
|
defer mutex.Unlock()
|
||||||
}
|
}
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
line = sdktranslator.TranslateNonStream(ctx, to, from, req.Model, bytes.Clone(opts.OriginalRequest), req.Payload, bytes.Clone([]byte(line)), ¶m)
|
lines := sdktranslator.TranslateStream(ctx, to, from, req.Model, bytes.Clone(opts.OriginalRequest), req.Payload, bytes.Clone([]byte(line)), ¶m)
|
||||||
out <- cliproxyexecutor.StreamChunk{Payload: []byte(line)}
|
for _, l := range lines {
|
||||||
|
out <- cliproxyexecutor.StreamChunk{Payload: []byte(l)}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, line := range done {
|
for _, line := range done {
|
||||||
line = sdktranslator.TranslateNonStream(ctx, to, from, req.Model, bytes.Clone(opts.OriginalRequest), req.Payload, bytes.Clone([]byte(line)), ¶m)
|
lines := sdktranslator.TranslateStream(ctx, to, from, req.Model, bytes.Clone(opts.OriginalRequest), req.Payload, bytes.Clone([]byte(line)), ¶m)
|
||||||
out <- cliproxyexecutor.StreamChunk{Payload: []byte(line)}
|
for _, l := range lines {
|
||||||
|
out <- cliproxyexecutor.StreamChunk{Payload: []byte(l)}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
return out, nil
|
return out, nil
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ func (a *GeminiWebAuthenticator) Login(ctx context.Context, cfg *config.Config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *GeminiWebAuthenticator) RefreshLead() *time.Duration {
|
func (a *GeminiWebAuthenticator) RefreshLead() *time.Duration {
|
||||||
d := 3 * time.Hour
|
d := 15 * time.Minute
|
||||||
return &d
|
return &d
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user