mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-24 13:01:29 -07:00
Implementing support for recitations events in responses from A2A Server (#12067)
Co-authored-by: Alisa Novikova <alisanovikova@google.com>
This commit is contained in:
@@ -49,6 +49,7 @@ import type {
|
||||
TaskMetadata,
|
||||
Thought,
|
||||
ThoughtSummary,
|
||||
Citation,
|
||||
} from '../types.js';
|
||||
import type { PartUnion, Part as genAiPart } from '@google/genai';
|
||||
|
||||
@@ -638,6 +639,10 @@ export class Task {
|
||||
logger.info('[Task] Sending agent thought...');
|
||||
this._sendThought(event.value, traceId);
|
||||
break;
|
||||
case GeminiEventType.Citation:
|
||||
logger.info('[Task] Received citation from LLM stream.');
|
||||
this._sendCitation(event.value);
|
||||
break;
|
||||
case GeminiEventType.ChatCompressed:
|
||||
break;
|
||||
case GeminiEventType.Finished:
|
||||
@@ -979,4 +984,18 @@ export class Task {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_sendCitation(citation: string) {
|
||||
if (!citation || citation.trim() === '') {
|
||||
return;
|
||||
}
|
||||
logger.info('[Task] Sending citation to event bus.');
|
||||
const message = this._createTextMessage(citation);
|
||||
const citationEvent: Citation = {
|
||||
kind: CoderAgentEvent.CitationEvent,
|
||||
};
|
||||
this.eventBus?.publish(
|
||||
this._createStatusUpdateEvent(this.taskState, citationEvent, message),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user