Skip to content

Commit 6fa89c6

Browse files
committed
merge migrations
1 parent e44fc55 commit 6fa89c6

4 files changed

Lines changed: 62 additions & 26 deletions

File tree

Taskfile.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: '3'
2+
3+
tasks:
4+
update-adminforth-version:
5+
desc: "Update adminforth peer/dev dependency version in all plugins and adapters"
6+
vars:
7+
VERSION: '{{.VERSION | default ""}}'
8+
preconditions:
9+
- sh: '[ -n "{{.VERSION}}" ]'
10+
msg: "VERSION is required. Run: task update-adminforth-version VERSION=1.2.3"
11+
cmds:
12+
- |
13+
for dir in plugins/*/ adapters/*/; do
14+
pkg="$dir/package.json"
15+
[ -f "$pkg" ] || continue
16+
node -e "
17+
const fs = require('fs');
18+
const p = JSON.parse(fs.readFileSync('$pkg'));
19+
let changed = false;
20+
if (p.peerDependencies?.adminforth) { p.peerDependencies.adminforth = '^{{.VERSION}}'; changed = true; }
21+
if (p.devDependencies?.adminforth) { p.devDependencies.adminforth = '^{{.VERSION}}'; changed = true; }
22+
if (changed) {
23+
fs.writeFileSync('$pkg', JSON.stringify(p, null, 2) + '\n');
24+
console.log('updated: $pkg');
25+
}
26+
"
27+
done
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "translations" ADD COLUMN "listed" BOOLEAN;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `listed` on the `translations` table. All the data in the column will be lost.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "adminuser" ADD COLUMN "cars" TEXT;
9+
10+
-- RedefineTables
11+
PRAGMA defer_foreign_keys=ON;
12+
PRAGMA foreign_keys=OFF;
13+
CREATE TABLE "new_translations" (
14+
"id" TEXT NOT NULL PRIMARY KEY,
15+
"en_string" TEXT NOT NULL,
16+
"created_at" DATETIME NOT NULL,
17+
"uk_string" TEXT,
18+
"ja_string" TEXT,
19+
"fr_string" TEXT,
20+
"es_string" TEXT,
21+
"ptBR_string" TEXT,
22+
"category" TEXT NOT NULL,
23+
"source" TEXT,
24+
"completedLangs" TEXT
25+
);
26+
INSERT INTO "new_translations" ("category", "completedLangs", "created_at", "en_string", "es_string", "fr_string", "id", "ja_string", "ptBR_string", "source", "uk_string") SELECT "category", "completedLangs", "created_at", "en_string", "es_string", "fr_string", "id", "ja_string", "ptBR_string", "source", "uk_string" FROM "translations";
27+
DROP TABLE "translations";
28+
ALTER TABLE "new_translations" RENAME TO "translations";
29+
CREATE INDEX "translations_en_string_category_idx" ON "translations"("en_string", "category");
30+
CREATE INDEX "translations_category_idx" ON "translations"("category");
31+
CREATE INDEX "translations_completedLangs_idx" ON "translations"("completedLangs");
32+
PRAGMA foreign_keys=ON;
33+
PRAGMA defer_foreign_keys=OFF;

dev-demo/resources/adminuser.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import AdminForthAdapterGoogleOauth2 from '../../adapters/adminforth-oauth-adapt
1010
import OpenSignupPlugin from '../../plugins/adminforth-open-signup/index.js';
1111
import OAuthPlugin from '../../plugins/adminforth-oauth/index.js';
1212
import KeyValueAdapterRam from '../../adapters/adminforth-key-value-adapter-ram/index.js';
13-
import AdminForthAgent from '../../plugins/adminforth-agent/index.js';
1413
import CompletionAdapterOpenAIChatGPT from '../../adapters/adminforth-completion-adapter-open-ai-chat-gpt/index.js';
1514

1615
async function allowedForSuperAdmin({ adminUser }: { adminUser: AdminUser }): Promise<boolean> {
@@ -192,31 +191,6 @@ export default {
192191
},
193192
},
194193
}),
195-
new AdminForthAgent({
196-
completionAdapter: new CompletionAdapterOpenAIChatGPT({
197-
openAiApiKey: process.env.OPENAI_API_KEY as string,
198-
model: 'gpt-5-mini',
199-
}),
200-
maxTokens: 10000,
201-
reasoning: 'none',
202-
sessionResource: {
203-
resourceId: 'sessions',
204-
idField: 'id',
205-
titleField: 'title',
206-
turnsField: 'turns',
207-
askerIdField: 'asker_id',
208-
createdAtField: 'created_at',
209-
},
210-
turnResource: {
211-
resourceId: 'turns',
212-
idField: 'id',
213-
sessionIdField: 'session_id',
214-
createdAtField: 'created_at',
215-
promptField: 'prompt',
216-
responseField: 'response',
217-
debugField: 'dubbug',
218-
},
219-
}),
220194
],
221195
hooks: {
222196
create: {

0 commit comments

Comments
 (0)