Phase 5: Multi-user authentication with session cookies, bcrypt passwords, first-user-is-admin pattern, per-user data isolation, backup/restore, Docker Swarm production stack with secrets and network isolation. Phase 5.1: Chat UX improvements: - Background generation architecture (GenerationBuffer + asyncio task) with SSE fan-out, reconnect support, and periodic DB flushes - LLM-generated conversation titles (first exchange + every 10th message) - Stop generation button with cancel_event and partial content preservation - Relative timestamps in sidebar (5m ago, 3h ago, then dates) - Empty chat auto-cleanup on navigation away - Save-as-note uses LLM for title generation, tags notes with "chat" - Summarize-as-note also tags with "chat" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
81 lines
1.8 KiB
Vue
81 lines
1.8 KiB
Vue
<script setup lang="ts">
|
|
import { ref, computed, onMounted, onUnmounted, watch } from "vue";
|
|
import { useRoute } from "vue-router";
|
|
import AppHeader from "@/components/AppHeader.vue";
|
|
import ChatPanel from "@/components/ChatPanel.vue";
|
|
import ToastNotification from "@/components/ToastNotification.vue";
|
|
import { useTheme } from "@/composables/useTheme";
|
|
import { useAuthStore } from "@/stores/auth";
|
|
import { useChatStore } from "@/stores/chat";
|
|
import { useSettingsStore } from "@/stores/settings";
|
|
|
|
useTheme();
|
|
|
|
const route = useRoute();
|
|
const authStore = useAuthStore();
|
|
const chatStore = useChatStore();
|
|
const settingsStore = useSettingsStore();
|
|
const chatPanelOpen = ref(false);
|
|
|
|
const contextNoteId = computed(() => {
|
|
const id = route.params.id;
|
|
if (!id) return null;
|
|
const path = route.path;
|
|
if (path.startsWith("/notes/") || path.startsWith("/tasks/")) {
|
|
return Number(id);
|
|
}
|
|
return null;
|
|
});
|
|
|
|
function toggleChatPanel() {
|
|
chatPanelOpen.value = !chatPanelOpen.value;
|
|
}
|
|
|
|
function startAppServices() {
|
|
chatStore.startStatusPolling();
|
|
settingsStore.fetchSettings();
|
|
}
|
|
|
|
function stopAppServices() {
|
|
chatStore.stopStatusPolling();
|
|
}
|
|
|
|
onMounted(async () => {
|
|
await authStore.checkAuth();
|
|
if (authStore.isAuthenticated) {
|
|
startAppServices();
|
|
}
|
|
});
|
|
|
|
watch(
|
|
() => authStore.isAuthenticated,
|
|
(authenticated) => {
|
|
if (authenticated) {
|
|
startAppServices();
|
|
} else {
|
|
stopAppServices();
|
|
}
|
|
}
|
|
);
|
|
|
|
onUnmounted(() => {
|
|
stopAppServices();
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<template v-if="authStore.isAuthenticated">
|
|
<AppHeader @toggle-chat-panel="toggleChatPanel" />
|
|
<router-view />
|
|
<ChatPanel
|
|
v-if="chatPanelOpen"
|
|
:context-note-id="contextNoteId"
|
|
@close="chatPanelOpen = false"
|
|
/>
|
|
</template>
|
|
<template v-else>
|
|
<router-view />
|
|
</template>
|
|
<ToastNotification />
|
|
</template>
|