Make note picker add notes to persistent context instead of one-shot

Previously the paperclip button created a one-shot attachment that was
only included for the single message it was sent with, then discarded.
Now selecting a note via the picker calls includeNote() directly, so it
appears in the "In Context" sidebar and stays for the entire conversation
— consistent with clicking "+" on a suggested note.

Removed attachedNote ref, removeAttachedNote(), the pinned-note sidebar
block, and the contextNoteId/contextNoteTitle sendMessage arguments that
are no longer needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 18:53:41 -05:00
parent 4998d04739
commit 5c84c28a67
+4 -30
View File
@@ -27,7 +27,6 @@ const showResearchModal = ref(false);
const researchTopic = ref("");
// Note picker state
const attachedNote = ref<{ id: number; title: string } | null>(null);
const showNotePicker = ref(false);
const noteSearchQuery = ref("");
const noteSearchResults = ref<{ id: number; title: string }[]>([]);
@@ -99,7 +98,6 @@ watch(convId, async (newId) => {
includedNoteIds.value = new Set();
includedNotes.value = [];
suggestedNotes.value = [];
attachedNote.value = null;
store.lastContextMeta = null;
if (newId) {
// Skip re-fetch if this conversation is already loaded (avoids race
@@ -175,19 +173,15 @@ async function sendMessage() {
}
sending.value = true;
const contextNoteId = attachedNote.value?.id ?? undefined;
const contextNoteTitle = attachedNote.value?.title ?? undefined;
attachedNote.value = null;
messageInput.value = "";
resetTextareaHeight();
scrollToBottom();
await store.sendMessage(
content,
contextNoteId,
undefined,
includedNoteIds.value.size ? [...includedNoteIds.value] : undefined,
true, // enable thinking in the full chat view
contextNoteTitle,
);
sending.value = false;
@@ -300,14 +294,10 @@ function onNoteSearchInput() {
}
function selectNote(note: { id: number; title: string }) {
attachedNote.value = note;
includeNote(note);
showNotePicker.value = false;
}
function removeAttachedNote() {
attachedNote.value = null;
}
function includeNote(note: { id: number; title: string }) {
if (includedNoteIds.value.has(note.id)) return;
includedNoteIds.value = new Set([...includedNoteIds.value, note.id]);
@@ -471,20 +461,11 @@ onUnmounted(() => {
</div>
<!-- Context sidebar -->
<aside v-if="includedNotes.length || suggestedNotes.length || attachedNote" class="context-sidebar">
<aside v-if="includedNotes.length || suggestedNotes.length" class="context-sidebar">
<!-- IN CONTEXT section -->
<template v-if="attachedNote || includedNotes.length">
<template v-if="includedNotes.length">
<div class="context-sidebar-header">In Context</div>
<!-- Manually attached note pinned until sent -->
<div v-if="attachedNote" class="context-note context-note-pinned">
<span class="context-note-icon" title="Attached for this message">📌</span>
<router-link :to="`/notes/${attachedNote.id}`" class="context-note-name">
{{ attachedNote.title }}
</router-link>
<button class="context-note-remove" @click="removeAttachedNote" title="Remove">&times;</button>
</div>
<!-- Explicitly included notes -->
<div v-for="note in includedNotes" :key="note.id" class="context-note context-note-included">
<router-link :to="`/notes/${note.id}`" class="context-note-name">
@@ -805,13 +786,6 @@ onUnmounted(() => {
border: 1px solid var(--color-border);
font-size: 0.82rem;
}
.context-note-pinned {
border-color: var(--color-primary);
}
.context-note-icon {
font-size: 0.75rem;
flex-shrink: 0;
}
.context-note-name {
flex: 1;
min-width: 0;