mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-15 04:20:57 -07:00
feat: implement trajectory discovery and resumption logic (Stage 2)
This commit is contained in:
@@ -183,9 +183,9 @@ const resumeCheckpointCommand: SlashCommand = {
|
||||
const config = context.services.agentContext?.config;
|
||||
await logger.initialize();
|
||||
const checkpoint = await logger.loadCheckpoint(tag);
|
||||
const conversation = checkpoint.history;
|
||||
const conversation = checkpoint.history ?? [];
|
||||
|
||||
if (conversation.length === 0) {
|
||||
if (conversation.length === 0 && !checkpoint.messages) {
|
||||
return {
|
||||
type: 'message',
|
||||
messageType: 'info',
|
||||
@@ -233,6 +233,8 @@ const resumeCheckpointCommand: SlashCommand = {
|
||||
type: 'load_history',
|
||||
history: uiHistory,
|
||||
clientHistory: conversation,
|
||||
messages: checkpoint.messages,
|
||||
version: checkpoint.version,
|
||||
};
|
||||
},
|
||||
completion: async (context, partialArg) => {
|
||||
|
||||
@@ -549,7 +549,16 @@ export const useSlashCommandProcessor = (
|
||||
}
|
||||
}
|
||||
case 'load_history': {
|
||||
config?.getGeminiClient()?.setHistory(result.clientHistory);
|
||||
const client = config?.getGeminiClient();
|
||||
if (result.version === '2.0' && client) {
|
||||
await client.resumeChat(
|
||||
[...result.clientHistory],
|
||||
undefined,
|
||||
result.messages,
|
||||
);
|
||||
} else {
|
||||
client?.setHistory(result.clientHistory);
|
||||
}
|
||||
fullCommandContext.ui.clear();
|
||||
result.history.forEach((item, index) => {
|
||||
fullCommandContext.ui.addItem(item, index);
|
||||
|
||||
Reference in New Issue
Block a user