Skip to content

Build your personal knowledge base with Trilium Notes

see if this doesn't upset the machine?

perf3ct6f98e724a8ee
diff --git a/src/public/app/widgets/llm_chat/llm_chat_panel.ts b/src/public/app/widgets/llm_chat/llm_chat_panel.ts
index 0f5b189197..b10bbe1575 100644
--- a/src/public/app/widgets/llm_chat/llm_chat_panel.ts
+++ b/src/public/app/widgets/llm_chat/llm_chat_panel.ts
@@ -576,15 +576,17 @@ export default class LlmChatPanel extends BasicWidget {
}
} else {
// Verify the session exists on the server
- try {
- const sessionExists = await checkSessionExists(this.sessionId);
- if (!sessionExists) {
- console.log(`Session ${this.sessionId} not found, creating a new one`);
- await this.createChatSession();
- }
- } catch (error) {
- console.log(`Error checking session ${this.sessionId}, creating a new one`);
+ const sessionExists = await checkSessionExists(this.sessionId);
+ if (!sessionExists) {
+ console.log(`Session ${this.sessionId} not found, creating a new one`);
await this.createChatSession();
+
+ if (!this.sessionId) {
+ // If still no session ID after attempted creation, show error and return
+ console.error("Failed to create chat session after session not found");
+ toastService.showError("Failed to create chat session");
+ return;
+ }
}
}