@adminforth/agent 1.1.0 → 1.1.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/ConversationArea.vue +4 -7
- package/custom/Message.vue +1 -1
- package/custom/SessionsHistory.vue +3 -3
- package/custom/ToolRenderer.vue +5 -3
- package/custom/ToolsGroup.vue +6 -5
- package/custom/useAgentStore.ts +9 -0
- package/dist/custom/ConversationArea.vue +4 -7
- package/dist/custom/Message.vue +1 -1
- package/dist/custom/SessionsHistory.vue +3 -3
- package/dist/custom/ToolRenderer.vue +5 -3
- package/dist/custom/ToolsGroup.vue +6 -5
- package/dist/custom/useAgentStore.ts +9 -0
- package/dist/index.js +9 -0
- package/index.ts +8 -0
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -26,5 +26,5 @@ custom/skills/fetch_data/SKILL.md
|
|
|
26
26
|
custom/skills/mutate_data/
|
|
27
27
|
custom/skills/mutate_data/SKILL.md
|
|
28
28
|
|
|
29
|
-
sent 136,
|
|
30
|
-
total size is
|
|
29
|
+
sent 136,840 bytes received 367 bytes 274,414.00 bytes/sec
|
|
30
|
+
total size is 135,334 speedup is 0.99
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
</div>
|
|
19
19
|
<AutoScrollContainer
|
|
20
|
-
enabled
|
|
20
|
+
:enabled="!showScrollToBottomButton"
|
|
21
21
|
class="flex flex-col overflow-y-auto border-t border-gray-200 dark:border-gray-700"
|
|
22
22
|
ref="scrollContainer"
|
|
23
|
+
:threshold="10"
|
|
23
24
|
behavior="smooth"
|
|
24
25
|
>
|
|
25
26
|
|
|
@@ -57,8 +58,8 @@
|
|
|
57
58
|
v-if="props.messages.length === 0"
|
|
58
59
|
class="flex-1 flex flex-col items-center justify-center text-gray-400 tracking-widest text-xl font-medium"
|
|
59
60
|
>
|
|
60
|
-
<p>Start the conversation</p>
|
|
61
|
-
<p class="tracking-normal text-base text">Give any input to begin</p>
|
|
61
|
+
<p>{{ $t('Start the conversation') }}</p>
|
|
62
|
+
<p class="tracking-normal text-base text">{{ $t('Give any input to begin') }}</p>
|
|
62
63
|
</div>
|
|
63
64
|
</AutoScrollContainer>
|
|
64
65
|
</template>
|
|
@@ -151,20 +152,16 @@ const groupToolCallParts = (message: IMessage) => {
|
|
|
151
152
|
if(!part?.toolInfo) {
|
|
152
153
|
continue;
|
|
153
154
|
}
|
|
154
|
-
console.log('part', part);
|
|
155
155
|
if (part.toolInfo.toolName === currentToolName) {
|
|
156
|
-
console.log('grouping part with tool name', currentToolName);
|
|
157
156
|
groupedParts[groupedParts.length - 1].groupedTools.push(part);
|
|
158
157
|
continue;
|
|
159
158
|
}
|
|
160
159
|
currentToolName = part.toolInfo.toolName;
|
|
161
|
-
console.log('starting new group with tool name', currentToolName);
|
|
162
160
|
groupedParts.push({
|
|
163
161
|
title: currentToolName,
|
|
164
162
|
groupedTools: [part]
|
|
165
163
|
});
|
|
166
164
|
}
|
|
167
|
-
console.log('groupedParts', groupedParts);
|
|
168
165
|
return groupedParts;
|
|
169
166
|
}
|
|
170
167
|
|
package/custom/Message.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="max-w-[80%] flex px-4
|
|
3
|
+
class="max-w-[80%] flex px-4 m-2 rounded-xl border border-gray-200 dark:border-gray-700"
|
|
4
4
|
@click="handleMarkdownLinkClick"
|
|
5
5
|
:class="props.role === 'user' ? 'bg-lightListTableHeading dark:bg-darkListTableHeading self-end'
|
|
6
6
|
: isTypeReasoning || isTypeToolCall ? 'bg-transparent border-none self-start'
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
"
|
|
7
7
|
>
|
|
8
8
|
<h3 :class="h3Style">{{ $t('Chat history') }}</h3>
|
|
9
|
-
<Button @click="agentStore.createPreSession()" :disabled="agentStore.isResponseInProgress" class="w-[360px] mx-4 my-2 mb-4 rounded-3xl text-gray-800 dark:text-gray-200">
|
|
9
|
+
<Button @click="agentStore.createPreSession(); agentStore.setSessionHistoryOpen(false)" :disabled="agentStore.isResponseInProgress" class="w-[360px] mx-4 my-2 mb-4 rounded-3xl text-gray-800 dark:text-gray-200">
|
|
10
10
|
<IconPlusOutline class="w-5 h-5" />
|
|
11
11
|
{{ $t('New chat') }}
|
|
12
12
|
</Button>
|
|
13
13
|
<div class="w-full border-b border-gray-200 dark:border-gray-700"/>
|
|
14
14
|
<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">
|
|
15
15
|
<Spinner class="w-8 h-8" v-if="agentStore.isResponseInProgress" />
|
|
16
|
-
<p class="mt-2 text-gray-800 dark:text-gray-200">
|
|
16
|
+
<p class="mt-2 text-gray-800 dark:text-gray-200">{{ $t('Generation in progress...') }}</p>
|
|
17
17
|
</div>
|
|
18
18
|
<div v-for="group in groupedSessions" :key="group.dayKey" class="w-full py-2">
|
|
19
19
|
<div class="px-4 pb-2 text-xs font-semibold uppercase tracking-[0.2em] text-gray-500 dark:text-gray-400">
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
v-if="!groupedSessions || groupedSessions.length === 0"
|
|
39
39
|
class="w-full h-full flex items-center justify-center text-gray-800 dark:text-gray-200"
|
|
40
40
|
>
|
|
41
|
-
There
|
|
41
|
+
{{ $t('There are no previous chat sessions') }}
|
|
42
42
|
</p>
|
|
43
43
|
</div>
|
|
44
44
|
</template>
|
package/custom/ToolRenderer.vue
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="inline-flex m-2 max-w-[80%] flex-col gap-3 rounded-xl p-2 cursor-pointer text-lightListTableHeadingText dark:text-darkListTableHeadingText hover:opacity-75"
|
|
4
|
+
@click="isInputOutputExpanded = !isInputOutputExpanded"
|
|
5
|
+
>
|
|
3
6
|
<div class="flex items-center gap-3">
|
|
4
7
|
<div class="flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-white/70 dark:bg-blue-700/20">
|
|
5
8
|
<Spinner v-if="isRunning" class="h-4 w-4" />
|
|
@@ -18,8 +21,7 @@
|
|
|
18
21
|
<IconAngleDownOutline
|
|
19
22
|
v-if="hasToolSections"
|
|
20
23
|
:class="isInputOutputExpanded ? 'rotate-180' : 'rotate-0'"
|
|
21
|
-
class="cursor-pointer transition-transform duration-200 hover:scale-105
|
|
22
|
-
@click="isInputOutputExpanded = !isInputOutputExpanded"
|
|
24
|
+
class="cursor-pointer transition-transform duration-200 hover:scale-105"
|
|
23
25
|
/>
|
|
24
26
|
</div>
|
|
25
27
|
<transition name="expand">
|
package/custom/ToolsGroup.vue
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<template v-for="group in props.toolGroup" :key="group.title">
|
|
3
|
-
<div v-if="group.groupedTools.length > 1" class="
|
|
4
|
-
<div class="flex items-center gap-2 p-2 m-2 cursor-pointer hover:opacity-75 break-all font-mono text-sm leading-5" @click="toggleGroup(group.title)">
|
|
5
|
-
-
|
|
3
|
+
<div v-if="group.groupedTools.length > 1" class="flex flex-col">
|
|
4
|
+
<div class="flex items-center gap-2 p-2 m-2 cursor-pointer hover:opacity-75 break-all font-mono text-sm leading-5 text-lightListTableHeadingText dark:text-darkListTableHeadingText" @click="toggleGroup(group.title)">
|
|
5
|
+
<IconMinusOutline class="w-6 h-6 p-1"/>
|
|
6
|
+
{{ group.title }} {{ 'x' + group.groupedTools.length }}
|
|
6
7
|
<IconAngleDownOutline
|
|
7
8
|
class="transition-transform duration-200 hover:scale-105 hover:opacity-75"
|
|
8
9
|
:class="expandedGroups.includes(group.title) ? 'rotate-180' : 'rotate-0'"
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
</div>
|
|
11
12
|
<transition name="expand">
|
|
12
13
|
<div v-show="expandedGroups.includes(group.title)" class="flex flex-col">
|
|
13
|
-
<ToolRenderer v-for="part in group.groupedTools" :key="part.text + part.type" :data="part" />
|
|
14
|
+
<ToolRenderer v-for="part in group.groupedTools" :key="part.text + part.type" :data="part" class="ml-8"/>
|
|
14
15
|
</div>
|
|
15
16
|
</transition>
|
|
16
17
|
</div>
|
|
@@ -24,7 +25,7 @@ import { Tool } from 'langchain';
|
|
|
24
25
|
import ToolRenderer from './ToolRenderer.vue';
|
|
25
26
|
import type { IPart } from './types';
|
|
26
27
|
import { ref } from 'vue';
|
|
27
|
-
import { IconAngleDownOutline } from '@iconify-prerendered/vue-flowbite';
|
|
28
|
+
import { IconAngleDownOutline, IconMinusOutline } from '@iconify-prerendered/vue-flowbite';
|
|
28
29
|
|
|
29
30
|
const props = defineProps<{
|
|
30
31
|
toolGroup: {
|
package/custom/useAgentStore.ts
CHANGED
|
@@ -120,6 +120,10 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
120
120
|
});
|
|
121
121
|
const blockCloseOfChat = ref(false);
|
|
122
122
|
|
|
123
|
+
function sortSessionsListByTimestamp(sessionsList: ISessionsListItem[]) {
|
|
124
|
+
return [...sessionsList].sort((a: ISessionsListItem, b: ISessionsListItem) => b.timestamp.localeCompare(a.timestamp));
|
|
125
|
+
}
|
|
126
|
+
|
|
123
127
|
async function sendMessage() {
|
|
124
128
|
const message = trimmedUserMessage.value;
|
|
125
129
|
if (!message || isResponseInProgress.value) {
|
|
@@ -128,6 +132,11 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
128
132
|
if (!currentSession.value || currentSession.value.sessionId === 'pre-session') {
|
|
129
133
|
await createNewSession(message);
|
|
130
134
|
}
|
|
135
|
+
currentSession.value.timestamp = new Date().toISOString();
|
|
136
|
+
sessionList.value = sortSessionsListByTimestamp(sessionList.value.map((s: ISessionsListItem) => s.sessionId === currentSession.value?.sessionId ? {
|
|
137
|
+
...s,
|
|
138
|
+
timestamp: currentSession.value?.timestamp || s.timestamp,
|
|
139
|
+
} : s));
|
|
131
140
|
lastMessage.value = message;
|
|
132
141
|
currentChat.value?.sendMessage({
|
|
133
142
|
text: message,
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
</div>
|
|
19
19
|
<AutoScrollContainer
|
|
20
|
-
enabled
|
|
20
|
+
:enabled="!showScrollToBottomButton"
|
|
21
21
|
class="flex flex-col overflow-y-auto border-t border-gray-200 dark:border-gray-700"
|
|
22
22
|
ref="scrollContainer"
|
|
23
|
+
:threshold="10"
|
|
23
24
|
behavior="smooth"
|
|
24
25
|
>
|
|
25
26
|
|
|
@@ -57,8 +58,8 @@
|
|
|
57
58
|
v-if="props.messages.length === 0"
|
|
58
59
|
class="flex-1 flex flex-col items-center justify-center text-gray-400 tracking-widest text-xl font-medium"
|
|
59
60
|
>
|
|
60
|
-
<p>Start the conversation</p>
|
|
61
|
-
<p class="tracking-normal text-base text">Give any input to begin</p>
|
|
61
|
+
<p>{{ $t('Start the conversation') }}</p>
|
|
62
|
+
<p class="tracking-normal text-base text">{{ $t('Give any input to begin') }}</p>
|
|
62
63
|
</div>
|
|
63
64
|
</AutoScrollContainer>
|
|
64
65
|
</template>
|
|
@@ -151,20 +152,16 @@ const groupToolCallParts = (message: IMessage) => {
|
|
|
151
152
|
if(!part?.toolInfo) {
|
|
152
153
|
continue;
|
|
153
154
|
}
|
|
154
|
-
console.log('part', part);
|
|
155
155
|
if (part.toolInfo.toolName === currentToolName) {
|
|
156
|
-
console.log('grouping part with tool name', currentToolName);
|
|
157
156
|
groupedParts[groupedParts.length - 1].groupedTools.push(part);
|
|
158
157
|
continue;
|
|
159
158
|
}
|
|
160
159
|
currentToolName = part.toolInfo.toolName;
|
|
161
|
-
console.log('starting new group with tool name', currentToolName);
|
|
162
160
|
groupedParts.push({
|
|
163
161
|
title: currentToolName,
|
|
164
162
|
groupedTools: [part]
|
|
165
163
|
});
|
|
166
164
|
}
|
|
167
|
-
console.log('groupedParts', groupedParts);
|
|
168
165
|
return groupedParts;
|
|
169
166
|
}
|
|
170
167
|
|
package/dist/custom/Message.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="max-w-[80%] flex px-4
|
|
3
|
+
class="max-w-[80%] flex px-4 m-2 rounded-xl border border-gray-200 dark:border-gray-700"
|
|
4
4
|
@click="handleMarkdownLinkClick"
|
|
5
5
|
:class="props.role === 'user' ? 'bg-lightListTableHeading dark:bg-darkListTableHeading self-end'
|
|
6
6
|
: isTypeReasoning || isTypeToolCall ? 'bg-transparent border-none self-start'
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
"
|
|
7
7
|
>
|
|
8
8
|
<h3 :class="h3Style">{{ $t('Chat history') }}</h3>
|
|
9
|
-
<Button @click="agentStore.createPreSession()" :disabled="agentStore.isResponseInProgress" class="w-[360px] mx-4 my-2 mb-4 rounded-3xl text-gray-800 dark:text-gray-200">
|
|
9
|
+
<Button @click="agentStore.createPreSession(); agentStore.setSessionHistoryOpen(false)" :disabled="agentStore.isResponseInProgress" class="w-[360px] mx-4 my-2 mb-4 rounded-3xl text-gray-800 dark:text-gray-200">
|
|
10
10
|
<IconPlusOutline class="w-5 h-5" />
|
|
11
11
|
{{ $t('New chat') }}
|
|
12
12
|
</Button>
|
|
13
13
|
<div class="w-full border-b border-gray-200 dark:border-gray-700"/>
|
|
14
14
|
<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">
|
|
15
15
|
<Spinner class="w-8 h-8" v-if="agentStore.isResponseInProgress" />
|
|
16
|
-
<p class="mt-2 text-gray-800 dark:text-gray-200">
|
|
16
|
+
<p class="mt-2 text-gray-800 dark:text-gray-200">{{ $t('Generation in progress...') }}</p>
|
|
17
17
|
</div>
|
|
18
18
|
<div v-for="group in groupedSessions" :key="group.dayKey" class="w-full py-2">
|
|
19
19
|
<div class="px-4 pb-2 text-xs font-semibold uppercase tracking-[0.2em] text-gray-500 dark:text-gray-400">
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
v-if="!groupedSessions || groupedSessions.length === 0"
|
|
39
39
|
class="w-full h-full flex items-center justify-center text-gray-800 dark:text-gray-200"
|
|
40
40
|
>
|
|
41
|
-
There
|
|
41
|
+
{{ $t('There are no previous chat sessions') }}
|
|
42
42
|
</p>
|
|
43
43
|
</div>
|
|
44
44
|
</template>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="inline-flex m-2 max-w-[80%] flex-col gap-3 rounded-xl p-2 cursor-pointer text-lightListTableHeadingText dark:text-darkListTableHeadingText hover:opacity-75"
|
|
4
|
+
@click="isInputOutputExpanded = !isInputOutputExpanded"
|
|
5
|
+
>
|
|
3
6
|
<div class="flex items-center gap-3">
|
|
4
7
|
<div class="flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-white/70 dark:bg-blue-700/20">
|
|
5
8
|
<Spinner v-if="isRunning" class="h-4 w-4" />
|
|
@@ -18,8 +21,7 @@
|
|
|
18
21
|
<IconAngleDownOutline
|
|
19
22
|
v-if="hasToolSections"
|
|
20
23
|
:class="isInputOutputExpanded ? 'rotate-180' : 'rotate-0'"
|
|
21
|
-
class="cursor-pointer transition-transform duration-200 hover:scale-105
|
|
22
|
-
@click="isInputOutputExpanded = !isInputOutputExpanded"
|
|
24
|
+
class="cursor-pointer transition-transform duration-200 hover:scale-105"
|
|
23
25
|
/>
|
|
24
26
|
</div>
|
|
25
27
|
<transition name="expand">
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<template v-for="group in props.toolGroup" :key="group.title">
|
|
3
|
-
<div v-if="group.groupedTools.length > 1" class="
|
|
4
|
-
<div class="flex items-center gap-2 p-2 m-2 cursor-pointer hover:opacity-75 break-all font-mono text-sm leading-5" @click="toggleGroup(group.title)">
|
|
5
|
-
-
|
|
3
|
+
<div v-if="group.groupedTools.length > 1" class="flex flex-col">
|
|
4
|
+
<div class="flex items-center gap-2 p-2 m-2 cursor-pointer hover:opacity-75 break-all font-mono text-sm leading-5 text-lightListTableHeadingText dark:text-darkListTableHeadingText" @click="toggleGroup(group.title)">
|
|
5
|
+
<IconMinusOutline class="w-6 h-6 p-1"/>
|
|
6
|
+
{{ group.title }} {{ 'x' + group.groupedTools.length }}
|
|
6
7
|
<IconAngleDownOutline
|
|
7
8
|
class="transition-transform duration-200 hover:scale-105 hover:opacity-75"
|
|
8
9
|
:class="expandedGroups.includes(group.title) ? 'rotate-180' : 'rotate-0'"
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
</div>
|
|
11
12
|
<transition name="expand">
|
|
12
13
|
<div v-show="expandedGroups.includes(group.title)" class="flex flex-col">
|
|
13
|
-
<ToolRenderer v-for="part in group.groupedTools" :key="part.text + part.type" :data="part" />
|
|
14
|
+
<ToolRenderer v-for="part in group.groupedTools" :key="part.text + part.type" :data="part" class="ml-8"/>
|
|
14
15
|
</div>
|
|
15
16
|
</transition>
|
|
16
17
|
</div>
|
|
@@ -24,7 +25,7 @@ import { Tool } from 'langchain';
|
|
|
24
25
|
import ToolRenderer from './ToolRenderer.vue';
|
|
25
26
|
import type { IPart } from './types';
|
|
26
27
|
import { ref } from 'vue';
|
|
27
|
-
import { IconAngleDownOutline } from '@iconify-prerendered/vue-flowbite';
|
|
28
|
+
import { IconAngleDownOutline, IconMinusOutline } from '@iconify-prerendered/vue-flowbite';
|
|
28
29
|
|
|
29
30
|
const props = defineProps<{
|
|
30
31
|
toolGroup: {
|
|
@@ -120,6 +120,10 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
120
120
|
});
|
|
121
121
|
const blockCloseOfChat = ref(false);
|
|
122
122
|
|
|
123
|
+
function sortSessionsListByTimestamp(sessionsList: ISessionsListItem[]) {
|
|
124
|
+
return [...sessionsList].sort((a: ISessionsListItem, b: ISessionsListItem) => b.timestamp.localeCompare(a.timestamp));
|
|
125
|
+
}
|
|
126
|
+
|
|
123
127
|
async function sendMessage() {
|
|
124
128
|
const message = trimmedUserMessage.value;
|
|
125
129
|
if (!message || isResponseInProgress.value) {
|
|
@@ -128,6 +132,11 @@ export const useAgentStore = defineStore('agent', () => {
|
|
|
128
132
|
if (!currentSession.value || currentSession.value.sessionId === 'pre-session') {
|
|
129
133
|
await createNewSession(message);
|
|
130
134
|
}
|
|
135
|
+
currentSession.value.timestamp = new Date().toISOString();
|
|
136
|
+
sessionList.value = sortSessionsListByTimestamp(sessionList.value.map((s: ISessionsListItem) => s.sessionId === currentSession.value?.sessionId ? {
|
|
137
|
+
...s,
|
|
138
|
+
timestamp: currentSession.value?.timestamp || s.timestamp,
|
|
139
|
+
} : s));
|
|
131
140
|
lastMessage.value = message;
|
|
132
141
|
currentChat.value?.sendMessage({
|
|
133
142
|
text: message,
|
package/dist/index.js
CHANGED
|
@@ -71,6 +71,14 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
|
|
|
71
71
|
return { ok: true };
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
+
updateSessionDate(sessionId) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
yield this.adminforth.resource(this.options.sessionResource.resourceId).update(sessionId, {
|
|
77
|
+
[this.options.sessionResource.createdAtField]: new Date().toISOString(),
|
|
78
|
+
});
|
|
79
|
+
return { ok: true };
|
|
80
|
+
});
|
|
81
|
+
}
|
|
74
82
|
getSessionTurns(sessionId) {
|
|
75
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
84
|
const turns = yield this.adminforth.resource(this.options.turnResource.resourceId).list([Filters.EQ(this.options.turnResource.sessionIdField, sessionId)], undefined, undefined, [Sorts.ASC(this.options.turnResource.createdAtField)]);
|
|
@@ -134,6 +142,7 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
|
|
|
134
142
|
const userTimeZone = (_e = body.timeZone) !== null && _e !== void 0 ? _e : 'UTC';
|
|
135
143
|
const sessionId = body.sessionId || (adminUser === null || adminUser === void 0 ? void 0 : adminUser.pk) || (adminUser === null || adminUser === void 0 ? void 0 : adminUser.username) || 'default';
|
|
136
144
|
const turnId = yield this.createNewTurn(sessionId, prompt);
|
|
145
|
+
yield this.updateSessionDate(sessionId);
|
|
137
146
|
let fullResponse = "";
|
|
138
147
|
let isStreamClosed = false;
|
|
139
148
|
const sequenceDebugCollector = createSequenceDebugCollector();
|
package/index.ts
CHANGED
|
@@ -87,6 +87,13 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
|
|
|
87
87
|
return {ok: true};
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
private async updateSessionDate(sessionId: string) {
|
|
91
|
+
await this.adminforth.resource(this.options.sessionResource.resourceId).update(sessionId, {
|
|
92
|
+
[this.options.sessionResource.createdAtField]: new Date().toISOString(),
|
|
93
|
+
});
|
|
94
|
+
return {ok: true};
|
|
95
|
+
}
|
|
96
|
+
|
|
90
97
|
private async getSessionTurns(sessionId: string) {
|
|
91
98
|
const turns = await this.adminforth.resource(this.options.turnResource.resourceId).list(
|
|
92
99
|
[Filters.EQ(this.options.turnResource.sessionIdField, sessionId)],
|
|
@@ -150,6 +157,7 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
|
|
|
150
157
|
const userTimeZone = (body.timeZone as string | undefined) ?? 'UTC';
|
|
151
158
|
const sessionId = body.sessionId || adminUser?.pk || adminUser?.username || 'default';
|
|
152
159
|
const turnId = await this.createNewTurn(sessionId, prompt);
|
|
160
|
+
await this.updateSessionDate(sessionId);
|
|
153
161
|
let fullResponse = "";
|
|
154
162
|
let isStreamClosed = false;
|
|
155
163
|
const sequenceDebugCollector = createSequenceDebugCollector();
|