feat(llm): redo chat storage, part 1

This commit is contained in:
perf3ct
2025-06-02 00:56:19 +00:00
parent 206905b278
commit 35f78aede9
6 changed files with 142 additions and 104 deletions

View File

@@ -814,10 +814,11 @@ async function streamMessage(req: Request, res: Response) {
throw new Error('Content cannot be empty');
}
// Check if session exists
const session = restChatService.getSessions().get(chatNoteId);
// Get or create session from Chat Note
// This will check the sessions store first, and if not found, create from the Chat Note
const session = await restChatService.getOrCreateSessionFromChatNote(chatNoteId, true);
if (!session) {
throw new Error('Chat not found');
throw new Error('Chat not found and could not be created from note');
}
// Update last active timestamp