mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 09:17:53 +00:00
rework /resume slash command
This commit is contained in:
@@ -99,6 +99,7 @@ import { processVisionSwitchOutcome } from './hooks/useVisionAutoSwitch.js';
|
||||
import { useSubagentCreateDialog } from './hooks/useSubagentCreateDialog.js';
|
||||
import { useAgentsManagerDialog } from './hooks/useAgentsManagerDialog.js';
|
||||
import { useAttentionNotifications } from './hooks/useAttentionNotifications.js';
|
||||
import { useSessionSelect } from './hooks/useSessionSelect.js';
|
||||
|
||||
const CTRL_EXIT_PROMPT_DURATION_MS = 1000;
|
||||
|
||||
@@ -439,60 +440,13 @@ export const AppContainer = (props: AppContainerProps) => {
|
||||
const { isResumeDialogOpen, openResumeDialog, closeResumeDialog } =
|
||||
useResumeCommand();
|
||||
|
||||
// Handle resume session selection
|
||||
const handleResumeSessionSelect = useCallback(
|
||||
async (sessionId: string) => {
|
||||
if (!config) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Close dialog immediately to prevent input capture during async operations
|
||||
closeResumeDialog();
|
||||
|
||||
const {
|
||||
SessionService,
|
||||
buildApiHistoryFromConversation,
|
||||
replayUiTelemetryFromConversation,
|
||||
uiTelemetryService,
|
||||
} = await import('@qwen-code/qwen-code-core');
|
||||
const { buildResumedHistoryItems } = await import(
|
||||
'./utils/resumeHistoryUtils.js'
|
||||
);
|
||||
|
||||
const cwd = config.getTargetDir();
|
||||
const sessionService = new SessionService(cwd);
|
||||
const sessionData = await sessionService.loadSession(sessionId);
|
||||
|
||||
if (!sessionData) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset and replay UI telemetry to restore metrics
|
||||
uiTelemetryService.reset();
|
||||
replayUiTelemetryFromConversation(sessionData.conversation);
|
||||
|
||||
// Build UI history items using existing utility
|
||||
const uiHistoryItems = buildResumedHistoryItems(sessionData, config);
|
||||
|
||||
// Build API history for the LLM client
|
||||
const clientHistory = buildApiHistoryFromConversation(
|
||||
sessionData.conversation,
|
||||
);
|
||||
|
||||
// Update client history
|
||||
config.getGeminiClient()?.setHistory(clientHistory);
|
||||
config.getGeminiClient()?.stripThoughtsFromHistory();
|
||||
|
||||
// Update session in config
|
||||
config.startNewSession(sessionId);
|
||||
startNewSession(sessionId);
|
||||
|
||||
// Clear and load history
|
||||
historyManager.clearItems();
|
||||
historyManager.loadHistory(uiHistoryItems);
|
||||
},
|
||||
[config, closeResumeDialog, historyManager, startNewSession],
|
||||
);
|
||||
const handleResumeSessionSelect = useSessionSelect({
|
||||
config,
|
||||
historyManager,
|
||||
closeResumeDialog,
|
||||
startNewSession,
|
||||
remount: refreshStatic,
|
||||
});
|
||||
|
||||
const {
|
||||
showWorkspaceMigrationDialog,
|
||||
|
||||
Reference in New Issue
Block a user