mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 22:44:45 -07:00
fix: properly use systemMessage for hooks in UI (#16250)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user