diff --git a/layouts/default.vue b/layouts/default.vue
index a1bd75a..a8d45a2 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -54,7 +54,6 @@ const deleteConversation = async (index) => {
deletingConversationIndex.value = null
if (!error.value) {
if (conversations.value[index].id === currentConversation.value.id) {
- console.log('delete current conversation')
createNewConversation()
}
conversations.value.splice(index, 1)
@@ -331,14 +330,14 @@ onMounted(async () => {
>
- {{ currentConversation.topic ?? runtimeConfig.public.appName }}
+ {{ currentConversation.id ? currentConversation.topic : runtimeConfig.public.appName }}
{
const { data, error } = await useAuthFetch('/api/chat/conversations/' + route.params.id)
if (!error.value) {
- conversation.value = data.value
+ conversation.value = Object.assign(conversation.value, data.value)
+ console.log(conversation.value)
}
}
@@ -24,7 +25,6 @@ const loadMessage = async () => {
onActivated(async () => {
console.log('activated')
- console.log(conversation.value)
if (route.params.id) {
conversation.value.loadingMessages = true
await loadConversation()
@@ -33,9 +33,12 @@ onActivated(async () => {
} else {
conversation.value = getDefaultConversationData()
}
- console.log(conversation.value)
currentConversation.value = Object.assign({}, conversation.value)
})
+
+watchEffect(() => {
+ console.log('conversation.value', conversation.value)
+})
diff --git a/utils/helper.js b/utils/helper.js
index 83c511a..0bf2037 100644
--- a/utils/helper.js
+++ b/utils/helper.js
@@ -18,8 +18,6 @@ export const getConversations = async () => {
}
export const createNewConversation = () => {
- const conversation = useConversation()
- conversation.value = getDefaultConversationData()
navigateTo('/')
}