Skip to content

Commit e9506c9

Browse files
committed
[poketto] fixed build
1 parent e6f3215 commit e9506c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1053
-510
lines changed

apps/poketto-web/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# has secrets
2-
data/next-auth/login/*
2+
scripts/data/next-auth/login/*
33

44
.env
55

apps/poketto-web/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"@cs-magic/react": "workspace:^",
2121
"@cs-magic/shadcn": "workspace:^",
2222
"@hookform/resolvers": "*",
23+
"@langchain/community": "^0.3.4",
24+
"@langchain/openai": "^0.3.5",
2325
"@mantine/hooks": "^6.0.18",
2426
"@next-auth/prisma-adapter": "^1.0.5",
2527
"@next/bundle-analyzer": "^13.4.19",
@@ -118,7 +120,9 @@
118120
"eslint": "^9.9.1",
119121
"i18next-resources-for-ts": "^1.3.0",
120122
"jest": "^29.6.3",
123+
"mongodb": "^6.9.0",
121124
"net": "^1.0.2",
125+
"npm-run-all": "^4.1.5",
122126
"pino-pretty": "*",
123127
"postcss": "^8.4.21",
124128
"prettier": "*",

apps/poketto-web/scripts/init-flowgpt-data.ts

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
1-
import { Prisma } from "@prisma/client"
2-
import { MongoClient } from "mongodb"
1+
import { Prisma } from "@prisma/client";
2+
import { MongoClient } from "mongodb";
33

4-
import { prisma } from "@cs-magic/common/dist/db/prisma"
4+
import { prisma } from "@cs-magic/common/db/prisma";
55

6-
import type sampleBasicPrompt from "./data/flowgpt/prompt-basic_2.json"
6+
import type sampleBasicPrompt from "./data/flowgpt/prompt-basic_2.json";
77

8-
import AppPromptsCreateManyAppInput = Prisma.AppPromptsCreateManyAppInput
9-
10-
export type IFlowgptPromptBasic = typeof sampleBasicPrompt
8+
export type IFlowgptPromptBasic = typeof sampleBasicPrompt;
119

1210
const init = async () => {
13-
const mongoClient = new MongoClient("mongodb://localhost")
11+
const mongoClient = new MongoClient("mongodb://localhost");
1412

15-
let p
13+
let p;
1614
try {
17-
console.log("initializing flowgpt apps")
18-
let k = 0
19-
for await (p of mongoClient.db("flowgpt").collection("basic").find() as unknown as IFlowgptPromptBasic[]) {
20-
const appPrompts: AppPromptsCreateManyAppInput[] = []
15+
console.log("initializing flowgpt apps");
16+
let k = 0;
17+
for await (p of mongoClient
18+
.db("flowgpt")
19+
.collection("basic")
20+
.find() as unknown as IFlowgptPromptBasic[]) {
21+
const appPrompts: Prisma.PokettoAppPromptsCreateManyAppInput[] = [];
2122
if (p.systemMessage)
2223
appPrompts.push({
2324
role: "system",
2425
content: p.systemMessage,
25-
})
26+
});
2627
if (p.initPrompt)
2728
appPrompts.push({
2829
role: "user",
2930
content: p.initPrompt,
30-
})
31+
});
3132
if (p.welcomeMessage)
3233
appPrompts.push({
3334
role: "assistant",
3435
content: p.welcomeMessage,
35-
})
36+
});
3637
// console.log({ p })
3738

3839
// 不能直接用 new PrismaClient 应该
3940

40-
await prisma.app.upsert({
41+
await prisma.pokettoApp.upsert({
4142
where: { platform: { platformId: p.id, platformType: "FlowGPT" } },
4243
update: {},
4344
create: {
@@ -92,18 +93,18 @@ const init = async () => {
9293
})),
9394
},
9495
},
95-
})
96+
});
9697
if (++k % 100 === 0) {
97-
console.log(`dumping ${k}`)
98+
console.log(`dumping ${k}`);
9899
}
99100
}
100101

101-
console.log("successfully initialized")
102+
console.log("successfully initialized");
102103
} catch (e) {
103-
console.error({ e, p })
104+
console.error({ e, p });
104105
} finally {
105-
await mongoClient.close()
106+
await mongoClient.close();
106107
}
107-
}
108+
};
108109

109-
void init()
110+
void init();

0 commit comments

Comments
 (0)