fix: properly use systemMessage for hooks in UI (#16250)

This commit is contained in:
Jack Wotherspoon
2026-01-09 15:47:14 -05:00
committed by GitHub
parent 9d187e041c
commit c7d17dda49
6 changed files with 88 additions and 19 deletions
+6 -4
View File
@@ -794,7 +794,7 @@ export const useGeminiStream = (
);
const handleAgentExecutionStoppedEvent = useCallback(
(reason: string, userMessageTimestamp: number) => {
(reason: string, userMessageTimestamp: number, systemMessage?: string) => {
if (pendingHistoryItemRef.current) {
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
setPendingHistoryItem(null);
@@ -802,7 +802,7 @@ export const useGeminiStream = (
addItem(
{
type: MessageType.INFO,
text: `Agent execution stopped: ${reason}`,
text: `Agent execution stopped: ${systemMessage?.trim() || reason}`,
},
userMessageTimestamp,
);
@@ -812,7 +812,7 @@ export const useGeminiStream = (
);
const handleAgentExecutionBlockedEvent = useCallback(
(reason: string, userMessageTimestamp: number) => {
(reason: string, userMessageTimestamp: number, systemMessage?: string) => {
if (pendingHistoryItemRef.current) {
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
setPendingHistoryItem(null);
@@ -820,7 +820,7 @@ export const useGeminiStream = (
addItem(
{
type: MessageType.WARNING,
text: `Agent execution blocked: ${reason}`,
text: `Agent execution blocked: ${systemMessage?.trim() || reason}`,
},
userMessageTimestamp,
);
@@ -861,12 +861,14 @@ export const useGeminiStream = (
handleAgentExecutionStoppedEvent(
event.value.reason,
userMessageTimestamp,
event.value.systemMessage,
);
break;
case ServerGeminiEventType.AgentExecutionBlocked:
handleAgentExecutionBlockedEvent(
event.value.reason,
userMessageTimestamp,
event.value.systemMessage,
);
break;
case ServerGeminiEventType.ChatCompressed: