Skip to content

Build your personal knowledge base with Trilium Notes

fix AiChatButton

perf3cta05013c8f43f
diff --git a/src/public/app/components/root_command_executor.ts b/src/public/app/components/root_command_executor.ts
index b4e6ed3c0e..1e16fae81e 100644
--- a/src/public/app/components/root_command_executor.ts
+++ b/src/public/app/components/root_command_executor.ts
@@ -232,15 +232,10 @@ export default class RootCommandExecutor extends Component {
async createAiChatCommand() {
try {
- // Create a new AI Chat note
- const parentNoteId = appContext.tabManager.getActiveContextNotePath();
+ // Create a new AI Chat note at the root level
+ const rootNoteId = "root";
- if (!parentNoteId) {
- toastService.showError("No active note to create AI Chat under");
- return;
- }
-
- const result = await noteCreateService.createNote(parentNoteId, {
+ const result = await noteCreateService.createNote(rootNoteId, {
title: "New AI Chat",
type: "aiChat",
content: JSON.stringify({