Skip to content

Commit e4a4a1e

Browse files
committed
dev-demo: add sessions resource to the agent plugin
1 parent dc78655 commit e4a4a1e

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

dev-demo/index.ts

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

2525
import auditLogsResource from "./resources/auditLogs.js"
26+
import sessionsResource from "./resources/agent_resources/sessions.js";
2627
import { FICTIONAL_CAR_BRANDS, FICTIONAL_CAR_MODELS_BY_BRAND, ENGINE_TYPES, BODY_TYPES } from './custom/cars_data.js';
2728
import passkeysResource from './resources/passkeys.js';
2829
import carsDescriptionImage from './resources/cars_description_image.js';
@@ -135,7 +136,8 @@ export const admin = new AdminForth({
135136
passkeysResource,
136137
carsDescriptionImage,
137138
translations,
138-
background_jobs_resource
139+
background_jobs_resource,
140+
sessionsResource
139141
],
140142
menu: [
141143
{ type: 'heading', label: 'SYSTEM' },
@@ -207,6 +209,11 @@ export const admin = new AdminForth({
207209
label: 'Background Jobs',
208210
icon: 'flowbite:briefcase-solid',
209211
resourceId: 'jobs',
212+
},
213+
{
214+
label: 'Agent Sessions',
215+
icon: 'heroicons:sparkles-solid',
216+
resourceId: 'sessions',
210217
}
211218
],
212219
});

dev-demo/resources/adminuser.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ export default {
199199
}),
200200
maxTokens: 10000,
201201
reasoning: 'high',
202+
sessionResource: {
203+
resource_id: 'sessions',
204+
id_field: 'id',
205+
title_field: 'title',
206+
turns_field: 'turns',
207+
asker_id_field: 'asker_id',
208+
created_at_field: 'created_at',
209+
}
202210
}),
203211
],
204212
hooks: {

dev-demo/resources/agent_resources/sessions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export default {
3434
name: 'created_at',
3535
type: AdminForthDataTypes.DATE,
3636
fillOnCreate: () => new Date(),
37+
showIn: {
38+
edit: false,
39+
create: false,
40+
}
3741
}
3842
],
3943
} as AdminForthResourceInput;

0 commit comments

Comments
 (0)