mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Log yolo mode + number of turns (#6055)
Co-authored-by: Shi Shu <shii@google.com>
This commit is contained in:
@@ -25,6 +25,9 @@ import {
|
||||
UnauthorizedError,
|
||||
UserPromptEvent,
|
||||
DEFAULT_GEMINI_FLASH_MODEL,
|
||||
logConversationFinishedEvent,
|
||||
ConversationFinishedEvent,
|
||||
ApprovalMode,
|
||||
parseAndFormatApiError,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { type Part, type PartListUnion, FinishReason } from '@google/genai';
|
||||
@@ -172,6 +175,27 @@ export const useGeminiStream = (
|
||||
return StreamingState.Idle;
|
||||
}, [isResponding, toolCalls]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
config.getApprovalMode() === ApprovalMode.YOLO &&
|
||||
streamingState === StreamingState.Idle
|
||||
) {
|
||||
const lastUserMessageIndex = history.findLastIndex(
|
||||
(item: HistoryItem) => item.type === MessageType.USER,
|
||||
);
|
||||
|
||||
const turnCount =
|
||||
lastUserMessageIndex === -1 ? 0 : history.length - lastUserMessageIndex;
|
||||
|
||||
if (turnCount > 0) {
|
||||
logConversationFinishedEvent(
|
||||
config,
|
||||
new ConversationFinishedEvent(config.getApprovalMode(), turnCount),
|
||||
);
|
||||
}
|
||||
}
|
||||
}, [streamingState, config, history]);
|
||||
|
||||
const cancelOngoingRequest = useCallback(() => {
|
||||
if (streamingState !== StreamingState.Responding) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user