mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 19:14:33 -07:00
feat(cli): overhaul thinking UI (#18725)
This commit is contained in:
@@ -51,15 +51,24 @@ export function convertSessionToClientHistory(
|
||||
parts: ensurePartArray(msg.content),
|
||||
});
|
||||
} else if (msg.type === 'gemini') {
|
||||
const modelParts: Part[] = [];
|
||||
|
||||
// Add thoughts if present
|
||||
if (msg.thoughts && msg.thoughts.length > 0) {
|
||||
for (const thought of msg.thoughts) {
|
||||
const thoughtText = thought.subject
|
||||
? `**${thought.subject}** ${thought.description}`
|
||||
: thought.description;
|
||||
modelParts.push({
|
||||
text: thoughtText,
|
||||
thought: true,
|
||||
} as Part);
|
||||
}
|
||||
}
|
||||
|
||||
const hasToolCalls = msg.toolCalls && msg.toolCalls.length > 0;
|
||||
|
||||
if (hasToolCalls) {
|
||||
const modelParts: Part[] = [];
|
||||
|
||||
// TODO: Revisit if we should preserve more than just Part metadata (e.g. thoughtSignatures)
|
||||
// currently those are only required within an active loop turn which resume clears
|
||||
// by forcing a new user text prompt.
|
||||
|
||||
// Preserve original parts to maintain multimodal integrity
|
||||
if (msg.content) {
|
||||
modelParts.push(...ensurePartArray(msg.content));
|
||||
@@ -114,14 +123,14 @@ export function convertSessionToClientHistory(
|
||||
}
|
||||
} else {
|
||||
if (msg.content) {
|
||||
const parts = ensurePartArray(msg.content);
|
||||
modelParts.push(...ensurePartArray(msg.content));
|
||||
}
|
||||
|
||||
if (parts.length > 0) {
|
||||
clientHistory.push({
|
||||
role: 'model',
|
||||
parts,
|
||||
});
|
||||
}
|
||||
if (modelParts.length > 0) {
|
||||
clientHistory.push({
|
||||
role: 'model',
|
||||
parts: modelParts,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user