mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Make checkpoints configurable in settings.json (#1251)
This commit is contained in:
@@ -135,7 +135,7 @@ describe('useSlashCommandProcessor', () => {
|
||||
getSandbox: vi.fn(() => 'test-sandbox'),
|
||||
getModel: vi.fn(() => 'test-model'),
|
||||
getProjectRoot: vi.fn(() => '/test/dir'),
|
||||
getCheckpointEnabled: vi.fn(() => true),
|
||||
getCheckpointingEnabled: vi.fn(() => true),
|
||||
getBugCommand: vi.fn(() => undefined),
|
||||
} as unknown as Config;
|
||||
mockCorgiMode = vi.fn();
|
||||
|
||||
@@ -647,7 +647,7 @@ Add any other context about the problem here.
|
||||
description:
|
||||
'resume from conversation checkpoint. Usage: /resume [tag]',
|
||||
completion: async () => {
|
||||
const geminiDir = config?.getGeminiDir();
|
||||
const geminiDir = config?.getProjectTempDir();
|
||||
if (!geminiDir) {
|
||||
return [];
|
||||
}
|
||||
@@ -805,14 +805,14 @@ Add any other context about the problem here.
|
||||
},
|
||||
];
|
||||
|
||||
if (config?.getCheckpointEnabled()) {
|
||||
if (config?.getCheckpointingEnabled()) {
|
||||
commands.push({
|
||||
name: 'restore',
|
||||
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',
|
||||
action: async (_mainCommand, subCommand, _args) => {
|
||||
const checkpointDir = config?.getGeminiDir()
|
||||
? path.join(config.getGeminiDir(), 'checkpoints')
|
||||
const checkpointDir = config?.getProjectTempDir()
|
||||
? path.join(config.getProjectTempDir(), 'checkpoints')
|
||||
: undefined;
|
||||
|
||||
if (!checkpointDir) {
|
||||
|
||||
@@ -280,7 +280,7 @@ describe('useGeminiStream', () => {
|
||||
() => ({ getToolSchemaList: vi.fn(() => []) }) as any,
|
||||
),
|
||||
getProjectRoot: vi.fn(() => '/test/dir'),
|
||||
getCheckpointEnabled: vi.fn(() => false),
|
||||
getCheckpointingEnabled: vi.fn(() => false),
|
||||
getGeminiClient: mockGetGeminiClient,
|
||||
addHistory: vi.fn(),
|
||||
} as unknown as Config;
|
||||
|
||||
@@ -638,7 +638,7 @@ export const useGeminiStream = (
|
||||
|
||||
useEffect(() => {
|
||||
const saveRestorableToolCalls = async () => {
|
||||
if (!config.getCheckpointEnabled()) {
|
||||
if (!config.getCheckpointingEnabled()) {
|
||||
return;
|
||||
}
|
||||
const restorableToolCalls = toolCalls.filter(
|
||||
@@ -649,8 +649,8 @@ export const useGeminiStream = (
|
||||
);
|
||||
|
||||
if (restorableToolCalls.length > 0) {
|
||||
const checkpointDir = config.getGeminiDir()
|
||||
? path.join(config.getGeminiDir(), 'checkpoints')
|
||||
const checkpointDir = config.getProjectTempDir()
|
||||
? path.join(config.getProjectTempDir(), 'checkpoints')
|
||||
: undefined;
|
||||
|
||||
if (!checkpointDir) {
|
||||
|
||||
Reference in New Issue
Block a user