@adminforth/agent 1.33.0 → 1.34.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 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 210,589 bytes received 585 bytes 422,348.00 bytes/sec
44
- total size is 208,179 speedup is 0.99
43
+ sent 210,673 bytes received 585 bytes 422,516.00 bytes/sec
44
+ total size is 208,263 speedup is 0.99
@@ -88,7 +88,6 @@
88
88
  <div class="flex items-center justify-center">
89
89
  <Button
90
90
  @click="agentStore.createPreSession(); agentStore.setSessionHistoryOpen(false); agentStore.focusTextInput();"
91
- :disabled="agentStore.isResponseInProgress"
92
91
  class="!py-1 !px-2 rounded-3xl text-gray-800 dark:text-gray-200 max-w-64 mr-2"
93
92
  >
94
93
  <IconPlusOutline class="w-5 h-5" />
@@ -240,7 +239,12 @@ onMounted(async () => {
240
239
  window.visualViewport?.addEventListener('scroll', updateHeight);
241
240
  updateHeight();
242
241
  textInput.value?.focus();
243
- const isTeleportedToBodyFromLocalStorage = agentStore.getLocalStorageItem('isTeleportedToBody') === 'true' || agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true';
242
+ const savedIsTeleportedToBody = agentStore.getLocalStorageItem('isTeleportedToBody');
243
+ const savedIsTeleportedToBodyBeforeFullScreen = agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen');
244
+ let isTeleportedToBodyFromLocalStorage = true;
245
+ if (savedIsTeleportedToBody !== null || savedIsTeleportedToBodyBeforeFullScreen !== null) {
246
+ isTeleportedToBodyFromLocalStorage = savedIsTeleportedToBody === 'true' || savedIsTeleportedToBodyBeforeFullScreen === 'true';
247
+ }
244
248
  if( coreStore.isMobile ) {
245
249
  agentStore.setIsTeleportedToBody(false);
246
250
  } else {
@@ -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,13 +120,16 @@ export const useAgentStore = defineStore('agent', () => {
116
120
  }
117
121
  }
118
122
  }
119
- setIsTeleportedToBody(getLocalStorageItem('isTeleportedToBody') === 'true' || getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true');
123
+ const savedIsTeleportedToBody = getLocalStorageItem('isTeleportedToBody');
124
+ const savedIsChatOpen = getLocalStorageItem('isChatOpen');
125
+ const shouldTeleportToBody = savedIsTeleportedToBody === null ? true : savedIsTeleportedToBody === 'true';
126
+ setIsTeleportedToBody(shouldTeleportToBody);
120
127
  lastSessionId.value = getLocalStorageItem('lastSessionId');
121
128
  if (lastSessionId.value && lastSessionId.value !== 'pre-session') {
122
129
  setActiveSession(lastSessionId.value);
123
130
  }
124
131
  if (isTeleportedToBody.value) {
125
- isChatOpen.value = getLocalStorageItem('isChatOpen') === 'true';
132
+ isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
126
133
  }
127
134
  if (coreStore.isMobile) {
128
135
  setChatWidth(window.innerWidth);
@@ -186,8 +193,6 @@ export const useAgentStore = defineStore('agent', () => {
186
193
  }
187
194
  }
188
195
  })
189
- const chats = new Map<string, Chat<any>>();
190
- const currentChat = shallowRef<Chat<any>>();
191
196
 
192
197
  function setAvailableModes(modes: AgentMode[], defaultModeName?: string | null) {
193
198
  availableModes.value = modes;
@@ -546,14 +551,16 @@ export const useAgentStore = defineStore('agent', () => {
546
551
  }
547
552
  currentSession.value = sessions.value[sessionId];
548
553
  setCurrentChat(sessionId);
549
- currentChat.value.messages = currentSession.value?.messages.map((m: any) => ({
550
- role: m.role,
551
- parts:[{
552
- type: 'text',
553
- text: m.text,
554
- state: 'done',
555
- }]
556
- }));
554
+ if (currentChat.value.messages.length === 0) {
555
+ currentChat.value.messages = currentSession.value?.messages.map((m: any) => ({
556
+ role: m.role,
557
+ parts:[{
558
+ type: 'text',
559
+ text: m.text,
560
+ state: 'done',
561
+ }]
562
+ }));
563
+ }
557
564
  }
558
565
 
559
566
  async function fetchSessionsList() {
@@ -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(() => {
@@ -17,12 +17,12 @@
17
17
  :incremark-options="incremarkOptions"
18
18
  />
19
19
  <p v-else class="text-red-500 py-2">
20
- {{ $t('Error occurred') }}
20
+ {{ $t('No content to render') }}
21
21
  </p>
22
22
  </div>
23
23
  </template>
24
24
 
25
- <script setup lang="ts">const isExpanded = ref(true);
25
+ <script setup lang="ts">
26
26
 
27
27
  import { computed, defineAsyncComponent, onMounted, ref, watch } from 'vue';
28
28
  import { useRouter } from 'vue-router';
@@ -88,7 +88,6 @@
88
88
  <div class="flex items-center justify-center">
89
89
  <Button
90
90
  @click="agentStore.createPreSession(); agentStore.setSessionHistoryOpen(false); agentStore.focusTextInput();"
91
- :disabled="agentStore.isResponseInProgress"
92
91
  class="!py-1 !px-2 rounded-3xl text-gray-800 dark:text-gray-200 max-w-64 mr-2"
93
92
  >
94
93
  <IconPlusOutline class="w-5 h-5" />
@@ -240,7 +239,12 @@ onMounted(async () => {
240
239
  window.visualViewport?.addEventListener('scroll', updateHeight);
241
240
  updateHeight();
242
241
  textInput.value?.focus();
243
- const isTeleportedToBodyFromLocalStorage = agentStore.getLocalStorageItem('isTeleportedToBody') === 'true' || agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true';
242
+ const savedIsTeleportedToBody = agentStore.getLocalStorageItem('isTeleportedToBody');
243
+ const savedIsTeleportedToBodyBeforeFullScreen = agentStore.getLocalStorageItem('isTeleportedToBodyBeforeFullScreen');
244
+ let isTeleportedToBodyFromLocalStorage = true;
245
+ if (savedIsTeleportedToBody !== null || savedIsTeleportedToBodyBeforeFullScreen !== null) {
246
+ isTeleportedToBodyFromLocalStorage = savedIsTeleportedToBody === 'true' || savedIsTeleportedToBodyBeforeFullScreen === 'true';
247
+ }
244
248
  if( coreStore.isMobile ) {
245
249
  agentStore.setIsTeleportedToBody(false);
246
250
  } else {
@@ -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,13 +120,16 @@ export const useAgentStore = defineStore('agent', () => {
116
120
  }
117
121
  }
118
122
  }
119
- setIsTeleportedToBody(getLocalStorageItem('isTeleportedToBody') === 'true' || getLocalStorageItem('isTeleportedToBodyBeforeFullScreen') === 'true');
123
+ const savedIsTeleportedToBody = getLocalStorageItem('isTeleportedToBody');
124
+ const savedIsChatOpen = getLocalStorageItem('isChatOpen');
125
+ const shouldTeleportToBody = savedIsTeleportedToBody === null ? true : savedIsTeleportedToBody === 'true';
126
+ setIsTeleportedToBody(shouldTeleportToBody);
120
127
  lastSessionId.value = getLocalStorageItem('lastSessionId');
121
128
  if (lastSessionId.value && lastSessionId.value !== 'pre-session') {
122
129
  setActiveSession(lastSessionId.value);
123
130
  }
124
131
  if (isTeleportedToBody.value) {
125
- isChatOpen.value = getLocalStorageItem('isChatOpen') === 'true';
132
+ isChatOpen.value = savedIsChatOpen === null ? true : savedIsChatOpen === 'true';
126
133
  }
127
134
  if (coreStore.isMobile) {
128
135
  setChatWidth(window.innerWidth);
@@ -186,8 +193,6 @@ export const useAgentStore = defineStore('agent', () => {
186
193
  }
187
194
  }
188
195
  })
189
- const chats = new Map<string, Chat<any>>();
190
- const currentChat = shallowRef<Chat<any>>();
191
196
 
192
197
  function setAvailableModes(modes: AgentMode[], defaultModeName?: string | null) {
193
198
  availableModes.value = modes;
@@ -546,14 +551,16 @@ export const useAgentStore = defineStore('agent', () => {
546
551
  }
547
552
  currentSession.value = sessions.value[sessionId];
548
553
  setCurrentChat(sessionId);
549
- currentChat.value.messages = currentSession.value?.messages.map((m: any) => ({
550
- role: m.role,
551
- parts:[{
552
- type: 'text',
553
- text: m.text,
554
- state: 'done',
555
- }]
556
- }));
554
+ if (currentChat.value.messages.length === 0) {
555
+ currentChat.value.messages = currentSession.value?.messages.map((m: any) => ({
556
+ role: m.role,
557
+ parts:[{
558
+ type: 'text',
559
+ text: m.text,
560
+ state: 'done',
561
+ }]
562
+ }));
563
+ }
557
564
  }
558
565
 
559
566
  async function fetchSessionsList() {
@@ -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(() => {
@@ -17,12 +17,12 @@
17
17
  :incremark-options="incremarkOptions"
18
18
  />
19
19
  <p v-else class="text-red-500 py-2">
20
- {{ $t('Error occurred') }}
20
+ {{ $t('No content to render') }}
21
21
  </p>
22
22
  </div>
23
23
  </template>
24
24
 
25
- <script setup lang="ts">const isExpanded = ref(true);
25
+ <script setup lang="ts">
26
26
 
27
27
  import { computed, defineAsyncComponent, onMounted, ref, watch } from 'vue';
28
28
  import { useRouter } from 'vue-router';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/agent",
3
- "version": "1.33.0",
3
+ "version": "1.34.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",