diff --git a/frontend/src/components/CollaborativeInput.vue b/frontend/src/components/CollaborativeInput.vue
index aeb48ba..6ec191c 100644
--- a/frontend/src/components/CollaborativeInput.vue
+++ b/frontend/src/components/CollaborativeInput.vue
@@ -10,24 +10,22 @@ const prompt = ref('')
const contextFile = ref(null)
const agentCount = ref(7)
const aiProvider = ref('mistral')
+const documentFormat = ref('md')
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('')
+const isFetchingSessions = ref(false)
onMounted(async () => {
- loadingPreviousSessions.value = true
+ if (collaborationStore.sessionsLoaded.value) return
+ isFetchingSessions.value = true
try {
- const response = await fetch('/api/collaborate')
- const data = await response.json()
- previousSessions.value = data.sessions || []
+ await collaborationStore.fetchSessions()
} catch (error) {
console.error('Error loading previous sessions:', error)
} finally {
- loadingPreviousSessions.value = false
+ isFetchingSessions.value = false
}
})
@@ -35,6 +33,8 @@ const handleOpenSession = (sessionId) => {
emit('session-created', { sessionId })
}
+const sessions = computed(() => collaborationStore.sessions.value)
+
const agentOptions = computed(() => {
return Array.from({ length: 48 }, (_, i) => ({
value: i + 3,
@@ -43,7 +43,7 @@ const agentOptions = computed(() => {
})
const filteredSessions = computed(() => {
- let filtered = previousSessions.value
+ let filtered = sessions.value
if (sessionStatusFilter.value !== 'all') {
filtered = filtered.filter(s => s.status === sessionStatusFilter.value)
@@ -65,11 +65,11 @@ const displayedSessions = computed(() => {
})
const completedCount = computed(() => {
- return previousSessions.value.filter(s => s.status === 'completed').length
+ return sessions.value.filter(s => s.status === 'completed').length
})
const ongoingCount = computed(() => {
- return previousSessions.value.filter(s => s.status === 'ongoing').length
+ return sessions.value.filter(s => s.status === 'ongoing').length
})
const handleFileSelect = (event) => {
@@ -108,7 +108,7 @@ const handleCreateSession = async () => {
// Always use 'md' format for output
const session = await collaborationStore.createSession(
finalPrompt,
- 'md',
+ documentFormat.value,
agentCount.value,
aiProvider.value
)
@@ -120,6 +120,7 @@ const handleCreateSession = async () => {
contextFile.value = null
agentCount.value = 7
aiProvider.value = 'mistral'
+ documentFormat.value = 'md'
} catch (error) {
alert(`Error creating session: ${collaborationStore.error}`)
} finally {
@@ -150,7 +151,11 @@ const removeFile = () => {
-
+
+ Loading previous sessions...
+
+
+
Completed
@@ -162,7 +167,7 @@ const removeFile = () => {
Total
- {{ previousSessions.length }}
+ {{ sessions.length }}
@@ -183,7 +188,7 @@ const removeFile = () => {
class="filter-btn"
:class="{ active: sessionStatusFilter === 'all' }"
>
- All Sessions ({{ previousSessions.length }})
+ All Sessions ({{ sessions.length }})
-
+
Or start a new session
@@ -312,6 +317,14 @@ const removeFile = () => {
Choose the AI model for specialists.
+
@@ -624,6 +637,17 @@ const removeFile = () => {
cursor: not-allowed;
}
+.loading-sessions {
+ margin-bottom: 2rem;
+ padding: 1rem;
+ text-align: center;
+ color: rgba(255, 255, 255, 0.7);
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ border-radius: 12px;
+ backdrop-filter: blur(8px);
+}
+
.file-input-wrapper {
position: relative;
margin-bottom: 1rem;
diff --git a/frontend/src/components/CollaborativeSession.vue b/frontend/src/components/CollaborativeSession.vue
index dfbf349..a2c8126 100644
--- a/frontend/src/components/CollaborativeSession.vue
+++ b/frontend/src/components/CollaborativeSession.vue
@@ -80,11 +80,19 @@ const handleWebSocketMessage = (message) => {
if (message.type === 'initial_document_created') {
sessionStarted.value = true
collaborationStore.currentDocument = message.content
+ collaborationStore.currentRound = 0
+ if (collaborationStore.currentSession) {
+ collaborationStore.currentSession.status = 'ongoing'
+ collaborationStore.currentSession.currentDocument = message.content
+ }
currentWorkingAgent.value = null
currentAgentThinking.value = ''
scheduleNextRound(2000)
} else if (message.type === 'document_modified') {
collaborationStore.currentDocument = message.content
+ if (collaborationStore.currentSession) {
+ collaborationStore.currentSession.currentDocument = message.content
+ }
} else if (message.type === 'agent_working') {
currentWorkingAgent.value = message.agentName
currentAgentThinking.value = ''
@@ -92,11 +100,17 @@ const handleWebSocketMessage = (message) => {
currentAgentThinking.value = message.thinking || ''
} else if (message.type === 'round_complete') {
isRunningRound.value = false
- collaborationStore.conversationHistory.push({
+ const roundEntry = {
roundNumber: message.roundNumber,
agentsMadeChanges: message.agentsMadeChanges,
timestamp: Date.now()
- })
+ }
+ collaborationStore.conversationHistory.push(roundEntry)
+ if (collaborationStore.currentSession) {
+ const history = collaborationStore.currentSession.conversationHistory || []
+ collaborationStore.currentSession.conversationHistory = [...history, roundEntry]
+ }
+ collaborationStore.currentRound = message.roundNumber
currentWorkingAgent.value = null
currentAgentThinking.value = ''
@@ -116,6 +130,9 @@ const handleWebSocketMessage = (message) => {
} else if (message.type === 'session_completed') {
currentWorkingAgent.value = null
isAutoRunning.value = false
+ if (collaborationStore.currentSession) {
+ collaborationStore.currentSession.status = 'completed'
+ }
}
}
@@ -237,6 +254,10 @@ function formatAgentName(agent) {
✋
{{ formatAgentName(currentWorkingAgent) }}
+
+ {{ currentAgentThinking }}
+ Analyzing the document...
+
@@ -461,6 +482,16 @@ function formatAgentName(agent) {
font-weight: 600;
}
+.agent-thinking {
+ flex: 1;
+ font-size: 0.95rem;
+ color: rgba(255, 255, 255, 0.75);
+ background: rgba(102, 126, 234, 0.08);
+ border-radius: 12px;
+ padding: 0.75rem 1rem;
+ line-height: 1.4;
+}
+
.convergence-message {
display: flex;
align-items: center;
diff --git a/frontend/src/components/DocumentViewer.vue b/frontend/src/components/DocumentViewer.vue
index 92284b5..631105d 100644
--- a/frontend/src/components/DocumentViewer.vue
+++ b/frontend/src/components/DocumentViewer.vue
@@ -1,7 +1,8 @@