create-blocklet 0.9.29 → 0.9.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/component-studio/package.json +4 -3
- package/templates/did-connect-dapp/package.json +3 -2
- package/templates/did-wallet-dapp/package.json +1 -1
- package/templates/express-api/package.json +2 -1
- package/templates/nextjs-dapp/package.json +2 -1
- package/templates/react-aigne-dapp/api/src/agents/chatbot.ts +5 -27
- package/templates/react-aigne-dapp/api/src/agents/index.ts +24 -1
- package/templates/react-aigne-dapp/api/src/index.ts +2 -8
- package/templates/react-aigne-dapp/package.json +7 -11
- package/templates/react-aigne-dapp/src/index.tsx +1 -2
- package/templates/react-aigne-dapp/src/pages/home.tsx +35 -32
- package/templates/react-dapp/package.json +3 -2
- package/templates/react-dapp-ts/package.json +3 -2
- package/templates/react-gun-dapp/package.json +3 -2
- package/templates/react-static/package.json +1 -1
- package/templates/solidjs-dapp/package.json +3 -2
- package/templates/solidjs-static/package.json +1 -1
- package/templates/svelte-dapp/package.json +3 -2
- package/templates/svelte-static/package.json +1 -1
- package/templates/todo-list-example/package.json +3 -2
- package/templates/vue-dapp/package.json +3 -2
- package/templates/vue-static/package.json +1 -1
- package/templates/vue-ts-static/package.json +1 -1
- package/templates/vue2-dapp/package.json +3 -2
- package/templates/vue2-static/package.json +1 -1
- package/templates/react-aigne-dapp/api/src/agents/runtime.ts +0 -16
- package/templates/react-aigne-dapp/api/src/agents/type.ts +0 -4
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"dev": "COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev",
|
|
14
14
|
"lint": "biome check . && tsc --noEmit",
|
|
15
|
+
"lint:skip": "echo 'skip lint'",
|
|
15
16
|
"lint:fix": "biome check --apply .",
|
|
16
17
|
"format": "biome format --write .",
|
|
17
18
|
"start": "vite-node -c vite-server.config.ts -w api/dev.ts",
|
|
@@ -32,8 +33,8 @@
|
|
|
32
33
|
},
|
|
33
34
|
"lint-staged": {
|
|
34
35
|
"*.{mjs,js,jsx,ts,tsx,css,less,scss,json,graphql}": [
|
|
35
|
-
"
|
|
36
|
-
"
|
|
36
|
+
"pnpm run format",
|
|
37
|
+
"pnpm run lint:skip"
|
|
37
38
|
]
|
|
38
39
|
},
|
|
39
40
|
"browserslist": {
|
|
@@ -97,7 +98,7 @@
|
|
|
97
98
|
"typescript": "^5.7.2",
|
|
98
99
|
"vite": "^5.4.11",
|
|
99
100
|
"vite-node": "^2.1.8",
|
|
100
|
-
"vite-plugin-blocklet": "^0.9.
|
|
101
|
+
"vite-plugin-blocklet": "^0.9.31",
|
|
101
102
|
"vite-plugin-require": "^1.2.14",
|
|
102
103
|
"vite-plugin-svgr": "^4.3.0",
|
|
103
104
|
"vite-tsconfig-paths": "^4.3.2",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"dev": "blocklet dev",
|
|
7
7
|
"lint": "eslint src api --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
8
8
|
"lint:fix": "npm run lint -- --fix",
|
|
9
|
-
"start": "cross-env NODE_ENV=development nodemon api/dev.js -w api",
|
|
9
|
+
"start": "cross-env NODE_ENV=development nodemon --exec tsx api/dev.js -w api",
|
|
10
10
|
"clean": "node scripts/build-clean.mjs",
|
|
11
11
|
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
12
12
|
"bundle:client": "vite build",
|
|
@@ -76,8 +76,9 @@
|
|
|
76
76
|
"react-dom": "~18.2.0",
|
|
77
77
|
"rimraf": "^5.0.10",
|
|
78
78
|
"simple-git-hooks": "^2.11.1",
|
|
79
|
+
"tsx": "^4.19.3",
|
|
79
80
|
"vite": "^5.4.14",
|
|
80
|
-
"vite-plugin-blocklet": "^0.9.
|
|
81
|
+
"vite-plugin-blocklet": "^0.9.31",
|
|
81
82
|
"vite-plugin-svgr": "^4.3.0",
|
|
82
83
|
"zx": "^8.3.2"
|
|
83
84
|
},
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"lint": "eslint api --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
9
9
|
"lint:fix": "npm run lint -- --fix",
|
|
10
10
|
"dev": "blocklet dev",
|
|
11
|
-
"start": "NODE_ENV=development nodemon api/index.js -w api",
|
|
11
|
+
"start": "NODE_ENV=development nodemon --exec tsx api/index.js -w api",
|
|
12
12
|
"clean": "node scripts/build-clean.mjs",
|
|
13
13
|
"bundle": "npm run clean && blocklet bundle --compact --create-release",
|
|
14
14
|
"deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"prettier": "^3.5.1",
|
|
48
48
|
"rimraf": "^5.0.10",
|
|
49
49
|
"simple-git-hooks": "^2.11.1",
|
|
50
|
+
"tsx": "^4.19.3",
|
|
50
51
|
"zx": "^8.3.2"
|
|
51
52
|
},
|
|
52
53
|
"simple-git-hooks": {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "blocklet dev",
|
|
7
|
-
"start": "nodemon -w api api/index.js",
|
|
7
|
+
"start": "nodemon --exec tsx -w api api/index.js",
|
|
8
8
|
"lint": "next lint",
|
|
9
9
|
"lint:fix": "npm run lint -- --fix",
|
|
10
10
|
"clean": "node scripts/build-clean.mjs",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"npm-run-all": "^4.1.5",
|
|
50
50
|
"rimraf": "^5.0.10",
|
|
51
51
|
"simple-git-hooks": "^2.11.1",
|
|
52
|
+
"tsx": "^4.19.3",
|
|
52
53
|
"zx": "^8.3.2"
|
|
53
54
|
},
|
|
54
55
|
"simple-git-hooks": {
|
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { runtime } from './runtime';
|
|
1
|
+
import { AIAgent } from '@aigne/core';
|
|
3
2
|
|
|
4
|
-
const chatbot =
|
|
5
|
-
context: runtime,
|
|
3
|
+
export const chatbot = AIAgent.from({
|
|
6
4
|
name: 'chatbot',
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
required: true,
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
modelOptions: {
|
|
14
|
-
model: 'gpt-4o',
|
|
15
|
-
temperature: 0.1,
|
|
16
|
-
},
|
|
17
|
-
messages: [
|
|
18
|
-
{ role: 'system', content: 'You are a AI chat bot' },
|
|
19
|
-
{ role: 'user', content: '{{question}}' },
|
|
20
|
-
],
|
|
21
|
-
outputs: {
|
|
22
|
-
$text: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
required: true,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
5
|
+
instructions:
|
|
6
|
+
'You are a helpful assistant. You can answer questions, provide information, and assist with various tasks.',
|
|
7
|
+
memory: true,
|
|
27
8
|
});
|
|
28
|
-
|
|
29
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
30
|
-
export { chatbot };
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { ExecutionEngine } from '@aigne/core';
|
|
2
|
+
import { OpenAIChatModel } from '@aigne/core/models/openai-chat-model';
|
|
3
|
+
import config from '@blocklet/sdk/lib/config';
|
|
4
|
+
import { Router } from 'express';
|
|
5
|
+
|
|
6
|
+
import { chatbot } from './chatbot';
|
|
7
|
+
|
|
8
|
+
const model = new OpenAIChatModel({
|
|
9
|
+
model: 'gpt-4o-mini',
|
|
10
|
+
apiKey: config.env.OPENAI_API_KEY || '',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const engine = new ExecutionEngine({
|
|
14
|
+
model,
|
|
15
|
+
agents: [chatbot],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const router = Router();
|
|
19
|
+
|
|
20
|
+
router.post('/chat', async (req, res) => {
|
|
21
|
+
const result = await engine.call(chatbot, req.body);
|
|
22
|
+
|
|
23
|
+
res.json(result);
|
|
24
|
+
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import 'express-async-errors';
|
|
2
|
-
import 'reflect-metadata';
|
|
3
2
|
import path from 'path';
|
|
4
3
|
|
|
5
4
|
import cookieParser from 'cookie-parser';
|
|
@@ -7,10 +6,8 @@ import cors from 'cors';
|
|
|
7
6
|
import dotenv from 'dotenv-flow';
|
|
8
7
|
import express, { ErrorRequestHandler } from 'express';
|
|
9
8
|
import fallback from '@blocklet/sdk/lib/middlewares/fallback';
|
|
10
|
-
import { createMiddleware } from '@aigne/runtime/middleware';
|
|
11
9
|
import logger from './libs/logger';
|
|
12
|
-
import {
|
|
13
|
-
import './agents';
|
|
10
|
+
import { router } from './agents';
|
|
14
11
|
|
|
15
12
|
dotenv.config();
|
|
16
13
|
|
|
@@ -24,10 +21,7 @@ app.use(express.json({ limit: '1 mb' }));
|
|
|
24
21
|
app.use(express.urlencoded({ extended: true, limit: '1 mb' }));
|
|
25
22
|
app.use(cors());
|
|
26
23
|
|
|
27
|
-
app.use(
|
|
28
|
-
|
|
29
|
-
const router = express.Router();
|
|
30
|
-
app.use(router);
|
|
24
|
+
app.use('/api', router);
|
|
31
25
|
|
|
32
26
|
const isProduction = process.env.NODE_ENV === 'production' || process.env.ABT_NODE_SERVICE_ENV === 'production';
|
|
33
27
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"dev": "blocklet dev",
|
|
7
7
|
"lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
8
8
|
"lint:fix": "npm run lint -- --fix",
|
|
9
|
-
"start": "cross-env NODE_ENV=development nodemon api/dev.ts -w api",
|
|
9
|
+
"start": "cross-env NODE_ENV=development nodemon --exec tsx api/dev.ts -w api",
|
|
10
10
|
"clean": "node scripts/build-clean.mjs",
|
|
11
11
|
"bundle": "tsc --noEmit && npm run bundle:client && npm run bundle:api",
|
|
12
12
|
"bundle:client": "vite build",
|
|
@@ -38,9 +38,7 @@
|
|
|
38
38
|
]
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@aigne/core": "1.0
|
|
42
|
-
"@aigne/memory": "1.0.8",
|
|
43
|
-
"@aigne/runtime": "1.0.8",
|
|
41
|
+
"@aigne/core": "^1.5.0",
|
|
44
42
|
"@arcblock/did-auth": "^1.19.15",
|
|
45
43
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
46
44
|
"@arcblock/did-connect": "^2.12.17",
|
|
@@ -63,7 +61,6 @@
|
|
|
63
61
|
"react-markdown": "^9.1.0",
|
|
64
62
|
"react-scroll-to-bottom": "^4.2.0",
|
|
65
63
|
"react-syntax-highlighter": "^15.6.1",
|
|
66
|
-
"reflect-metadata": "^0.2.2",
|
|
67
64
|
"remark-gfm": "^4.0.1",
|
|
68
65
|
"ufo": "^1.5.4"
|
|
69
66
|
},
|
|
@@ -96,17 +93,13 @@
|
|
|
96
93
|
"rimraf": "^5.0.10",
|
|
97
94
|
"simple-git-hooks": "^2.11.1",
|
|
98
95
|
"ts-node": "^10.9.2",
|
|
96
|
+
"tsx": "^4.19.3",
|
|
99
97
|
"typescript": "^5.7.3",
|
|
100
98
|
"vite": "^5.4.14",
|
|
101
|
-
"vite-plugin-blocklet": "^0.9.
|
|
99
|
+
"vite-plugin-blocklet": "^0.9.31",
|
|
102
100
|
"vite-plugin-svgr": "^4.3.0",
|
|
103
101
|
"zx": "^8.3.2"
|
|
104
102
|
},
|
|
105
|
-
"resolutions": {
|
|
106
|
-
"@aigne/core": "1.0.8",
|
|
107
|
-
"@aigne/memory": "1.0.8",
|
|
108
|
-
"@aigne/runtime": "1.0.8"
|
|
109
|
-
},
|
|
110
103
|
"importSort": {
|
|
111
104
|
".js, .jsx, .mjs": {
|
|
112
105
|
"parser": "babylon",
|
|
@@ -119,5 +112,8 @@
|
|
|
119
112
|
},
|
|
120
113
|
"simple-git-hooks": {
|
|
121
114
|
"pre-commit": "npx lint-staged"
|
|
115
|
+
},
|
|
116
|
+
"resolutions": {
|
|
117
|
+
"pkce-challenge": "^5.0.0"
|
|
122
118
|
}
|
|
123
119
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { createFetch } from '@blocklet/js-sdk';
|
|
2
|
+
import Header from '@blocklet/ui-react/lib/Header';
|
|
3
3
|
import { SendRounded } from '@mui/icons-material';
|
|
4
4
|
import {
|
|
5
5
|
Alert,
|
|
@@ -16,16 +16,17 @@ import {
|
|
|
16
16
|
import { produce } from 'immer';
|
|
17
17
|
import { nanoid } from 'nanoid';
|
|
18
18
|
import React, { memo, useState } from 'react';
|
|
19
|
-
import Header from '@blocklet/ui-react/lib/Header';
|
|
20
19
|
|
|
21
|
-
import
|
|
20
|
+
import blockletLogo from '../assets/blocklet.svg';
|
|
22
21
|
import MarkdownRenderer from '../components/MarkdownRenderer';
|
|
23
22
|
import ScrollView from '../components/ScrollView';
|
|
24
|
-
import './home.css';
|
|
25
|
-
import blockletLogo from '../assets/blocklet.svg';
|
|
26
23
|
import { useSessionContext } from '../contexts/session';
|
|
24
|
+
import './home.css';
|
|
25
|
+
|
|
26
|
+
const fetch = createFetch();
|
|
27
27
|
|
|
28
|
-
interface MessageItem
|
|
28
|
+
interface MessageItem {
|
|
29
|
+
$message: string;
|
|
29
30
|
id: string;
|
|
30
31
|
question?: string;
|
|
31
32
|
loading?: boolean;
|
|
@@ -34,7 +35,7 @@ interface MessageItem extends ChatbotResponse {
|
|
|
34
35
|
|
|
35
36
|
export default function Home() {
|
|
36
37
|
const [question, setQuestion] = useState('');
|
|
37
|
-
const [messages, setMessages] = useState<
|
|
38
|
+
const [messages, setMessages] = useState<MessageItem[]>([]);
|
|
38
39
|
const { session } = useSessionContext();
|
|
39
40
|
|
|
40
41
|
const run = async (e: React.FormEvent) => {
|
|
@@ -49,39 +50,42 @@ export default function Home() {
|
|
|
49
50
|
const message: MessageItem = {
|
|
50
51
|
id: nanoid(),
|
|
51
52
|
question,
|
|
52
|
-
$
|
|
53
|
+
$message: '',
|
|
53
54
|
loading: true,
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
setMessages((prev) =>
|
|
57
|
+
setMessages((prev) =>
|
|
58
|
+
produce(prev, (draft) => {
|
|
59
|
+
draft.push(message);
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
57
62
|
|
|
58
63
|
try {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
64
|
+
const result = await fetch('/api/chat', {
|
|
65
|
+
method: 'POST',
|
|
66
|
+
headers: { 'Content-Type': 'application/json' },
|
|
67
|
+
body: JSON.stringify({
|
|
68
|
+
$message: question,
|
|
69
|
+
}),
|
|
70
|
+
}).then((res) => res.json());
|
|
71
|
+
|
|
72
|
+
setMessages((prev) =>
|
|
73
|
+
produce(prev, (draft) => {
|
|
74
|
+
const m = draft.find((i) => i.id === message.id)!;
|
|
75
|
+
Object.assign(m, result);
|
|
76
|
+
}),
|
|
77
|
+
);
|
|
74
78
|
} catch (error) {
|
|
75
79
|
setMessages((prev) =>
|
|
76
80
|
produce(prev, (draft) => {
|
|
77
|
-
const m = draft
|
|
81
|
+
const m = draft.find((i) => i.id === message.id)!;
|
|
78
82
|
m.error = error;
|
|
79
83
|
}),
|
|
80
84
|
);
|
|
81
85
|
} finally {
|
|
82
86
|
setMessages((prev) =>
|
|
83
87
|
produce(prev, (draft) => {
|
|
84
|
-
const m = draft
|
|
88
|
+
const m = draft.find((i) => i.id === message.id)!;
|
|
85
89
|
m.loading = false;
|
|
86
90
|
}),
|
|
87
91
|
);
|
|
@@ -110,7 +114,7 @@ export default function Home() {
|
|
|
110
114
|
|
|
111
115
|
<Container sx={{ display: 'flex', flexDirection: 'column', py: 3 }} maxWidth="md">
|
|
112
116
|
<Stack sx={{ flex: 1, height: 0, display: 'flex', flexDirection: 'column', gap: 3, mb: 5 }}>
|
|
113
|
-
{
|
|
117
|
+
{messages.map((message) => (
|
|
114
118
|
<MessageView key={message.id} message={message} />
|
|
115
119
|
))}
|
|
116
120
|
</Stack>
|
|
@@ -158,16 +162,15 @@ const MessageView = memo(({ message }: { message: MessageItem }) => {
|
|
|
158
162
|
<Stack direction="row" gap={2}>
|
|
159
163
|
<Avatar>🤖</Avatar>
|
|
160
164
|
<Stack flex={1} pt={1} gap={2}>
|
|
161
|
-
{message.$
|
|
165
|
+
{message.$message && (
|
|
162
166
|
<Stack gap={1}>
|
|
163
|
-
<MarkdownRenderer citations={[]}>{message.$
|
|
167
|
+
<MarkdownRenderer citations={[]}>{message.$message}</MarkdownRenderer>
|
|
164
168
|
</Stack>
|
|
165
169
|
)}
|
|
166
170
|
|
|
167
|
-
{message.loading &&
|
|
171
|
+
{message.loading && (
|
|
168
172
|
<Stack direction="row" gap={2} alignItems="center">
|
|
169
173
|
<CircularProgress size={16} />
|
|
170
|
-
<Typography variant="caption">{message.status.message}</Typography>
|
|
171
174
|
</Stack>
|
|
172
175
|
)}
|
|
173
176
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"dev": "blocklet dev",
|
|
7
7
|
"lint": "eslint src api --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
8
8
|
"lint:fix": "npm run lint -- --fix",
|
|
9
|
-
"start": "cross-env NODE_ENV=development nodemon api/dev.js -w api",
|
|
9
|
+
"start": "cross-env NODE_ENV=development nodemon --exec tsx api/dev.js -w api",
|
|
10
10
|
"clean": "node scripts/build-clean.mjs",
|
|
11
11
|
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
12
12
|
"bundle:client": "vite build",
|
|
@@ -70,8 +70,9 @@
|
|
|
70
70
|
"react-router-dom": "^6.29.0",
|
|
71
71
|
"rimraf": "^5.0.10",
|
|
72
72
|
"simple-git-hooks": "^2.11.1",
|
|
73
|
+
"tsx": "^4.19.3",
|
|
73
74
|
"vite": "^5.4.14",
|
|
74
|
-
"vite-plugin-blocklet": "^0.9.
|
|
75
|
+
"vite-plugin-blocklet": "^0.9.31",
|
|
75
76
|
"vite-plugin-svgr": "^4.3.0",
|
|
76
77
|
"zx": "^8.3.2"
|
|
77
78
|
},
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"dev": "blocklet dev",
|
|
7
7
|
"lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
8
8
|
"lint:fix": "npm run lint -- --fix",
|
|
9
|
-
"start": "cross-env NODE_ENV=development nodemon api/dev.ts -w api",
|
|
9
|
+
"start": "cross-env NODE_ENV=development nodemon --exec tsx api/dev.ts -w api",
|
|
10
10
|
"clean": "node scripts/build-clean.mjs",
|
|
11
11
|
"bundle": "tsc --noEmit && npm run bundle:client && npm run bundle:api",
|
|
12
12
|
"bundle:client": "vite build",
|
|
@@ -79,9 +79,10 @@
|
|
|
79
79
|
"rimraf": "^5.0.10",
|
|
80
80
|
"simple-git-hooks": "^2.11.1",
|
|
81
81
|
"ts-node": "^10.9.2",
|
|
82
|
+
"tsx": "^4.19.3",
|
|
82
83
|
"typescript": "^5.7.3",
|
|
83
84
|
"vite": "^5.4.14",
|
|
84
|
-
"vite-plugin-blocklet": "^0.9.
|
|
85
|
+
"vite-plugin-blocklet": "^0.9.31",
|
|
85
86
|
"vite-plugin-svgr": "^4.3.0",
|
|
86
87
|
"zx": "^8.3.2"
|
|
87
88
|
},
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"dev": "blocklet dev",
|
|
7
7
|
"lint": "eslint src api --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
8
8
|
"lint:fix": "npm run lint -- --fix",
|
|
9
|
-
"start": "cross-env NODE_ENV=development nodemon api/dev.js -w api",
|
|
9
|
+
"start": "cross-env NODE_ENV=development nodemon --exec tsx api/dev.js -w api",
|
|
10
10
|
"clean": "node scripts/build-clean.mjs",
|
|
11
11
|
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
12
12
|
"bundle:client": "vite build",
|
|
@@ -70,8 +70,9 @@
|
|
|
70
70
|
"react-router-dom": "^6.29.0",
|
|
71
71
|
"rimraf": "^5.0.10",
|
|
72
72
|
"simple-git-hooks": "^2.11.1",
|
|
73
|
+
"tsx": "^4.19.3",
|
|
73
74
|
"vite": "^5.4.14",
|
|
74
|
-
"vite-plugin-blocklet": "^0.9.
|
|
75
|
+
"vite-plugin-blocklet": "^0.9.31",
|
|
75
76
|
"vite-plugin-svgr": "^4.3.0",
|
|
76
77
|
"zx": "^8.3.2"
|
|
77
78
|
},
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "blocklet dev",
|
|
8
|
-
"start": "cross-env NODE_ENV=development nodemon api/dev.js -w api",
|
|
8
|
+
"start": "cross-env NODE_ENV=development nodemon --exec tsx api/dev.js -w api",
|
|
9
9
|
"clean": "node scripts/build-clean.mjs",
|
|
10
10
|
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
11
11
|
"bundle:client": "vite build",
|
|
@@ -35,8 +35,9 @@
|
|
|
35
35
|
"prettier": "^3.5.1",
|
|
36
36
|
"rimraf": "^5.0.10",
|
|
37
37
|
"simple-git-hooks": "^2.11.1",
|
|
38
|
+
"tsx": "^4.19.3",
|
|
38
39
|
"vite": "^5.4.14",
|
|
39
|
-
"vite-plugin-blocklet": "^0.9.
|
|
40
|
+
"vite-plugin-blocklet": "^0.9.31",
|
|
40
41
|
"vite-plugin-solid": "^2.11.2",
|
|
41
42
|
"zx": "^8.3.2"
|
|
42
43
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "blocklet dev",
|
|
7
|
-
"start": "cross-env NODE_ENV=development nodemon api/dev.js -w api",
|
|
7
|
+
"start": "cross-env NODE_ENV=development nodemon --exec tsx api/dev.js -w api",
|
|
8
8
|
"clean": "node scripts/build-clean.mjs",
|
|
9
9
|
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
10
10
|
"bundle:client": "vite build",
|
|
@@ -43,8 +43,9 @@
|
|
|
43
43
|
"rimraf": "^5.0.10",
|
|
44
44
|
"simple-git-hooks": "^2.11.1",
|
|
45
45
|
"svelte": "^4.2.19",
|
|
46
|
+
"tsx": "^4.19.3",
|
|
46
47
|
"vite": "^5.4.14",
|
|
47
|
-
"vite-plugin-blocklet": "^0.9.
|
|
48
|
+
"vite-plugin-blocklet": "^0.9.31",
|
|
48
49
|
"zx": "^8.3.2",
|
|
49
50
|
"nodemon": "^3.1.9"
|
|
50
51
|
},
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"dev": "blocklet dev",
|
|
7
7
|
"lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
8
8
|
"lint:fix": "npm run lint -- --fix",
|
|
9
|
-
"start": "cross-env NODE_ENV=development nodemon api/dev.ts -w api",
|
|
9
|
+
"start": "cross-env NODE_ENV=development nodemon --exec tsx api/dev.ts -w api",
|
|
10
10
|
"clean": "node scripts/build-clean.mjs",
|
|
11
11
|
"bundle": "tsc --noEmit && npm run bundle:client && npm run bundle:api",
|
|
12
12
|
"bundle:client": "vite build",
|
|
@@ -94,9 +94,10 @@
|
|
|
94
94
|
"rimraf": "^5.0.10",
|
|
95
95
|
"simple-git-hooks": "^2.11.1",
|
|
96
96
|
"ts-node": "^10.9.2",
|
|
97
|
+
"tsx": "^4.19.3",
|
|
97
98
|
"typescript": "^5.7.3",
|
|
98
99
|
"vite": "^5.4.14",
|
|
99
|
-
"vite-plugin-blocklet": "^0.9.
|
|
100
|
+
"vite-plugin-blocklet": "^0.9.31",
|
|
100
101
|
"vite-plugin-svgr": "^4.3.0",
|
|
101
102
|
"zx": "^8.3.2"
|
|
102
103
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "blocklet dev",
|
|
7
|
-
"start": "cross-env NODE_ENV=development nodemon api/dev.js -w api",
|
|
7
|
+
"start": "cross-env NODE_ENV=development nodemon --exec tsx api/dev.js -w api",
|
|
8
8
|
"clean": "node scripts/build-clean.mjs",
|
|
9
9
|
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
10
10
|
"bundle:client": "vite build",
|
|
@@ -48,8 +48,9 @@
|
|
|
48
48
|
"prettier": "^3.5.1",
|
|
49
49
|
"rimraf": "^5.0.10",
|
|
50
50
|
"simple-git-hooks": "^2.11.1",
|
|
51
|
+
"tsx": "^4.19.3",
|
|
51
52
|
"vite": "^5.4.14",
|
|
52
|
-
"vite-plugin-blocklet": "^0.9.
|
|
53
|
+
"vite-plugin-blocklet": "^0.9.31",
|
|
53
54
|
"vue": "^3.5.13",
|
|
54
55
|
"zx": "^8.3.2"
|
|
55
56
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "blocklet dev",
|
|
7
|
-
"start": "cross-env NODE_ENV=development nodemon api/dev.js -w api",
|
|
7
|
+
"start": "cross-env NODE_ENV=development nodemon --exec tsx api/dev.js -w api",
|
|
8
8
|
"clean": "node scripts/build-clean.mjs",
|
|
9
9
|
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
10
10
|
"bundle:client": "vite build",
|
|
@@ -47,8 +47,9 @@
|
|
|
47
47
|
"prettier": "^3.5.1",
|
|
48
48
|
"rimraf": "^5.0.10",
|
|
49
49
|
"simple-git-hooks": "^2.11.1",
|
|
50
|
+
"tsx": "^4.19.3",
|
|
50
51
|
"vite": "^5.4.14",
|
|
51
|
-
"vite-plugin-blocklet": "^0.9.
|
|
52
|
+
"vite-plugin-blocklet": "^0.9.31",
|
|
52
53
|
"vue": "^2.7.16",
|
|
53
54
|
"zx": "^8.3.2"
|
|
54
55
|
},
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { OpenaiLLMModel } from '@aigne/core';
|
|
2
|
-
import { AIGNERuntime } from '@aigne/runtime';
|
|
3
|
-
import config from '@blocklet/sdk/lib/config';
|
|
4
|
-
|
|
5
|
-
export const llmModel = new OpenaiLLMModel({
|
|
6
|
-
model: 'gpt-4o-mini',
|
|
7
|
-
apiKey: config.env.OPENAI_API_KEY || '',
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export const runtime = new AIGNERuntime({
|
|
11
|
-
llmModel,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
config.events.on(config.Events.envUpdate, () => {
|
|
15
|
-
llmModel.setApiKey(config.env.OPENAI_API_KEY || '');
|
|
16
|
-
});
|