Skip to content

Commit 77f00a8

Browse files
committed
dev-demo: update agent plugins settings
1 parent 78a617e commit 77f00a8

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

dev-demo/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import BackgroundJobsPlugin from '../plugins/adminforth-background-jobs/index.js
2424

2525
import auditLogsResource from "./resources/auditLogs.js"
2626
import sessionsResource from "./resources/agent_resources/sessions.js";
27+
import turnsResource from './resources/agent_resources/turns.js';
2728
import { FICTIONAL_CAR_BRANDS, FICTIONAL_CAR_MODELS_BY_BRAND, ENGINE_TYPES, BODY_TYPES } from './custom/cars_data.js';
2829
import passkeysResource from './resources/passkeys.js';
2930
import carsDescriptionImage from './resources/cars_description_image.js';
@@ -137,7 +138,8 @@ export const admin = new AdminForth({
137138
carsDescriptionImage,
138139
translations,
139140
background_jobs_resource,
140-
sessionsResource
141+
sessionsResource,
142+
turnsResource
141143
],
142144
menu: [
143145
{ type: 'heading', label: 'SYSTEM' },
@@ -220,6 +222,11 @@ export const admin = new AdminForth({
220222
label: 'Agent Sessions',
221223
icon: 'heroicons:sparkles-solid',
222224
resourceId: 'sessions',
225+
},
226+
{
227+
label: 'Agent Turns',
228+
icon: 'heroicons:sparkles-solid',
229+
resourceId: 'turns',
223230
}
224231
],
225232
});

dev-demo/resources/adminuser.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,15 @@ export default {
206206
turnsField: 'turns',
207207
askerIdField: 'asker_id',
208208
createdAtField: 'created_at',
209-
}
209+
},
210+
turnResource: {
211+
resourceId: 'turns',
212+
idField: 'id',
213+
sessionIdField: 'session_id',
214+
createdAtField: 'created_at',
215+
promptField: 'prompt',
216+
responseField: 'response',
217+
},
210218
}),
211219
],
212220
hooks: {

dev-demo/resources/agent_resources/turns.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ export default {
2525
{
2626
name: 'created_at',
2727
type: AdminForthDataTypes.DATE,
28-
fillOnCreate: () => new Date(),
28+
fillOnCreate: ({ initialRecord, adminUser }) => (new Date()).toISOString(),
29+
showIn: {
30+
edit: false,
31+
create: false,
32+
}
2933
},
3034
{
3135
name: 'prompt',

0 commit comments

Comments
 (0)