@adminforth/agent 1.8.0 → 1.9.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/agent/simpleAgent.ts +1 -9
- package/build.log +2 -2
- package/custom/ToolsGroup.vue +0 -1
- package/custom/useAgentStore.ts +27 -11
- package/dist/agent/simpleAgent.js +1 -1
- package/dist/custom/ToolsGroup.vue +0 -1
- package/dist/custom/useAgentStore.ts +27 -11
- package/package.json +1 -1
package/agent/simpleAgent.ts
CHANGED
|
@@ -25,14 +25,6 @@ export const contextSchema = z.object({
|
|
|
25
25
|
emitToolCallEvent: z.custom<ToolCallEventSink>(),
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
type AgentReasoning =
|
|
29
|
-
| "none"
|
|
30
|
-
| "minimal"
|
|
31
|
-
| "low"
|
|
32
|
-
| "medium"
|
|
33
|
-
| "high"
|
|
34
|
-
| "xhigh";
|
|
35
|
-
|
|
36
28
|
type OpenAIBackedCompletionAdapter = CompletionAdapter & {
|
|
37
29
|
options?: {
|
|
38
30
|
openAiApiKey?: string;
|
|
@@ -273,7 +265,7 @@ export async function callAgent(params: {
|
|
|
273
265
|
|
|
274
266
|
return await agent.stream({ messages } as any, {
|
|
275
267
|
streamMode: "messages",
|
|
276
|
-
recursionLimit:
|
|
268
|
+
recursionLimit: 100,
|
|
277
269
|
callbacks: [createAgentLlmMetricsLogger()],
|
|
278
270
|
configurable: {
|
|
279
271
|
thread_id: sessionId,
|
package/build.log
CHANGED
|
@@ -29,5 +29,5 @@ custom/skills/fetch_data/SKILL.md
|
|
|
29
29
|
custom/skills/mutate_data/
|
|
30
30
|
custom/skills/mutate_data/SKILL.md
|
|
31
31
|
|
|
32
|
-
sent
|
|
33
|
-
total size is 173,
|
|
32
|
+
sent 175,146 bytes received 413 bytes 351,118.00 bytes/sec
|
|
33
|
+
total size is 173,468 speedup is 0.99
|
package/custom/ToolsGroup.vue
CHANGED
package/custom/useAgentStore.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ref, nextTick, computed, watch, onMounted, shallowRef } from 'vue';
|
|
|
4
4
|
import { callAdminForthApi } from '@/utils';
|
|
5
5
|
import { useAdminforth } from '@/adminforth';
|
|
6
6
|
import { Chat } from './chat';
|
|
7
|
-
import { DefaultChatTransport } from 'ai';
|
|
7
|
+
import { cosineSimilarity, DefaultChatTransport } from 'ai';
|
|
8
8
|
import { useCoreStore } from '@/stores/core';
|
|
9
9
|
|
|
10
10
|
type AgentMode = {
|
|
@@ -76,10 +76,24 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
})
|
|
79
|
-
|
|
79
|
+
const isFullScreen = ref(false);
|
|
80
|
+
function setFullScreen(fullScreen: boolean) {
|
|
81
|
+
isFullScreen.value = fullScreen;
|
|
82
|
+
console.log('setFullScreen', fullScreen);
|
|
83
|
+
if (fullScreen) {
|
|
84
|
+
setChatWidth(window.innerWidth, true);
|
|
85
|
+
} else {
|
|
86
|
+
console.log('setChatWidth to default');
|
|
87
|
+
chatWidth.value = 600;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function setChatWidth(width: number, blockTransition = false) {
|
|
80
92
|
if (appRoot.value && header.value) {
|
|
81
|
-
|
|
82
|
-
|
|
93
|
+
if (blockTransition) {
|
|
94
|
+
appRoot.value.style.transition = '';
|
|
95
|
+
header.value.style.transition = '';
|
|
96
|
+
}
|
|
83
97
|
}
|
|
84
98
|
chatWidth.value = width;
|
|
85
99
|
|
|
@@ -213,14 +227,14 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
213
227
|
//create a pre-session, until user will type something, so we can save session
|
|
214
228
|
async function createPreSession() {
|
|
215
229
|
saveCurrentSessionInCache();
|
|
216
|
-
if (sessionList.value.some((s: ISessionsListItem) => s.sessionId === 'pre-session')) {
|
|
217
|
-
|
|
230
|
+
if (!sessionList.value.some((s: ISessionsListItem) => s.sessionId === 'pre-session')) {
|
|
231
|
+
sessionList.value.unshift({
|
|
232
|
+
sessionId: 'pre-session',
|
|
233
|
+
title: 'New Session',
|
|
234
|
+
timestamp: new Date().toISOString(),
|
|
235
|
+
});
|
|
218
236
|
}
|
|
219
|
-
|
|
220
|
-
sessionId: 'pre-session',
|
|
221
|
-
title: 'New Session',
|
|
222
|
-
timestamp: new Date().toISOString(),
|
|
223
|
-
})
|
|
237
|
+
|
|
224
238
|
activeSessionId.value = 'pre-session';
|
|
225
239
|
currentSession.value = {
|
|
226
240
|
sessionId: 'pre-session',
|
|
@@ -394,6 +408,8 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
394
408
|
chatWidth,
|
|
395
409
|
setChatWidth,
|
|
396
410
|
focusTextInput,
|
|
411
|
+
setFullScreen,
|
|
412
|
+
isFullScreen,
|
|
397
413
|
availableModes,
|
|
398
414
|
activeModeName,
|
|
399
415
|
setAvailableModes,
|
|
@@ -151,7 +151,7 @@ export function callAgent(params) {
|
|
|
151
151
|
});
|
|
152
152
|
return yield agent.stream({ messages }, {
|
|
153
153
|
streamMode: "messages",
|
|
154
|
-
recursionLimit:
|
|
154
|
+
recursionLimit: 100,
|
|
155
155
|
callbacks: [createAgentLlmMetricsLogger()],
|
|
156
156
|
configurable: {
|
|
157
157
|
thread_id: sessionId,
|
|
@@ -4,7 +4,7 @@ import { ref, nextTick, computed, watch, onMounted, shallowRef } from 'vue';
|
|
|
4
4
|
import { callAdminForthApi } from '@/utils';
|
|
5
5
|
import { useAdminforth } from '@/adminforth';
|
|
6
6
|
import { Chat } from './chat';
|
|
7
|
-
import { DefaultChatTransport } from 'ai';
|
|
7
|
+
import { cosineSimilarity, DefaultChatTransport } from 'ai';
|
|
8
8
|
import { useCoreStore } from '@/stores/core';
|
|
9
9
|
|
|
10
10
|
type AgentMode = {
|
|
@@ -76,10 +76,24 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
})
|
|
79
|
-
|
|
79
|
+
const isFullScreen = ref(false);
|
|
80
|
+
function setFullScreen(fullScreen: boolean) {
|
|
81
|
+
isFullScreen.value = fullScreen;
|
|
82
|
+
console.log('setFullScreen', fullScreen);
|
|
83
|
+
if (fullScreen) {
|
|
84
|
+
setChatWidth(window.innerWidth, true);
|
|
85
|
+
} else {
|
|
86
|
+
console.log('setChatWidth to default');
|
|
87
|
+
chatWidth.value = 600;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function setChatWidth(width: number, blockTransition = false) {
|
|
80
92
|
if (appRoot.value && header.value) {
|
|
81
|
-
|
|
82
|
-
|
|
93
|
+
if (blockTransition) {
|
|
94
|
+
appRoot.value.style.transition = '';
|
|
95
|
+
header.value.style.transition = '';
|
|
96
|
+
}
|
|
83
97
|
}
|
|
84
98
|
chatWidth.value = width;
|
|
85
99
|
|
|
@@ -213,14 +227,14 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
213
227
|
//create a pre-session, until user will type something, so we can save session
|
|
214
228
|
async function createPreSession() {
|
|
215
229
|
saveCurrentSessionInCache();
|
|
216
|
-
if (sessionList.value.some((s: ISessionsListItem) => s.sessionId === 'pre-session')) {
|
|
217
|
-
|
|
230
|
+
if (!sessionList.value.some((s: ISessionsListItem) => s.sessionId === 'pre-session')) {
|
|
231
|
+
sessionList.value.unshift({
|
|
232
|
+
sessionId: 'pre-session',
|
|
233
|
+
title: 'New Session',
|
|
234
|
+
timestamp: new Date().toISOString(),
|
|
235
|
+
});
|
|
218
236
|
}
|
|
219
|
-
|
|
220
|
-
sessionId: 'pre-session',
|
|
221
|
-
title: 'New Session',
|
|
222
|
-
timestamp: new Date().toISOString(),
|
|
223
|
-
})
|
|
237
|
+
|
|
224
238
|
activeSessionId.value = 'pre-session';
|
|
225
239
|
currentSession.value = {
|
|
226
240
|
sessionId: 'pre-session',
|
|
@@ -394,6 +408,8 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
394
408
|
chatWidth,
|
|
395
409
|
setChatWidth,
|
|
396
410
|
focusTextInput,
|
|
411
|
+
setFullScreen,
|
|
412
|
+
isFullScreen,
|
|
397
413
|
availableModes,
|
|
398
414
|
activeModeName,
|
|
399
415
|
setAvailableModes,
|