MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / createSessionState

Function createSessionState

src/stores/aiChat.ts:280–308  ·  view source on GitHub ↗
(params: EnsureAIChatSessionParams)

Source from the content-addressed store, hash-verified

278}
279
280function createSessionState(params: EnsureAIChatSessionParams): AIChatSessionState {
281 const draftBuffer = createAIChatBuffer(null)
282 return {
283 sessionId: params.sessionId,
284 sessionName: params.sessionName,
285 chatType: params.chatType,
286 locale: params.locale,
287 timeFilter: params.timeFilter,
288 selectedAssistantId: null,
289 messages: draftBuffer.messages,
290 sourceMessages: draftBuffer.sourceMessages,
291 currentKeywords: draftBuffer.currentKeywords,
292 isLoadingSource: false,
293 isAIThinking: false,
294 currentAIChatId: null,
295 currentToolStatus: null,
296 toolsUsedInCurrentRound: [],
297 sessionTokenUsage: createEmptyTokenUsage(),
298 agentStatus: null,
299 ownerInfo: undefined,
300 ownerInfoInitialized: false,
301 isAborted: false,
302 currentRequestId: '',
303 currentAgentRequestId: '',
304 aiChatBuffers: {
305 [DRAFT_AI_CHAT_KEY]: draftBuffer,
306 },
307 }
308}
309
310function getDisplayedBufferKey(state: AIChatSessionState): string {
311 return state.currentAIChatId ?? DRAFT_AI_CHAT_KEY

Callers 1

ensureSessionStateFunction · 0.85

Calls 2

createAIChatBufferFunction · 0.85
createEmptyTokenUsageFunction · 0.85

Tested by

no test coverage detected