mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-22 09:47:47 +00:00
Merge tag 'v0.3.0' into chore/sync-gemini-cli-v0.3.0
This commit is contained in:
@@ -5,14 +5,14 @@
|
||||
*/
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { Config } from '../config/config.js';
|
||||
import { GeminiClient } from '../core/client.js';
|
||||
import {
|
||||
GeminiEventType,
|
||||
import type { Config } from '../config/config.js';
|
||||
import type { GeminiClient } from '../core/client.js';
|
||||
import type {
|
||||
ServerGeminiContentEvent,
|
||||
ServerGeminiStreamEvent,
|
||||
ServerGeminiToolCallRequestEvent,
|
||||
} from '../core/turn.js';
|
||||
import { GeminiEventType } from '../core/turn.js';
|
||||
import * as loggers from '../telemetry/loggers.js';
|
||||
import { LoopType } from '../telemetry/types.js';
|
||||
import { LoopDetectionService } from './loopDetectionService.js';
|
||||
@@ -560,6 +560,30 @@ describe('LoopDetectionService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Divider Content Detection', () => {
|
||||
it('should not detect a loop for repeating divider-like content', () => {
|
||||
service.reset('');
|
||||
const dividerContent = '-'.repeat(CONTENT_CHUNK_SIZE);
|
||||
let isLoop = false;
|
||||
for (let i = 0; i < CONTENT_LOOP_THRESHOLD + 5; i++) {
|
||||
isLoop = service.addAndCheck(createContentEvent(dividerContent));
|
||||
expect(isLoop).toBe(false);
|
||||
}
|
||||
expect(loggers.logLoopDetected).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not detect a loop for repeating complex box-drawing dividers', () => {
|
||||
service.reset('');
|
||||
const dividerContent = '╭─'.repeat(CONTENT_CHUNK_SIZE / 2);
|
||||
let isLoop = false;
|
||||
for (let i = 0; i < CONTENT_LOOP_THRESHOLD + 5; i++) {
|
||||
isLoop = service.addAndCheck(createContentEvent(dividerContent));
|
||||
expect(isLoop).toBe(false);
|
||||
}
|
||||
expect(loggers.logLoopDetected).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Reset Functionality', () => {
|
||||
it('tool call should reset content count', () => {
|
||||
const contentEvent = createContentEvent('Some content.');
|
||||
|
||||
Reference in New Issue
Block a user