@@ -4,7 +4,7 @@ import { ref, nextTick, computed, watch, onMounted, shallowRef } from 'vue';
44import { callAdminForthApi } from '@/utils' ;
55import { useAdminforth } from '@/adminforth' ;
66import { Chat } from './chat' ;
7- import { DefaultChatTransport } from 'ai' ;
7+ import { cosineSimilarity , DefaultChatTransport } from 'ai' ;
88import { useCoreStore } from '@/stores/core' ;
99
1010export const useAgentStore = defineStore ( 'agent' , ( ) => {
@@ -70,10 +70,24 @@ export const useAgentStore = defineStore('agent', () => {
7070 } ) ;
7171 }
7272 } )
73- function setChatWidth ( width : number ) {
73+ const isFullScreen = ref ( false ) ;
74+ function setFullScreen ( fullScreen : boolean ) {
75+ isFullScreen . value = fullScreen ;
76+ console . log ( 'setFullScreen' , fullScreen ) ;
77+ if ( fullScreen ) {
78+ setChatWidth ( window . innerWidth , true ) ;
79+ } else {
80+ console . log ( 'setChatWidth to default' ) ;
81+ chatWidth . value = 600 ;
82+ }
83+ }
84+
85+ function setChatWidth ( width : number , blockTransition = false ) {
7486 if ( appRoot . value && header . value ) {
75- appRoot . value . style . transition = '' ;
76- header . value . style . transition = '' ;
87+ if ( blockTransition ) {
88+ appRoot . value . style . transition = '' ;
89+ header . value . style . transition = '' ;
90+ }
7791 }
7892 chatWidth . value = width ;
7993
@@ -188,14 +202,14 @@ export const useAgentStore = defineStore('agent', () => {
188202 //create a pre-session, until user will type something, so we can save session
189203 async function createPreSession ( ) {
190204 saveCurrentSessionInCache ( ) ;
191- if ( sessionList . value . some ( ( s : ISessionsListItem ) => s . sessionId === 'pre-session' ) ) {
192- return ;
205+ if ( ! sessionList . value . some ( ( s : ISessionsListItem ) => s . sessionId === 'pre-session' ) ) {
206+ sessionList . value . unshift ( {
207+ sessionId : 'pre-session' ,
208+ title : 'New Session' ,
209+ timestamp : new Date ( ) . toISOString ( ) ,
210+ } ) ;
193211 }
194- sessionList . value . unshift ( {
195- sessionId : 'pre-session' ,
196- title : 'New Session' ,
197- timestamp : new Date ( ) . toISOString ( ) ,
198- } )
212+
199213 activeSessionId . value = 'pre-session' ;
200214 currentSession . value = {
201215 sessionId : 'pre-session' ,
@@ -368,6 +382,8 @@ export const useAgentStore = defineStore('agent', () => {
368382 setIsTeleportedToBody,
369383 chatWidth,
370384 setChatWidth,
371- focusTextInput
385+ focusTextInput,
386+ setFullScreen,
387+ isFullScreen
372388 }
373389} )
0 commit comments