Skip to content

Commit 19b9c53

Browse files
committed
Merge branch 'main' of github.com:devforth/adminforth
2 parents 1036476 + 33f3686 commit 19b9c53

7 files changed

Lines changed: 143 additions & 101 deletions

File tree

‎adminforth/spa/src/views/LoginView.vue‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@
3232
class="af-login-modal overflow-y-auto flex flex-grow
3333
overflow-x-hidden z-50 min-w-[350px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
3434
<div class="relative p-4 w-full max-h-full max-w-[400px]">
35+
<!-- dropdowns of the injections (the language select) open past the card edge;
36+
the card has no footer whose corners the panel would have to clip -->
3537
<DialogPanel
36-
class="af-login-popup af-login-modal-content max-w-none bg-lightLoginViewBackground dark:bg-darkLoginViewBackground"
38+
class="af-login-popup af-login-modal-content max-w-none overflow-visible bg-lightLoginViewBackground dark:bg-darkLoginViewBackground"
3739
:error="error"
3840
:classes="{
3941
header: 'af-login-modal-header',

‎live-demo/app/globalPlugins.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export const adminForthAgent = new AdminForthAgent({
7676
promptField: 'prompt',
7777
responseField: 'response',
7878
checkpointIdField: 'checkpoint_id',
79+
attachmentsField: 'attachments',
7980
},
8081
checkpointResource: {
8182
resourceId: 'agent_checkpoints',
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "turns" ADD COLUMN "attachments" TEXT;

‎live-demo/app/package.json‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"scripts": {
1010
"dev": "pnpm setup-live-demo && pnpm start",
1111
"setup-live-demo": "[ -f .env ] || (cp .env.example .env && echo 'Created .env from .env.example, put OPENAI_API_KEY into it and run again' && exit 1) && pnpm install && pnpm migrate",
12-
"start": "tsx --env-file=.env --watch index.ts",
12+
"start": "tsx watch --env-file=.env index.ts",
1313
"test": "echo \"Error: no test specified\" && exit 1",
1414
"bundleNow": "tsx bundleNow.ts",
1515
"build": "tsup index.ts --format esm --clean",
@@ -22,7 +22,7 @@
2222
"author": "",
2323
"description": "",
2424
"dependencies": {
25-
"@adminforth/agent": "^3.2.0",
25+
"@adminforth/agent": "^3.5.0",
2626
"@adminforth/audio-adapter-openai": "^1.3.5",
2727
"@adminforth/audit-log": "^2.0.2",
2828
"@adminforth/auto-remove": "^1.0.22",
@@ -43,11 +43,11 @@
4343
"@adminforth/login-captcha-adapter-cloudflare": "^1.1.7",
4444
"@adminforth/mcp": "^3.2.0",
4545
"@adminforth/rich-editor": "^3.0.4",
46-
"@adminforth/storage-adapter-amazon-s3": "^1.2.2",
46+
"@adminforth/storage-adapter-amazon-s3": "^1.3.0",
4747
"@adminforth/text-complete": "^3.0.2",
4848
"@adminforth/two-factors-auth": "^7.1.0",
49-
"@adminforth/upload": "^3.0.4",
50-
"adminforth": "^4.20.0",
49+
"@adminforth/upload": "^3.0.10",
50+
"adminforth": "^4.22.3",
5151
"cldr-core": "^48.2.0",
5252
"express": "^5.3.0"
5353
},

‎live-demo/app/pnpm-lock.yaml‎

Lines changed: 98 additions & 95 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎live-demo/app/resources/agent_resources/turns.ts‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { AdminForthDataTypes } from 'adminforth';
22
import type { AdminForthResourceInput, AdminUser } from 'adminforth';
33
import { randomUUID } from 'crypto';
4+
import UploadPlugin from '@adminforth/upload';
5+
import AdminForthAdapterS3Storage from '@adminforth/storage-adapter-amazon-s3';
46

57
async function allowedForSuperAdmins({ adminUser }: { adminUser: AdminUser }): Promise<boolean> {
68
return adminUser.dbUser.role === 'superadmin';
@@ -54,6 +56,37 @@ const turnsResource: AdminForthResourceInput = {
5456
filter: false,
5557
},
5658
},
59+
{
60+
name: 'attachments',
61+
type: AdminForthDataTypes.JSON,
62+
isArray: {
63+
enabled: true,
64+
itemType: AdminForthDataTypes.STRING,
65+
},
66+
showIn: {
67+
list: false,
68+
show: true,
69+
edit: false,
70+
create: false,
71+
filter: false,
72+
},
73+
},
74+
],
75+
plugins: [
76+
// images users send to the agent; private, the agent and the chat read them with signed URLs
77+
new UploadPlugin({
78+
pathColumnName: 'attachments',
79+
storageAdapter: new AdminForthAdapterS3Storage({
80+
bucket: 'demo-static.adminforth.dev',
81+
region: 'eu-north-1',
82+
accessKeyId: process.env.AWS_ACCESS_KEY_ID as string,
83+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY as string,
84+
strictContentType: true,
85+
}),
86+
allowedFileExtensions: ['png', 'jpg', 'jpeg', 'webp'],
87+
maxFileSize: 1024 * 1024 * 5,
88+
filePath: ({ originalExtension }) => `agent_attachments/${randomUUID()}.${originalExtension}`,
89+
}),
5790
],
5891
options: {
5992
allowedActions: {

‎live-demo/app/schema.prisma‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ model turns {
7272
prompt String?
7373
response String?
7474
checkpoint_id String?
75+
attachments String?
7576
}
7677

7778
model mcp_auth_secrets {

0 commit comments

Comments
 (0)