diff --git a/main.js b/main.js index 39653d2..a262063 100644 --- a/main.js +++ b/main.js @@ -325,7 +325,9 @@ ${content}`; this.setStatus(""); } async openContextPicker() { - const query = this.inputEl.value.trim() || "Notiz"; + var _a, _b, _c, _d; + const lastUserMsg = (_d = (_c = [...(_b = (_a = this.activeThread) == null ? void 0 : _a.messages) != null ? _b : []].reverse().find((m) => m.role === "user")) == null ? void 0 : _c.content) != null ? _d : ""; + const query = this.inputEl.value.trim() || lastUserMsg; this.setStatus("Suche Notizen\u2026"); try { if (!this.plugin.search.isIndexed()) diff --git a/src/ChatView.ts b/src/ChatView.ts index 61d0417..e9b4fae 100644 --- a/src/ChatView.ts +++ b/src/ChatView.ts @@ -406,8 +406,10 @@ export class ChatView extends ItemView { } private async openContextPicker(): Promise { - // Simple quick switcher-style: search and add to explicit context - const query = this.inputEl.value.trim() || "Notiz"; + const lastUserMsg = [...(this.activeThread?.messages ?? [])] + .reverse() + .find((m) => m.role === "user")?.content ?? ""; + const query = this.inputEl.value.trim() || lastUserMsg; this.setStatus("Suche Notizen…"); try { if (!this.plugin.search.isIndexed()) await this.plugin.search.buildIndex();