mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 19:14:33 -07:00
Show model in history (#13034)
This commit is contained in:
committed by
GitHub
parent
0fcbff506e
commit
ab11b2c27f
@@ -44,6 +44,7 @@ import type {
|
||||
HistoryItemWithoutId,
|
||||
HistoryItemToolGroup,
|
||||
SlashCommandProcessorResult,
|
||||
HistoryItemModel,
|
||||
} from '../types.js';
|
||||
import { StreamingState, MessageType, ToolCallStatus } from '../types.js';
|
||||
import { isAtCommand, isSlashCommand } from '../utils/commandUtils.js';
|
||||
@@ -714,6 +715,26 @@ export const useGeminiStream = (
|
||||
[addItem, onCancelSubmit, config],
|
||||
);
|
||||
|
||||
const handleChatModelEvent = useCallback(
|
||||
(eventValue: string, userMessageTimestamp: number) => {
|
||||
if (!settings?.merged?.ui?.showModelInfoInChat) {
|
||||
return;
|
||||
}
|
||||
if (pendingHistoryItemRef.current) {
|
||||
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
|
||||
setPendingHistoryItem(null);
|
||||
}
|
||||
addItem(
|
||||
{
|
||||
type: 'model',
|
||||
model: eventValue,
|
||||
} as HistoryItemModel,
|
||||
userMessageTimestamp,
|
||||
);
|
||||
},
|
||||
[addItem, pendingHistoryItemRef, setPendingHistoryItem, settings],
|
||||
);
|
||||
|
||||
const processGeminiStreamEvents = useCallback(
|
||||
async (
|
||||
stream: AsyncIterable<GeminiEvent>,
|
||||
@@ -768,6 +789,9 @@ export const useGeminiStream = (
|
||||
case ServerGeminiEventType.Citation:
|
||||
handleCitationEvent(event.value, userMessageTimestamp);
|
||||
break;
|
||||
case ServerGeminiEventType.ModelInfo:
|
||||
handleChatModelEvent(event.value, userMessageTimestamp);
|
||||
break;
|
||||
case ServerGeminiEventType.LoopDetected:
|
||||
// handle later because we want to move pending history to history
|
||||
// before we add loop detected message to history
|
||||
@@ -799,9 +823,9 @@ export const useGeminiStream = (
|
||||
handleMaxSessionTurnsEvent,
|
||||
handleContextWindowWillOverflowEvent,
|
||||
handleCitationEvent,
|
||||
handleChatModelEvent,
|
||||
],
|
||||
);
|
||||
|
||||
const submitQuery = useCallback(
|
||||
async (
|
||||
query: PartListUnion,
|
||||
|
||||
Reference in New Issue
Block a user