MCPcopy Index your code
hub / github.com/continuedev/continue / loadAndSetSession

Function loadAndSetSession

extensions/cli/src/ui/TUIChat.tsx:50–84  ·  view source on GitHub ↗
(
  sessionId: string,
  closeCurrentScreen: () => void,
  setChatHistory: (history: any) => void,
  setShowIntroMessage: (show: boolean) => void,
)

Source from the content-addressed store, hash-verified

48
49// Helper function to load and set session
50async function loadAndSetSession(
51 sessionId: string,
52 closeCurrentScreen: () => void,
53 setChatHistory: (history: any) => void,
54 setShowIntroMessage: (show: boolean) => void,
55) {
56 try {
57 // Close the session selector
58 closeCurrentScreen();
59
60 // Import session functions
61 const { loadSessionById } = await import("../session.js");
62
63 // Load the session
64 const session = loadSessionById(sessionId);
65 if (!session) {
66 logger.error(`Session ${sessionId} could not be loaded.`);
67 return;
68 }
69
70 // Set the session ID so future operations use this session
71 process.env.CONTINUE_CLI_TEST_SESSION_ID = sessionId.replace(
72 "continue-cli-",
73 "",
74 );
75
76 // Set the chat history from the session
77 setChatHistory(session.history);
78
79 // Clear the intro message since we're now showing a resumed session
80 setShowIntroMessage(false);
81 } catch (error) {
82 console.error("Error loading session:", error);
83 }
84}
85
86// Custom hook to manage services
87function useTUIChatServices(remoteUrl?: string) {

Callers 1

TUIChatFunction · 0.85

Calls 4

loadSessionByIdFunction · 0.85
setChatHistoryFunction · 0.85
errorMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected