@adminforth/agent 1.33.1 → 1.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.log +2 -2
- package/custom/ChatSurface.vue +9 -18
- package/custom/SessionsHistory.vue +0 -6
- package/custom/composables/useAgentStore.ts +40 -18
- package/custom/conversation_area/ProcessingTimeline.vue +10 -1
- package/custom/conversation_area/TextRenderer.vue +2 -2
- package/dist/custom/ChatSurface.vue +9 -18
- package/dist/custom/SessionsHistory.vue +0 -6
- package/dist/custom/composables/useAgentStore.ts +40 -18
- package/dist/custom/conversation_area/ProcessingTimeline.vue +10 -1
- package/dist/custom/conversation_area/TextRenderer.vue +2 -2
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -40,5 +40,5 @@ custom/skills/fetch_data/SKILL.md
|
|
|
40
40
|
custom/skills/mutate_data/
|
|
41
41
|
custom/skills/mutate_data/SKILL.md
|
|
42
42
|
|
|
43
|
-
sent
|
|
44
|
-
total size is 208,
|
|
43
|
+
sent 210,682 bytes received 585 bytes 422,534.00 bytes/sec
|
|
44
|
+
total size is 208,272 speedup is 0.99
|
package/custom/ChatSurface.vue
CHANGED
|
@@ -15,27 +15,26 @@
|
|
|
15
15
|
/>
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
<Teleport to="body">
|
|
20
20
|
<div
|
|
21
21
|
ref="chatSurface"
|
|
22
22
|
id="adminforth-agent-chat-surface"
|
|
23
23
|
class="fixed bg-lightNavbar dark:bg-darkNavbar top-0 right-0 border-x border-b border-gray-200 dark:border-gray-700
|
|
24
|
-
flex flex z-40"
|
|
24
|
+
flex flex z-40 h-screen"
|
|
25
25
|
:class="[agentStore.isChatOpen ? 'translate-x-0' : 'translate-x-full', !agentStore.isTeleportedToBody ? 'shadow-2xl' : '']"
|
|
26
|
-
:style="{
|
|
27
|
-
width: agentStore.chatWidth + 'rem',
|
|
28
|
-
top: viewportOffsetTop + 'px',
|
|
29
|
-
height: dvh + 'px',
|
|
30
|
-
}"
|
|
26
|
+
:style="{ width: agentStore.chatWidth + 'rem' }"
|
|
31
27
|
>
|
|
32
28
|
<div
|
|
33
29
|
v-if="!(coreStore.isMobile || agentStore.isFullScreen)"
|
|
34
|
-
class="w-2 cursor-ew-resize absolute left-0 top-0
|
|
30
|
+
class="w-2 cursor-ew-resize absolute left-0 top-0 z-30"
|
|
35
31
|
@mousedown="startResize"
|
|
36
32
|
></div>
|
|
37
33
|
<div
|
|
38
|
-
class="w-full
|
|
34
|
+
class="w-full min-h-0 max-h-full flex flex-col h-dvh"
|
|
35
|
+
:style="{
|
|
36
|
+
height: !agentStore.isIos ? dvh + 'px' : '100dvh',
|
|
37
|
+
}"
|
|
39
38
|
>
|
|
40
39
|
<div
|
|
41
40
|
ref="headerRef"
|
|
@@ -88,7 +87,6 @@
|
|
|
88
87
|
<div class="flex items-center justify-center">
|
|
89
88
|
<Button
|
|
90
89
|
@click="agentStore.createPreSession(); agentStore.setSessionHistoryOpen(false); agentStore.focusTextInput();"
|
|
91
|
-
:disabled="agentStore.isResponseInProgress"
|
|
92
90
|
class="!py-1 !px-2 rounded-3xl text-gray-800 dark:text-gray-200 max-w-64 mr-2"
|
|
93
91
|
>
|
|
94
92
|
<IconPlusOutline class="w-5 h-5" />
|
|
@@ -223,8 +221,7 @@ const agentTransitions = useAgentTransitions();
|
|
|
223
221
|
const coreStore = useCoreStore();
|
|
224
222
|
const isModeMenuOpen = ref(false);
|
|
225
223
|
|
|
226
|
-
const dvh = ref(
|
|
227
|
-
const viewportOffsetTop = ref(Math.round(window.visualViewport?.offsetTop || 0));
|
|
224
|
+
const dvh = ref(window.innerHeight)
|
|
228
225
|
|
|
229
226
|
let startX = 0
|
|
230
227
|
let startWidth = 0
|
|
@@ -236,9 +233,6 @@ onMounted(async () => {
|
|
|
236
233
|
agentStore.setAvailableModes(props.meta.modes, props.meta.defaultModeName);
|
|
237
234
|
agentStore.regisrerTextInput(textInput.value);
|
|
238
235
|
window.addEventListener('resize', updateHeight)
|
|
239
|
-
window.visualViewport?.addEventListener('resize', updateHeight);
|
|
240
|
-
window.visualViewport?.addEventListener('scroll', updateHeight);
|
|
241
|
-
updateHeight();
|
|
242
236
|
textInput.value?.focus();
|
|
243
237
|
const savedIsTeleportedToBody = agentStore.getLocalStorageItem('isTeleportedToBody');
|
|
244
238
|
const savedIsTeleportedToBodyBeforeFullScreen = agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen');
|
|
@@ -256,8 +250,6 @@ onMounted(async () => {
|
|
|
256
250
|
|
|
257
251
|
onUnmounted(() => {
|
|
258
252
|
window.removeEventListener('resize', updateHeight)
|
|
259
|
-
window.visualViewport?.removeEventListener('resize', updateHeight);
|
|
260
|
-
window.visualViewport?.removeEventListener('scroll', updateHeight);
|
|
261
253
|
})
|
|
262
254
|
|
|
263
255
|
const startResize = (e: MouseEvent) => {
|
|
@@ -326,7 +318,6 @@ async function sendMessage() {
|
|
|
326
318
|
|
|
327
319
|
function updateHeight() {
|
|
328
320
|
dvh.value = Math.round(window.visualViewport?.height || window.innerHeight);
|
|
329
|
-
viewportOffsetTop.value = Math.round(window.visualViewport?.offsetTop || 0);
|
|
330
321
|
}
|
|
331
322
|
|
|
332
323
|
</script>
|
|
@@ -9,10 +9,6 @@
|
|
|
9
9
|
<div class="w-full flex items-center justify-center">
|
|
10
10
|
</div>
|
|
11
11
|
<div class="w-full border-b border-gray-200 dark:border-gray-700"/>
|
|
12
|
-
<div class="absolute w-full h-full flex flex-col items-center justify-center bg-gray-100/50 dark:bg-gray-700/50 z-10" v-if="agentStore.isResponseInProgress">
|
|
13
|
-
<Spinner class="w-8 h-8" v-if="agentStore.isResponseInProgress" />
|
|
14
|
-
<p class="mt-2 text-gray-800 dark:text-gray-200">{{ $t('Generation in progress...') }}</p>
|
|
15
|
-
</div>
|
|
16
12
|
<div v-for="group in groupedSessions" :key="group.dayKey" class="w-full py-2">
|
|
17
13
|
<div class="px-4 pb-2 text-xs font-semibold uppercase tracking-[0.2em] text-gray-500 dark:text-gray-400">
|
|
18
14
|
{{ group.label }}
|
|
@@ -24,10 +20,8 @@
|
|
|
24
20
|
class=" flex items-center justify-between w-full px-4 py-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors duration-200 ease-in-out text-gray-800 dark:text-gray-200"
|
|
25
21
|
:class="{
|
|
26
22
|
'bg-lightPrimary/20 hover:bg-lightPrimary/20 dark:bg-darkPrimary/20 dark:hover:bg-darkPrimary/20': agentStore.activeSessionId === session.sessionId,
|
|
27
|
-
'cursor-default opacity-50 pointer-events-none': agentStore.isResponseInProgress,
|
|
28
23
|
}"
|
|
29
24
|
@click="agentStore.setActiveSession(session.sessionId); agentStore.setSessionHistoryOpen(false);"
|
|
30
|
-
:disabled="agentStore.isResponseInProgress"
|
|
31
25
|
>
|
|
32
26
|
<p class="truncate">{{ session.title || session.sessionId }}</p>
|
|
33
27
|
<div @click.stop="agentStore.deleteSession(session.sessionId)" class="w-7 h-7 p-1 hover:scale-110 hover:bg-gray-200 dark:hover:bg-gray-500 flex items-center justify-center rounded">
|
|
@@ -60,6 +60,10 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
60
60
|
const activeModeName = ref<string | null>(null);
|
|
61
61
|
const hasTypedMessageInPageSession = ref(false);
|
|
62
62
|
const { width: windowWidth } = useWindowSize();
|
|
63
|
+
|
|
64
|
+
const chats = new Map<string, Chat<any>>();
|
|
65
|
+
const currentChat = shallowRef<Chat<any>>();
|
|
66
|
+
|
|
63
67
|
let placeholderAnimationTimer: ReturnType<typeof setTimeout> | null = null;
|
|
64
68
|
|
|
65
69
|
function setLocalStorageItem(key: string, value: string) {
|
|
@@ -116,17 +120,20 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
if (!coreStore.isMobile) {
|
|
124
|
+
const savedIsTeleportedToBody = getLocalStorageItem('isTeleportedToBody');
|
|
125
|
+
const savedIsChatOpen = getLocalStorageItem('isChatOpen');
|
|
126
|
+
const shouldTeleportToBody = savedIsTeleportedToBody === null ? true : savedIsTeleportedToBody === 'true';
|
|
127
|
+
|
|
128
|
+
setIsTeleportedToBody(shouldTeleportToBody);
|
|
129
|
+
if (isTeleportedToBody.value) {
|
|
130
|
+
isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
|
|
131
|
+
}
|
|
132
|
+
}
|
|
123
133
|
lastSessionId.value = getLocalStorageItem('lastSessionId');
|
|
124
134
|
if (lastSessionId.value && lastSessionId.value !== 'pre-session') {
|
|
125
135
|
setActiveSession(lastSessionId.value);
|
|
126
136
|
}
|
|
127
|
-
if (isTeleportedToBody.value) {
|
|
128
|
-
isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
|
|
129
|
-
}
|
|
130
137
|
if (coreStore.isMobile) {
|
|
131
138
|
setChatWidth(window.innerWidth);
|
|
132
139
|
}
|
|
@@ -150,6 +157,7 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
150
157
|
|
|
151
158
|
if (fullScreen) {
|
|
152
159
|
document.body.style.overflow = 'hidden';
|
|
160
|
+
document.body.classList.add('bg-lightHtml', 'dark:bg-darkHtml');
|
|
153
161
|
setTimeout(() => {
|
|
154
162
|
appElement?.setAttribute('style', `opacity: 0; pointer-events: none;`);
|
|
155
163
|
}, agentTransitions.TRANSITION_DURATION);
|
|
@@ -189,8 +197,6 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
189
197
|
}
|
|
190
198
|
}
|
|
191
199
|
})
|
|
192
|
-
const chats = new Map<string, Chat<any>>();
|
|
193
|
-
const currentChat = shallowRef<Chat<any>>();
|
|
194
200
|
|
|
195
201
|
function setAvailableModes(modes: AgentMode[], defaultModeName?: string | null) {
|
|
196
202
|
availableModes.value = modes;
|
|
@@ -349,6 +355,7 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
349
355
|
return;
|
|
350
356
|
}
|
|
351
357
|
isChatOpen.value = false;
|
|
358
|
+
setFullScreen(false);
|
|
352
359
|
isSessionHistoryOpen.value = false;
|
|
353
360
|
}
|
|
354
361
|
|
|
@@ -549,14 +556,16 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
549
556
|
}
|
|
550
557
|
currentSession.value = sessions.value[sessionId];
|
|
551
558
|
setCurrentChat(sessionId);
|
|
552
|
-
currentChat.value.messages
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
559
|
+
if (currentChat.value.messages.length === 0) {
|
|
560
|
+
currentChat.value.messages = currentSession.value?.messages.map((m: any) => ({
|
|
561
|
+
role: m.role,
|
|
562
|
+
parts:[{
|
|
563
|
+
type: 'text',
|
|
564
|
+
text: m.text,
|
|
565
|
+
state: 'done',
|
|
566
|
+
}]
|
|
567
|
+
}));
|
|
568
|
+
}
|
|
560
569
|
}
|
|
561
570
|
|
|
562
571
|
async function fetchSessionsList() {
|
|
@@ -578,6 +587,18 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
578
587
|
}
|
|
579
588
|
}
|
|
580
589
|
|
|
590
|
+
function addDebugMessage(message: string) {
|
|
591
|
+
const debugMessage = {
|
|
592
|
+
role: 'assistant',
|
|
593
|
+
parts: [{
|
|
594
|
+
type: 'text',
|
|
595
|
+
text: message,
|
|
596
|
+
state: 'done',
|
|
597
|
+
}]
|
|
598
|
+
};
|
|
599
|
+
currentChat.value?.messages.push(debugMessage);
|
|
600
|
+
}
|
|
601
|
+
|
|
581
602
|
return {
|
|
582
603
|
//_________-Sessions management-_____________
|
|
583
604
|
activeSessionId,
|
|
@@ -616,6 +637,7 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
616
637
|
DEFAULT_CHAT_WIDTH,
|
|
617
638
|
MAX_WIDTH,
|
|
618
639
|
MIN_WIDTH,
|
|
619
|
-
getLocalStorageItem
|
|
640
|
+
getLocalStorageItem,
|
|
641
|
+
addDebugMessage
|
|
620
642
|
}
|
|
621
643
|
})
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
class="transition-transform duration-200"
|
|
13
13
|
/>
|
|
14
14
|
</div>
|
|
15
|
-
<transition name="expand" class="max-h-96 overflow-y-auto mb-4 pt-1">
|
|
15
|
+
<transition name="expand" class="sm:max-h-96 max-h-48 overflow-y-auto mb-4 pt-1">
|
|
16
16
|
<CustomAutoScrollContainer
|
|
17
17
|
ref="scrollContainerRef"
|
|
18
18
|
:enabled="isResponseInProgress"
|
|
@@ -74,6 +74,11 @@
|
|
|
74
74
|
|
|
75
75
|
onMounted(() => {
|
|
76
76
|
thinkingStartTime.value = Date.now();
|
|
77
|
+
if (isResponseInProgress.value) {
|
|
78
|
+
isExpanded.value = true;
|
|
79
|
+
} else {
|
|
80
|
+
isExpanded.value = false;
|
|
81
|
+
}
|
|
77
82
|
})
|
|
78
83
|
|
|
79
84
|
onUnmounted(() => {
|
|
@@ -197,6 +202,10 @@
|
|
|
197
202
|
.expand-leave-from {
|
|
198
203
|
opacity: 1;
|
|
199
204
|
max-height: 384px;
|
|
205
|
+
|
|
206
|
+
@media (max-width: 640px) {
|
|
207
|
+
max-height: 192px;
|
|
208
|
+
}
|
|
200
209
|
}
|
|
201
210
|
|
|
202
211
|
</style>
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
:incremark-options="incremarkOptions"
|
|
18
18
|
/>
|
|
19
19
|
<p v-else class="text-red-500 py-2">
|
|
20
|
-
{{ $t('
|
|
20
|
+
{{ $t('No content to render') }}
|
|
21
21
|
</p>
|
|
22
22
|
</div>
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
|
-
<script setup lang="ts">
|
|
25
|
+
<script setup lang="ts">
|
|
26
26
|
|
|
27
27
|
import { computed, defineAsyncComponent, onMounted, ref, watch } from 'vue';
|
|
28
28
|
import { useRouter } from 'vue-router';
|
|
@@ -15,27 +15,26 @@
|
|
|
15
15
|
/>
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
<Teleport to="body">
|
|
20
20
|
<div
|
|
21
21
|
ref="chatSurface"
|
|
22
22
|
id="adminforth-agent-chat-surface"
|
|
23
23
|
class="fixed bg-lightNavbar dark:bg-darkNavbar top-0 right-0 border-x border-b border-gray-200 dark:border-gray-700
|
|
24
|
-
flex flex z-40"
|
|
24
|
+
flex flex z-40 h-screen"
|
|
25
25
|
:class="[agentStore.isChatOpen ? 'translate-x-0' : 'translate-x-full', !agentStore.isTeleportedToBody ? 'shadow-2xl' : '']"
|
|
26
|
-
:style="{
|
|
27
|
-
width: agentStore.chatWidth + 'rem',
|
|
28
|
-
top: viewportOffsetTop + 'px',
|
|
29
|
-
height: dvh + 'px',
|
|
30
|
-
}"
|
|
26
|
+
:style="{ width: agentStore.chatWidth + 'rem' }"
|
|
31
27
|
>
|
|
32
28
|
<div
|
|
33
29
|
v-if="!(coreStore.isMobile || agentStore.isFullScreen)"
|
|
34
|
-
class="w-2 cursor-ew-resize absolute left-0 top-0
|
|
30
|
+
class="w-2 cursor-ew-resize absolute left-0 top-0 z-30"
|
|
35
31
|
@mousedown="startResize"
|
|
36
32
|
></div>
|
|
37
33
|
<div
|
|
38
|
-
class="w-full
|
|
34
|
+
class="w-full min-h-0 max-h-full flex flex-col h-dvh"
|
|
35
|
+
:style="{
|
|
36
|
+
height: !agentStore.isIos ? dvh + 'px' : '100dvh',
|
|
37
|
+
}"
|
|
39
38
|
>
|
|
40
39
|
<div
|
|
41
40
|
ref="headerRef"
|
|
@@ -88,7 +87,6 @@
|
|
|
88
87
|
<div class="flex items-center justify-center">
|
|
89
88
|
<Button
|
|
90
89
|
@click="agentStore.createPreSession(); agentStore.setSessionHistoryOpen(false); agentStore.focusTextInput();"
|
|
91
|
-
:disabled="agentStore.isResponseInProgress"
|
|
92
90
|
class="!py-1 !px-2 rounded-3xl text-gray-800 dark:text-gray-200 max-w-64 mr-2"
|
|
93
91
|
>
|
|
94
92
|
<IconPlusOutline class="w-5 h-5" />
|
|
@@ -223,8 +221,7 @@ const agentTransitions = useAgentTransitions();
|
|
|
223
221
|
const coreStore = useCoreStore();
|
|
224
222
|
const isModeMenuOpen = ref(false);
|
|
225
223
|
|
|
226
|
-
const dvh = ref(
|
|
227
|
-
const viewportOffsetTop = ref(Math.round(window.visualViewport?.offsetTop || 0));
|
|
224
|
+
const dvh = ref(window.innerHeight)
|
|
228
225
|
|
|
229
226
|
let startX = 0
|
|
230
227
|
let startWidth = 0
|
|
@@ -236,9 +233,6 @@ onMounted(async () => {
|
|
|
236
233
|
agentStore.setAvailableModes(props.meta.modes, props.meta.defaultModeName);
|
|
237
234
|
agentStore.regisrerTextInput(textInput.value);
|
|
238
235
|
window.addEventListener('resize', updateHeight)
|
|
239
|
-
window.visualViewport?.addEventListener('resize', updateHeight);
|
|
240
|
-
window.visualViewport?.addEventListener('scroll', updateHeight);
|
|
241
|
-
updateHeight();
|
|
242
236
|
textInput.value?.focus();
|
|
243
237
|
const savedIsTeleportedToBody = agentStore.getLocalStorageItem('isTeleportedToBody');
|
|
244
238
|
const savedIsTeleportedToBodyBeforeFullScreen = agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen');
|
|
@@ -256,8 +250,6 @@ onMounted(async () => {
|
|
|
256
250
|
|
|
257
251
|
onUnmounted(() => {
|
|
258
252
|
window.removeEventListener('resize', updateHeight)
|
|
259
|
-
window.visualViewport?.removeEventListener('resize', updateHeight);
|
|
260
|
-
window.visualViewport?.removeEventListener('scroll', updateHeight);
|
|
261
253
|
})
|
|
262
254
|
|
|
263
255
|
const startResize = (e: MouseEvent) => {
|
|
@@ -326,7 +318,6 @@ async function sendMessage() {
|
|
|
326
318
|
|
|
327
319
|
function updateHeight() {
|
|
328
320
|
dvh.value = Math.round(window.visualViewport?.height || window.innerHeight);
|
|
329
|
-
viewportOffsetTop.value = Math.round(window.visualViewport?.offsetTop || 0);
|
|
330
321
|
}
|
|
331
322
|
|
|
332
323
|
</script>
|
|
@@ -9,10 +9,6 @@
|
|
|
9
9
|
<div class="w-full flex items-center justify-center">
|
|
10
10
|
</div>
|
|
11
11
|
<div class="w-full border-b border-gray-200 dark:border-gray-700"/>
|
|
12
|
-
<div class="absolute w-full h-full flex flex-col items-center justify-center bg-gray-100/50 dark:bg-gray-700/50 z-10" v-if="agentStore.isResponseInProgress">
|
|
13
|
-
<Spinner class="w-8 h-8" v-if="agentStore.isResponseInProgress" />
|
|
14
|
-
<p class="mt-2 text-gray-800 dark:text-gray-200">{{ $t('Generation in progress...') }}</p>
|
|
15
|
-
</div>
|
|
16
12
|
<div v-for="group in groupedSessions" :key="group.dayKey" class="w-full py-2">
|
|
17
13
|
<div class="px-4 pb-2 text-xs font-semibold uppercase tracking-[0.2em] text-gray-500 dark:text-gray-400">
|
|
18
14
|
{{ group.label }}
|
|
@@ -24,10 +20,8 @@
|
|
|
24
20
|
class=" flex items-center justify-between w-full px-4 py-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors duration-200 ease-in-out text-gray-800 dark:text-gray-200"
|
|
25
21
|
:class="{
|
|
26
22
|
'bg-lightPrimary/20 hover:bg-lightPrimary/20 dark:bg-darkPrimary/20 dark:hover:bg-darkPrimary/20': agentStore.activeSessionId === session.sessionId,
|
|
27
|
-
'cursor-default opacity-50 pointer-events-none': agentStore.isResponseInProgress,
|
|
28
23
|
}"
|
|
29
24
|
@click="agentStore.setActiveSession(session.sessionId); agentStore.setSessionHistoryOpen(false);"
|
|
30
|
-
:disabled="agentStore.isResponseInProgress"
|
|
31
25
|
>
|
|
32
26
|
<p class="truncate">{{ session.title || session.sessionId }}</p>
|
|
33
27
|
<div @click.stop="agentStore.deleteSession(session.sessionId)" class="w-7 h-7 p-1 hover:scale-110 hover:bg-gray-200 dark:hover:bg-gray-500 flex items-center justify-center rounded">
|
|
@@ -60,6 +60,10 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
60
60
|
const activeModeName = ref<string | null>(null);
|
|
61
61
|
const hasTypedMessageInPageSession = ref(false);
|
|
62
62
|
const { width: windowWidth } = useWindowSize();
|
|
63
|
+
|
|
64
|
+
const chats = new Map<string, Chat<any>>();
|
|
65
|
+
const currentChat = shallowRef<Chat<any>>();
|
|
66
|
+
|
|
63
67
|
let placeholderAnimationTimer: ReturnType<typeof setTimeout> | null = null;
|
|
64
68
|
|
|
65
69
|
function setLocalStorageItem(key: string, value: string) {
|
|
@@ -116,17 +120,20 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
if (!coreStore.isMobile) {
|
|
124
|
+
const savedIsTeleportedToBody = getLocalStorageItem('isTeleportedToBody');
|
|
125
|
+
const savedIsChatOpen = getLocalStorageItem('isChatOpen');
|
|
126
|
+
const shouldTeleportToBody = savedIsTeleportedToBody === null ? true : savedIsTeleportedToBody === 'true';
|
|
127
|
+
|
|
128
|
+
setIsTeleportedToBody(shouldTeleportToBody);
|
|
129
|
+
if (isTeleportedToBody.value) {
|
|
130
|
+
isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
|
|
131
|
+
}
|
|
132
|
+
}
|
|
123
133
|
lastSessionId.value = getLocalStorageItem('lastSessionId');
|
|
124
134
|
if (lastSessionId.value && lastSessionId.value !== 'pre-session') {
|
|
125
135
|
setActiveSession(lastSessionId.value);
|
|
126
136
|
}
|
|
127
|
-
if (isTeleportedToBody.value) {
|
|
128
|
-
isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
|
|
129
|
-
}
|
|
130
137
|
if (coreStore.isMobile) {
|
|
131
138
|
setChatWidth(window.innerWidth);
|
|
132
139
|
}
|
|
@@ -150,6 +157,7 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
150
157
|
|
|
151
158
|
if (fullScreen) {
|
|
152
159
|
document.body.style.overflow = 'hidden';
|
|
160
|
+
document.body.classList.add('bg-lightHtml', 'dark:bg-darkHtml');
|
|
153
161
|
setTimeout(() => {
|
|
154
162
|
appElement?.setAttribute('style', `opacity: 0; pointer-events: none;`);
|
|
155
163
|
}, agentTransitions.TRANSITION_DURATION);
|
|
@@ -189,8 +197,6 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
189
197
|
}
|
|
190
198
|
}
|
|
191
199
|
})
|
|
192
|
-
const chats = new Map<string, Chat<any>>();
|
|
193
|
-
const currentChat = shallowRef<Chat<any>>();
|
|
194
200
|
|
|
195
201
|
function setAvailableModes(modes: AgentMode[], defaultModeName?: string | null) {
|
|
196
202
|
availableModes.value = modes;
|
|
@@ -349,6 +355,7 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
349
355
|
return;
|
|
350
356
|
}
|
|
351
357
|
isChatOpen.value = false;
|
|
358
|
+
setFullScreen(false);
|
|
352
359
|
isSessionHistoryOpen.value = false;
|
|
353
360
|
}
|
|
354
361
|
|
|
@@ -549,14 +556,16 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
549
556
|
}
|
|
550
557
|
currentSession.value = sessions.value[sessionId];
|
|
551
558
|
setCurrentChat(sessionId);
|
|
552
|
-
currentChat.value.messages
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
559
|
+
if (currentChat.value.messages.length === 0) {
|
|
560
|
+
currentChat.value.messages = currentSession.value?.messages.map((m: any) => ({
|
|
561
|
+
role: m.role,
|
|
562
|
+
parts:[{
|
|
563
|
+
type: 'text',
|
|
564
|
+
text: m.text,
|
|
565
|
+
state: 'done',
|
|
566
|
+
}]
|
|
567
|
+
}));
|
|
568
|
+
}
|
|
560
569
|
}
|
|
561
570
|
|
|
562
571
|
async function fetchSessionsList() {
|
|
@@ -578,6 +587,18 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
578
587
|
}
|
|
579
588
|
}
|
|
580
589
|
|
|
590
|
+
function addDebugMessage(message: string) {
|
|
591
|
+
const debugMessage = {
|
|
592
|
+
role: 'assistant',
|
|
593
|
+
parts: [{
|
|
594
|
+
type: 'text',
|
|
595
|
+
text: message,
|
|
596
|
+
state: 'done',
|
|
597
|
+
}]
|
|
598
|
+
};
|
|
599
|
+
currentChat.value?.messages.push(debugMessage);
|
|
600
|
+
}
|
|
601
|
+
|
|
581
602
|
return {
|
|
582
603
|
//_________-Sessions management-_____________
|
|
583
604
|
activeSessionId,
|
|
@@ -616,6 +637,7 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
616
637
|
DEFAULT_CHAT_WIDTH,
|
|
617
638
|
MAX_WIDTH,
|
|
618
639
|
MIN_WIDTH,
|
|
619
|
-
getLocalStorageItem
|
|
640
|
+
getLocalStorageItem,
|
|
641
|
+
addDebugMessage
|
|
620
642
|
}
|
|
621
643
|
})
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
class="transition-transform duration-200"
|
|
13
13
|
/>
|
|
14
14
|
</div>
|
|
15
|
-
<transition name="expand" class="max-h-96 overflow-y-auto mb-4 pt-1">
|
|
15
|
+
<transition name="expand" class="sm:max-h-96 max-h-48 overflow-y-auto mb-4 pt-1">
|
|
16
16
|
<CustomAutoScrollContainer
|
|
17
17
|
ref="scrollContainerRef"
|
|
18
18
|
:enabled="isResponseInProgress"
|
|
@@ -74,6 +74,11 @@
|
|
|
74
74
|
|
|
75
75
|
onMounted(() => {
|
|
76
76
|
thinkingStartTime.value = Date.now();
|
|
77
|
+
if (isResponseInProgress.value) {
|
|
78
|
+
isExpanded.value = true;
|
|
79
|
+
} else {
|
|
80
|
+
isExpanded.value = false;
|
|
81
|
+
}
|
|
77
82
|
})
|
|
78
83
|
|
|
79
84
|
onUnmounted(() => {
|
|
@@ -197,6 +202,10 @@
|
|
|
197
202
|
.expand-leave-from {
|
|
198
203
|
opacity: 1;
|
|
199
204
|
max-height: 384px;
|
|
205
|
+
|
|
206
|
+
@media (max-width: 640px) {
|
|
207
|
+
max-height: 192px;
|
|
208
|
+
}
|
|
200
209
|
}
|
|
201
210
|
|
|
202
211
|
</style>
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
:incremark-options="incremarkOptions"
|
|
18
18
|
/>
|
|
19
19
|
<p v-else class="text-red-500 py-2">
|
|
20
|
-
{{ $t('
|
|
20
|
+
{{ $t('No content to render') }}
|
|
21
21
|
</p>
|
|
22
22
|
</div>
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
|
-
<script setup lang="ts">
|
|
25
|
+
<script setup lang="ts">
|
|
26
26
|
|
|
27
27
|
import { computed, defineAsyncComponent, onMounted, ref, watch } from 'vue';
|
|
28
28
|
import { useRouter } from 'vue-router';
|