feat(frontend): update chat composables and vite config
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ref, toRef } from 'vue'
|
||||
import {
|
||||
ChevronRight,
|
||||
Send,
|
||||
@@ -25,7 +25,7 @@ import { useChatView } from '@/pages/chat/composables/useChatView'
|
||||
import { useKnowledgeView } from '@/pages/knowledge/composables/useKnowledgeView'
|
||||
import { useDailyDigest } from '@/pages/chat/composables/useDailyDigest'
|
||||
import { useClientTime, formatNetworkRate } from '@/pages/chat/composables/useClientTime'
|
||||
import { useSidebarPlan } from '@/pages/chat/composables/useSidebarPlan'
|
||||
import { useSidebarPlan, formatDateKey } from '@/pages/chat/composables/useSidebarPlan'
|
||||
|
||||
// --- Chat view (core messaging logic) ---
|
||||
const {
|
||||
@@ -79,7 +79,7 @@ const {
|
||||
sidebarFocusItems, sidebarReviewAchievements, sidebarReviewReflections,
|
||||
sidebarFeedItems, topbarFeedItems, sidebarCollapsedModules,
|
||||
selectedDate, selectCalendarDate
|
||||
} = useSidebarPlan(clientTime, loadDailyDigest, store.conversations)
|
||||
} = useSidebarPlan(clientTime, loadDailyDigest, toRef(store, 'conversations'))
|
||||
|
||||
// --- Local UI state ---
|
||||
const sidebarCollapsed = ref(false)
|
||||
@@ -118,27 +118,16 @@ function handleOpenPreview(doc: any) { previewDoc.value = doc }
|
||||
function handleCalendarDateSelect(dateKey: string) {
|
||||
selectCalendarDate(dateKey)
|
||||
|
||||
// Reload conversations to get latest data
|
||||
loadConversations().then(() => {
|
||||
// Find conversation that matches the selected date (by updated_at)
|
||||
// Use UTC to avoid timezone issues
|
||||
const [year, month, day] = dateKey.split('-').map(Number)
|
||||
const targetDateStart = new Date(Date.UTC(year, month - 1, day))
|
||||
const targetDateEnd = new Date(Date.UTC(year, month - 1, day + 1))
|
||||
|
||||
// Find conversation that falls on the selected date
|
||||
const conversations = store.conversations.value ?? store.conversations
|
||||
const conversation = conversations.find((conv) => {
|
||||
const convDate = new Date(conv.updated_at)
|
||||
return convDate >= targetDateStart && convDate < targetDateEnd
|
||||
})
|
||||
const conversations = store.conversations
|
||||
const conversation = conversations.find((conv: { id: string; updated_at: string }) => formatDateKey(new Date(conv.updated_at)) === dateKey)
|
||||
|
||||
if (conversation) {
|
||||
selectConversation(conversation.id)
|
||||
} else {
|
||||
// No conversation for this date, create a new one
|
||||
newConversation()
|
||||
return
|
||||
}
|
||||
|
||||
newConversation()
|
||||
}).catch((err) => {
|
||||
console.error('[Calendar] Error loading conversations:', err)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user