mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Support autocompletion for checkpoints (#1253)
This commit is contained in:
@@ -810,6 +810,22 @@ Add any other context about the problem here.
|
|||||||
name: 'restore',
|
name: 'restore',
|
||||||
description:
|
description:
|
||||||
'restore a tool call. This will reset the conversation and file history to the state it was in when the tool call was suggested',
|
'restore a tool call. This will reset the conversation and file history to the state it was in when the tool call was suggested',
|
||||||
|
completion: async () => {
|
||||||
|
const checkpointDir = config?.getProjectTempDir()
|
||||||
|
? path.join(config.getProjectTempDir(), 'checkpoints')
|
||||||
|
: undefined;
|
||||||
|
if (!checkpointDir) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const files = await fs.readdir(checkpointDir);
|
||||||
|
return files
|
||||||
|
.filter((file) => file.endsWith('.json'))
|
||||||
|
.map((file) => file.replace('.json', ''));
|
||||||
|
} catch (_err) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
action: async (_mainCommand, subCommand, _args) => {
|
action: async (_mainCommand, subCommand, _args) => {
|
||||||
const checkpointDir = config?.getProjectTempDir()
|
const checkpointDir = config?.getProjectTempDir()
|
||||||
? path.join(config.getProjectTempDir(), 'checkpoints')
|
? path.join(config.getProjectTempDir(), 'checkpoints')
|
||||||
|
|||||||
Reference in New Issue
Block a user