@adminforth/agent 1.32.1 → 1.33.0
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 +31 -7
- package/custom/composables/useAgentStore.ts +6 -0
- package/custom/conversation_area/ConversationArea.vue +3 -1
- package/custom/conversation_area/TextRenderer.vue +4 -0
- package/dist/custom/ChatSurface.vue +31 -7
- package/dist/custom/composables/useAgentStore.ts +6 -0
- package/dist/custom/conversation_area/ConversationArea.vue +3 -1
- package/dist/custom/conversation_area/TextRenderer.vue +4 -0
- 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
|
|
43
|
+
sent 210,589 bytes received 585 bytes 422,348.00 bytes/sec
|
|
44
|
+
total size is 208,179 speedup is 0.99
|
package/custom/ChatSurface.vue
CHANGED
|
@@ -20,21 +20,25 @@
|
|
|
20
20
|
<div
|
|
21
21
|
ref="chatSurface"
|
|
22
22
|
id="adminforth-agent-chat-surface"
|
|
23
|
-
class="fixed bg-lightNavbar dark:bg-darkNavbar
|
|
23
|
+
class="fixed bg-lightNavbar dark:bg-darkNavbar top-0 right-0 border-x border-b border-gray-200 dark:border-gray-700
|
|
24
24
|
flex flex z-40"
|
|
25
25
|
:class="[agentStore.isChatOpen ? 'translate-x-0' : 'translate-x-full', !agentStore.isTeleportedToBody ? 'shadow-2xl' : '']"
|
|
26
|
-
:style="{
|
|
26
|
+
:style="{
|
|
27
|
+
width: agentStore.chatWidth + 'rem',
|
|
28
|
+
top: viewportOffsetTop + 'px',
|
|
29
|
+
height: dvh + 'px',
|
|
30
|
+
}"
|
|
27
31
|
>
|
|
28
32
|
<div
|
|
29
33
|
v-if="!(coreStore.isMobile || agentStore.isFullScreen)"
|
|
30
34
|
class="w-2 cursor-ew-resize absolute left-0 top-0 h-full z-30"
|
|
31
35
|
@mousedown="startResize"
|
|
32
36
|
></div>
|
|
33
|
-
|
|
34
37
|
<div
|
|
35
|
-
class="w-full min-h-0 max-h-full flex flex-col"
|
|
38
|
+
class="w-full h-full min-h-0 max-h-full flex flex-col"
|
|
36
39
|
>
|
|
37
40
|
<div
|
|
41
|
+
ref="headerRef"
|
|
38
42
|
class="flex items-center justify-between h-14 border-b border-gray-200 dark:border-gray-700"
|
|
39
43
|
>
|
|
40
44
|
<div
|
|
@@ -94,7 +98,7 @@
|
|
|
94
98
|
class="m-2 w-8 h-8 p-1 cursor-pointer hover:scale-110 rounded transition-colors duration-200
|
|
95
99
|
text-lightNavbarIcons hover:text-lightNavbarIcons/80 hover:bg-lightNavbarIcons/20
|
|
96
100
|
dark:text-darkNavbarIcons hover:text-darkNavbarIcons/80 hover:bg-darkNavbarIcons/20 "
|
|
97
|
-
@click="agentStore.setIsChatOpen(false)"
|
|
101
|
+
@click="agentStore.setFullScreen(false); agentStore.setIsChatOpen(false)"
|
|
98
102
|
/>
|
|
99
103
|
</div>
|
|
100
104
|
|
|
@@ -108,7 +112,8 @@
|
|
|
108
112
|
:messages="agentStore.chatMessages"
|
|
109
113
|
/>
|
|
110
114
|
|
|
111
|
-
<div
|
|
115
|
+
<div
|
|
116
|
+
ref="promptInput"
|
|
112
117
|
class="w-full mb-2 flex items-center justify-center px-2 bg-transparent relative translate-x-[-50%] left-1/2"
|
|
113
118
|
:style="{
|
|
114
119
|
maxWidth: agentStore.isFullScreen ? remToPx(agentStore.MAX_WIDTH)+'px' : '100%',
|
|
@@ -122,6 +127,7 @@
|
|
|
122
127
|
@input="autoResize"
|
|
123
128
|
:class="[
|
|
124
129
|
'min-h-12 px-4 pt-4 rounded-xl w-full resize-none overflow-hidden text-lightInputText dark:text-darkInputText rounded-md bg-transparent text-sm bg-gray-50 dark:bg-gray-700 dark:border-gray-600 focus:outline-none',
|
|
130
|
+
{ '!text-base': coreStore.isIos }
|
|
125
131
|
]"
|
|
126
132
|
:placeholder="agentStore.userMessagePlaceholder"
|
|
127
133
|
@keydown.enter.exact.prevent="sendMessage"
|
|
@@ -187,7 +193,7 @@
|
|
|
187
193
|
<script setup lang="ts">
|
|
188
194
|
import { IconChatBubbleLeft20Solid, IconSparklesSolid, IconArrowsPointingOut, IconArrowsPointingIn } from '@iconify-prerendered/vue-heroicons';
|
|
189
195
|
import { IconCloseOutline, IconBarsOutline, IconArrowUpOutline, IconCloseSidebarSolid, IconOpenSidebarSolid, IconAngleDownOutline, IconPlusOutline } from '@iconify-prerendered/vue-flowbite';
|
|
190
|
-
import { useTemplateRef, onMounted, ref } from 'vue';
|
|
196
|
+
import { useTemplateRef, onMounted, ref, onUnmounted } from 'vue';
|
|
191
197
|
import { onClickOutside } from '@vueuse/core'
|
|
192
198
|
import ConversationArea from './conversation_area/ConversationArea.vue';
|
|
193
199
|
import { useAgentStore } from './composables/useAgentStore';
|
|
@@ -216,6 +222,10 @@ const agentStore = useAgentStore();
|
|
|
216
222
|
const agentTransitions = useAgentTransitions();
|
|
217
223
|
const coreStore = useCoreStore();
|
|
218
224
|
const isModeMenuOpen = ref(false);
|
|
225
|
+
|
|
226
|
+
const dvh = ref(Math.round(window.visualViewport?.height || window.innerHeight));
|
|
227
|
+
const viewportOffsetTop = ref(Math.round(window.visualViewport?.offsetTop || 0));
|
|
228
|
+
|
|
219
229
|
let startX = 0
|
|
220
230
|
let startWidth = 0
|
|
221
231
|
|
|
@@ -225,6 +235,10 @@ onClickOutside(modeMenu, () => { isModeMenuOpen.value = false; });
|
|
|
225
235
|
onMounted(async () => {
|
|
226
236
|
agentStore.setAvailableModes(props.meta.modes, props.meta.defaultModeName);
|
|
227
237
|
agentStore.regisrerTextInput(textInput.value);
|
|
238
|
+
window.addEventListener('resize', updateHeight)
|
|
239
|
+
window.visualViewport?.addEventListener('resize', updateHeight);
|
|
240
|
+
window.visualViewport?.addEventListener('scroll', updateHeight);
|
|
241
|
+
updateHeight();
|
|
228
242
|
textInput.value?.focus();
|
|
229
243
|
const isTeleportedToBodyFromLocalStorage = agentStore.getLocalStorageItem('isTeleportedToBody') === 'true' || agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true';
|
|
230
244
|
if( coreStore.isMobile ) {
|
|
@@ -235,6 +249,11 @@ onMounted(async () => {
|
|
|
235
249
|
await agentStore.fetchSessionsList();
|
|
236
250
|
});
|
|
237
251
|
|
|
252
|
+
onUnmounted(() => {
|
|
253
|
+
window.removeEventListener('resize', updateHeight)
|
|
254
|
+
window.visualViewport?.removeEventListener('resize', updateHeight);
|
|
255
|
+
window.visualViewport?.removeEventListener('scroll', updateHeight);
|
|
256
|
+
})
|
|
238
257
|
|
|
239
258
|
const startResize = (e: MouseEvent) => {
|
|
240
259
|
startX = e.clientX
|
|
@@ -300,4 +319,9 @@ async function sendMessage() {
|
|
|
300
319
|
conversationArea.value?.handleSendMessage();
|
|
301
320
|
}
|
|
302
321
|
|
|
322
|
+
function updateHeight() {
|
|
323
|
+
dvh.value = Math.round(window.visualViewport?.height || window.innerHeight);
|
|
324
|
+
viewportOffsetTop.value = Math.round(window.visualViewport?.offsetTop || 0);
|
|
325
|
+
}
|
|
326
|
+
|
|
303
327
|
</script>
|
|
@@ -143,14 +143,20 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
143
143
|
const isFullScreen = ref(false);
|
|
144
144
|
function setFullScreen(fullScreen: boolean) {
|
|
145
145
|
isFullScreen.value = fullScreen;
|
|
146
|
+
const appElement = document.getElementById('app');
|
|
147
|
+
|
|
146
148
|
if (fullScreen) {
|
|
147
149
|
document.body.style.overflow = 'hidden';
|
|
150
|
+
setTimeout(() => {
|
|
151
|
+
appElement?.setAttribute('style', `opacity: 0; pointer-events: none;`);
|
|
152
|
+
}, agentTransitions.TRANSITION_DURATION);
|
|
148
153
|
setLocalStorageItem('chatWidthBeforeFullScreen', chatWidth.value.toString());
|
|
149
154
|
setLocalStorageItem('isTeleportedToBodyBeforeFullScreen', isTeleportedToBody.value ? 'true' : 'false');
|
|
150
155
|
setIsTeleportedToBody(false);
|
|
151
156
|
useAgentTransitions().setChatSurfaceTransition(false);
|
|
152
157
|
setChatWidth(window.innerWidth, false);
|
|
153
158
|
} else {
|
|
159
|
+
appElement?.setAttribute('style', `opacity: 100; pointer-events: all;`);
|
|
154
160
|
document.body.style.overflow = '';
|
|
155
161
|
const lastChatWidth = parseInt(getLocalStorageItem('chatWidthBeforeFullScreen') || DEFAULT_CHAT_WIDTH.toString(), 10);
|
|
156
162
|
const isTeleportedBeforeFullScreen = getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true';
|
|
@@ -55,7 +55,9 @@
|
|
|
55
55
|
</CustomAutoScrollContainer>
|
|
56
56
|
<button @click="scrollContainer.scrollToBottom();">
|
|
57
57
|
<IconArrowDownOutline
|
|
58
|
-
class="absolute z-10 bottom-8 left-1/2 bg-lightPrimary dark:bg-darkPrimary
|
|
58
|
+
class="absolute z-10 bottom-8 left-1/2 -translate-x-1/2 bg-lightPrimary/20 dark:bg-darkPrimary/10
|
|
59
|
+
border border-lightPrimary dark:border-darkPrimary text-lightPrimary dark:text-darkPrimary p-2 w-10 h-10
|
|
60
|
+
rounded-full transition-opacity duration-100 ease-in backdrop-blur-sm"
|
|
59
61
|
:class="showScrollToBottomButton ? 'opacity-100' : 'opacity-0 pointer-events-none'"
|
|
60
62
|
:disabled="!showScrollToBottomButton"
|
|
61
63
|
/>
|
|
@@ -20,21 +20,25 @@
|
|
|
20
20
|
<div
|
|
21
21
|
ref="chatSurface"
|
|
22
22
|
id="adminforth-agent-chat-surface"
|
|
23
|
-
class="fixed bg-lightNavbar dark:bg-darkNavbar
|
|
23
|
+
class="fixed bg-lightNavbar dark:bg-darkNavbar top-0 right-0 border-x border-b border-gray-200 dark:border-gray-700
|
|
24
24
|
flex flex z-40"
|
|
25
25
|
:class="[agentStore.isChatOpen ? 'translate-x-0' : 'translate-x-full', !agentStore.isTeleportedToBody ? 'shadow-2xl' : '']"
|
|
26
|
-
:style="{
|
|
26
|
+
:style="{
|
|
27
|
+
width: agentStore.chatWidth + 'rem',
|
|
28
|
+
top: viewportOffsetTop + 'px',
|
|
29
|
+
height: dvh + 'px',
|
|
30
|
+
}"
|
|
27
31
|
>
|
|
28
32
|
<div
|
|
29
33
|
v-if="!(coreStore.isMobile || agentStore.isFullScreen)"
|
|
30
34
|
class="w-2 cursor-ew-resize absolute left-0 top-0 h-full z-30"
|
|
31
35
|
@mousedown="startResize"
|
|
32
36
|
></div>
|
|
33
|
-
|
|
34
37
|
<div
|
|
35
|
-
class="w-full min-h-0 max-h-full flex flex-col"
|
|
38
|
+
class="w-full h-full min-h-0 max-h-full flex flex-col"
|
|
36
39
|
>
|
|
37
40
|
<div
|
|
41
|
+
ref="headerRef"
|
|
38
42
|
class="flex items-center justify-between h-14 border-b border-gray-200 dark:border-gray-700"
|
|
39
43
|
>
|
|
40
44
|
<div
|
|
@@ -94,7 +98,7 @@
|
|
|
94
98
|
class="m-2 w-8 h-8 p-1 cursor-pointer hover:scale-110 rounded transition-colors duration-200
|
|
95
99
|
text-lightNavbarIcons hover:text-lightNavbarIcons/80 hover:bg-lightNavbarIcons/20
|
|
96
100
|
dark:text-darkNavbarIcons hover:text-darkNavbarIcons/80 hover:bg-darkNavbarIcons/20 "
|
|
97
|
-
@click="agentStore.setIsChatOpen(false)"
|
|
101
|
+
@click="agentStore.setFullScreen(false); agentStore.setIsChatOpen(false)"
|
|
98
102
|
/>
|
|
99
103
|
</div>
|
|
100
104
|
|
|
@@ -108,7 +112,8 @@
|
|
|
108
112
|
:messages="agentStore.chatMessages"
|
|
109
113
|
/>
|
|
110
114
|
|
|
111
|
-
<div
|
|
115
|
+
<div
|
|
116
|
+
ref="promptInput"
|
|
112
117
|
class="w-full mb-2 flex items-center justify-center px-2 bg-transparent relative translate-x-[-50%] left-1/2"
|
|
113
118
|
:style="{
|
|
114
119
|
maxWidth: agentStore.isFullScreen ? remToPx(agentStore.MAX_WIDTH)+'px' : '100%',
|
|
@@ -122,6 +127,7 @@
|
|
|
122
127
|
@input="autoResize"
|
|
123
128
|
:class="[
|
|
124
129
|
'min-h-12 px-4 pt-4 rounded-xl w-full resize-none overflow-hidden text-lightInputText dark:text-darkInputText rounded-md bg-transparent text-sm bg-gray-50 dark:bg-gray-700 dark:border-gray-600 focus:outline-none',
|
|
130
|
+
{ '!text-base': coreStore.isIos }
|
|
125
131
|
]"
|
|
126
132
|
:placeholder="agentStore.userMessagePlaceholder"
|
|
127
133
|
@keydown.enter.exact.prevent="sendMessage"
|
|
@@ -187,7 +193,7 @@
|
|
|
187
193
|
<script setup lang="ts">
|
|
188
194
|
import { IconChatBubbleLeft20Solid, IconSparklesSolid, IconArrowsPointingOut, IconArrowsPointingIn } from '@iconify-prerendered/vue-heroicons';
|
|
189
195
|
import { IconCloseOutline, IconBarsOutline, IconArrowUpOutline, IconCloseSidebarSolid, IconOpenSidebarSolid, IconAngleDownOutline, IconPlusOutline } from '@iconify-prerendered/vue-flowbite';
|
|
190
|
-
import { useTemplateRef, onMounted, ref } from 'vue';
|
|
196
|
+
import { useTemplateRef, onMounted, ref, onUnmounted } from 'vue';
|
|
191
197
|
import { onClickOutside } from '@vueuse/core'
|
|
192
198
|
import ConversationArea from './conversation_area/ConversationArea.vue';
|
|
193
199
|
import { useAgentStore } from './composables/useAgentStore';
|
|
@@ -216,6 +222,10 @@ const agentStore = useAgentStore();
|
|
|
216
222
|
const agentTransitions = useAgentTransitions();
|
|
217
223
|
const coreStore = useCoreStore();
|
|
218
224
|
const isModeMenuOpen = ref(false);
|
|
225
|
+
|
|
226
|
+
const dvh = ref(Math.round(window.visualViewport?.height || window.innerHeight));
|
|
227
|
+
const viewportOffsetTop = ref(Math.round(window.visualViewport?.offsetTop || 0));
|
|
228
|
+
|
|
219
229
|
let startX = 0
|
|
220
230
|
let startWidth = 0
|
|
221
231
|
|
|
@@ -225,6 +235,10 @@ onClickOutside(modeMenu, () => { isModeMenuOpen.value = false; });
|
|
|
225
235
|
onMounted(async () => {
|
|
226
236
|
agentStore.setAvailableModes(props.meta.modes, props.meta.defaultModeName);
|
|
227
237
|
agentStore.regisrerTextInput(textInput.value);
|
|
238
|
+
window.addEventListener('resize', updateHeight)
|
|
239
|
+
window.visualViewport?.addEventListener('resize', updateHeight);
|
|
240
|
+
window.visualViewport?.addEventListener('scroll', updateHeight);
|
|
241
|
+
updateHeight();
|
|
228
242
|
textInput.value?.focus();
|
|
229
243
|
const isTeleportedToBodyFromLocalStorage = agentStore.getLocalStorageItem('isTeleportedToBody') === 'true' || agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true';
|
|
230
244
|
if( coreStore.isMobile ) {
|
|
@@ -235,6 +249,11 @@ onMounted(async () => {
|
|
|
235
249
|
await agentStore.fetchSessionsList();
|
|
236
250
|
});
|
|
237
251
|
|
|
252
|
+
onUnmounted(() => {
|
|
253
|
+
window.removeEventListener('resize', updateHeight)
|
|
254
|
+
window.visualViewport?.removeEventListener('resize', updateHeight);
|
|
255
|
+
window.visualViewport?.removeEventListener('scroll', updateHeight);
|
|
256
|
+
})
|
|
238
257
|
|
|
239
258
|
const startResize = (e: MouseEvent) => {
|
|
240
259
|
startX = e.clientX
|
|
@@ -300,4 +319,9 @@ async function sendMessage() {
|
|
|
300
319
|
conversationArea.value?.handleSendMessage();
|
|
301
320
|
}
|
|
302
321
|
|
|
322
|
+
function updateHeight() {
|
|
323
|
+
dvh.value = Math.round(window.visualViewport?.height || window.innerHeight);
|
|
324
|
+
viewportOffsetTop.value = Math.round(window.visualViewport?.offsetTop || 0);
|
|
325
|
+
}
|
|
326
|
+
|
|
303
327
|
</script>
|
|
@@ -143,14 +143,20 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
143
143
|
const isFullScreen = ref(false);
|
|
144
144
|
function setFullScreen(fullScreen: boolean) {
|
|
145
145
|
isFullScreen.value = fullScreen;
|
|
146
|
+
const appElement = document.getElementById('app');
|
|
147
|
+
|
|
146
148
|
if (fullScreen) {
|
|
147
149
|
document.body.style.overflow = 'hidden';
|
|
150
|
+
setTimeout(() => {
|
|
151
|
+
appElement?.setAttribute('style', `opacity: 0; pointer-events: none;`);
|
|
152
|
+
}, agentTransitions.TRANSITION_DURATION);
|
|
148
153
|
setLocalStorageItem('chatWidthBeforeFullScreen', chatWidth.value.toString());
|
|
149
154
|
setLocalStorageItem('isTeleportedToBodyBeforeFullScreen', isTeleportedToBody.value ? 'true' : 'false');
|
|
150
155
|
setIsTeleportedToBody(false);
|
|
151
156
|
useAgentTransitions().setChatSurfaceTransition(false);
|
|
152
157
|
setChatWidth(window.innerWidth, false);
|
|
153
158
|
} else {
|
|
159
|
+
appElement?.setAttribute('style', `opacity: 100; pointer-events: all;`);
|
|
154
160
|
document.body.style.overflow = '';
|
|
155
161
|
const lastChatWidth = parseInt(getLocalStorageItem('chatWidthBeforeFullScreen') || DEFAULT_CHAT_WIDTH.toString(), 10);
|
|
156
162
|
const isTeleportedBeforeFullScreen = getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true';
|
|
@@ -55,7 +55,9 @@
|
|
|
55
55
|
</CustomAutoScrollContainer>
|
|
56
56
|
<button @click="scrollContainer.scrollToBottom();">
|
|
57
57
|
<IconArrowDownOutline
|
|
58
|
-
class="absolute z-10 bottom-8 left-1/2 bg-lightPrimary dark:bg-darkPrimary
|
|
58
|
+
class="absolute z-10 bottom-8 left-1/2 -translate-x-1/2 bg-lightPrimary/20 dark:bg-darkPrimary/10
|
|
59
|
+
border border-lightPrimary dark:border-darkPrimary text-lightPrimary dark:text-darkPrimary p-2 w-10 h-10
|
|
60
|
+
rounded-full transition-opacity duration-100 ease-in backdrop-blur-sm"
|
|
59
61
|
:class="showScrollToBottomButton ? 'opacity-100' : 'opacity-0 pointer-events-none'"
|
|
60
62
|
:disabled="!showScrollToBottomButton"
|
|
61
63
|
/>
|