diff --git a/backend/src/routes/collaborate.js b/backend/src/routes/collaborate.js index 610defe..0299c38 100644 --- a/backend/src/routes/collaborate.js +++ b/backend/src/routes/collaborate.js @@ -198,7 +198,9 @@ router.get('/:id', (req, res) => { /** * GET /api/collaborate/:id/document - * Get the current document + * Get the current/final document + * For active sessions: returns currentDocument + * For completed sessions: returns final_document from DB */ router.get('/:id/document', (req, res) => { try { @@ -210,7 +212,10 @@ router.get('/:id/document', (req, res) => { } const activeSession = collaborativeOrchestrator.activeSessions.get(sessionId) - const currentDocument = activeSession?.currentDocument || '' + // Use final_document for completed sessions, otherwise use activeSession's current + const currentDocument = session.status === 'completed' + ? (session.final_document || '') + : (activeSession?.currentDocument || '') const contentType = session.document_format === 'md' ? 'text/markdown; charset=utf-8' diff --git a/frontend/src/components/CollaborativeInput.vue b/frontend/src/components/CollaborativeInput.vue index fe04a9b..68478a3 100644 --- a/frontend/src/components/CollaborativeInput.vue +++ b/frontend/src/components/CollaborativeInput.vue @@ -13,7 +13,9 @@ const isCreating = ref(false) const previousSessions = ref([]) const loadingPreviousSessions = ref(false) const showAllSessions = ref(false) +const showArchives = ref(false) const sessionStatusFilter = ref('all') // 'all', 'completed', 'ongoing', 'created' +const searchQuery = ref('') onMounted(async () => { loadingPreviousSessions.value = true @@ -46,6 +48,14 @@ const filteredSessions = computed(() => { filtered = filtered.filter(s => s.status === sessionStatusFilter.value) } + if (searchQuery.value.trim()) { + const query = searchQuery.value.toLowerCase() + filtered = filtered.filter(s => + s.prompt.toLowerCase().includes(query) || + s.sessionId.toString().includes(query) + ) + } + return filtered }) @@ -153,6 +163,16 @@ const removeFile = () => { + +
+