mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
add: remove loop detect in yolo
This commit is contained in:
@@ -564,17 +564,25 @@ export class GeminiClient {
|
|||||||
|
|
||||||
const turn = new Turn(this.getChat(), prompt_id);
|
const turn = new Turn(this.getChat(), prompt_id);
|
||||||
|
|
||||||
const loopDetected = await this.loopDetector.turnStarted(signal);
|
// Disable loop detection entirely in YOLO mode
|
||||||
if (loopDetected) {
|
const loopDetectionDisabled =
|
||||||
yield { type: GeminiEventType.LoopDetected };
|
this.config.getApprovalMode() === ApprovalMode.YOLO;
|
||||||
return turn;
|
|
||||||
|
if (!loopDetectionDisabled) {
|
||||||
|
const loopDetected = await this.loopDetector.turnStarted(signal);
|
||||||
|
if (loopDetected) {
|
||||||
|
yield { type: GeminiEventType.LoopDetected };
|
||||||
|
return turn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const resultStream = turn.run(request, signal);
|
const resultStream = turn.run(request, signal);
|
||||||
for await (const event of resultStream) {
|
for await (const event of resultStream) {
|
||||||
if (this.loopDetector.addAndCheck(event)) {
|
if (!loopDetectionDisabled) {
|
||||||
yield { type: GeminiEventType.LoopDetected };
|
if (this.loopDetector.addAndCheck(event)) {
|
||||||
return turn;
|
yield { type: GeminiEventType.LoopDetected };
|
||||||
|
return turn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
yield event;
|
yield event;
|
||||||
if (event.type === GeminiEventType.Error) {
|
if (event.type === GeminiEventType.Error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user