diff --git a/custom/ChatSurface.vue b/custom/ChatSurface.vue index b745f94..9ba21eb 100644 --- a/custom/ChatSurface.vue +++ b/custom/ChatSurface.vue @@ -179,7 +179,7 @@ import { IconChatBubbleLeft20Solid, IconSparklesSolid, IconArrowsPointingOut, Ic import { IconCloseOutline, IconBarsOutline, IconArrowUpOutline, IconCloseSidebarSolid, IconOpenSidebarSolid, IconAngleDownOutline } from '@iconify-prerendered/vue-flowbite'; import { useTemplateRef, onMounted, ref,computed } from 'vue'; import { onClickOutside } from '@vueuse/core' -import ConversationArea from './ConversationArea.vue'; +import ConversationArea from './conversation_area/ConversationArea.vue'; import { useAgentStore } from './composables/useAgentStore'; import { useAgentTransitions } from './composables/useAgentTransitions'; import { Button } from '@/afcl'; @@ -246,7 +246,7 @@ onMounted(async () => { agentStore.setAvailableModes(props.meta.modes, props.meta.defaultModeName); agentStore.regisrerTextInput(textInput.value); textInput.value?.focus(); - const isTeleportedToBodyFromLocalStorage = agentStore.getLocalStorageItem('isTeleportedToBody') === 'true'; + const isTeleportedToBodyFromLocalStorage = agentStore.getLocalStorageItem('isTeleportedToBody') === 'true' || agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true'; if( coreStore.isMobile ) { agentStore.setIsTeleportedToBody(false); } else { diff --git a/custom/ConversationArea.vue b/custom/ConversationArea.vue deleted file mode 100644 index 9de6619..0000000 --- a/custom/ConversationArea.vue +++ /dev/null @@ -1,198 +0,0 @@ - - - - \ No newline at end of file diff --git a/custom/CustomAutoScrollContainer.vue b/custom/CustomAutoScrollContainer.vue new file mode 100644 index 0000000..7d31f81 --- /dev/null +++ b/custom/CustomAutoScrollContainer.vue @@ -0,0 +1,127 @@ + + + \ No newline at end of file diff --git a/custom/ToolsGroup.vue b/custom/ToolsGroup.vue deleted file mode 100644 index fb21847..0000000 --- a/custom/ToolsGroup.vue +++ /dev/null @@ -1,67 +0,0 @@ - - - - - \ No newline at end of file diff --git a/custom/composables/useAgentStore.ts b/custom/composables/useAgentStore.ts index ee097b2..5d29b15 100644 --- a/custom/composables/useAgentStore.ts +++ b/custom/composables/useAgentStore.ts @@ -1,5 +1,5 @@ import { defineStore } from 'pinia'; -import { IAgentSession, ISessionsListItem, IMessage } from '../types'; +import { IAgentSession, ISessionsListItem, IMessage, IPart } from '../types'; import { ref, nextTick, computed, watch, onMounted, shallowRef } from 'vue'; import { callAdminForthApi } from '@/utils'; import { useAdminforth } from '@/adminforth'; @@ -93,7 +93,9 @@ export const useAgentStore = defineStore('agent', () => { }) onMounted(() => { const chatWidthBeforeFullScreen = parseInt(getLocalStorageItem('chatWidthBeforeFullScreen') || '0', 10); - if (chatWidthBeforeFullScreen) { + if (chatWidthBeforeFullScreen && (chatWidthBeforeFullScreen > MAX_WIDTH || chatWidthBeforeFullScreen < MIN_WIDTH)) { + setChatWidth(remToPx(DEFAULT_CHAT_WIDTH)); + } else if (chatWidthBeforeFullScreen) { setChatWidth(remToPx(chatWidthBeforeFullScreen)); } else { const savedChatWidth = parseInt(getLocalStorageItem('chatWidth') || '0', 10); @@ -105,7 +107,7 @@ export const useAgentStore = defineStore('agent', () => { } } } - isTeleportedToBody.value = getLocalStorageItem('isTeleportedToBody') === 'true'; + setIsTeleportedToBody(getLocalStorageItem('isTeleportedToBody') === 'true' || getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true'); lastSessionId.value = getLocalStorageItem('lastSessionId'); if (lastSessionId.value && lastSessionId.value !== 'pre-session') { setActiveSession(lastSessionId.value); @@ -510,7 +512,7 @@ export const useAgentStore = defineStore('agent', () => { if (currentSession.value) { currentSession.value.messages = currentChat.value?.messages.map((m: any) => ({ role: m.role, - text: m.parts.map((p: any) => p.text).join(' '), + text: m.parts.map((p: IPart) => p.type === 'text' ? p.text : '').join(''), })) || []; sessions.value[currentSession.value.sessionId] = currentSession.value; } @@ -522,8 +524,10 @@ export const useAgentStore = defineStore('agent', () => { if (!sessions.value[sessionId]) { await fetchSession(sessionId); } + console.log('Set active session from sessions', sessionId, sessions.value[sessionId]); currentSession.value = sessions.value[sessionId]; setCurrentChat(sessionId); + console.log('Set active session chat', sessionId, currentSession.value); currentChat.value.messages = currentSession.value?.messages.map((m: any) => ({ role: m.role, parts:[{ diff --git a/custom/conversation_area/ConversationArea.vue b/custom/conversation_area/ConversationArea.vue new file mode 100644 index 0000000..c1f6811 --- /dev/null +++ b/custom/conversation_area/ConversationArea.vue @@ -0,0 +1,109 @@ + + + + \ No newline at end of file diff --git a/custom/conversation_area/MessageRenderer.vue b/custom/conversation_area/MessageRenderer.vue new file mode 100644 index 0000000..c4bbb73 --- /dev/null +++ b/custom/conversation_area/MessageRenderer.vue @@ -0,0 +1,33 @@ + + + + + + \ No newline at end of file diff --git a/custom/conversation_area/ProcessingTimeline.vue b/custom/conversation_area/ProcessingTimeline.vue new file mode 100644 index 0000000..56e4409 --- /dev/null +++ b/custom/conversation_area/ProcessingTimeline.vue @@ -0,0 +1,190 @@ + + + + + + + \ No newline at end of file diff --git a/custom/conversation_area/ReasoningRenderer.vue b/custom/conversation_area/ReasoningRenderer.vue new file mode 100644 index 0000000..36278a1 --- /dev/null +++ b/custom/conversation_area/ReasoningRenderer.vue @@ -0,0 +1,87 @@ + + + + + + + + \ No newline at end of file diff --git a/custom/Message.vue b/custom/conversation_area/TextRenderer.vue similarity index 57% rename from custom/Message.vue rename to custom/conversation_area/TextRenderer.vue index fdb59e0..d44b236 100644 --- a/custom/Message.vue +++ b/custom/conversation_area/TextRenderer.vue @@ -1,52 +1,21 @@