(params: EnsureAIChatSessionParams)
| 278 | } |
| 279 | |
| 280 | function 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 | |
| 310 | function getDisplayedBufferKey(state: AIChatSessionState): string { |
| 311 | return state.currentAIChatId ?? DRAFT_AI_CHAT_KEY |
no test coverage detected