@maiyunnet/kebab 3.2.21 → 3.2.22
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/index.d.ts +15 -1
- package/index.js +1 -1
- package/lib/ai.d.ts +36 -0
- package/lib/ai.js +62 -0
- package/lib/kv.d.ts +11 -2
- package/lib/kv.js +9 -6
- package/lib/s3.d.ts +1 -1
- package/lib/s3.js +1 -1
- package/lib/ws.js +5 -0
- package/package.json +6 -5
- package/sys/child.js +1 -1
- package/sys/cmd.js +13 -0
- package/www/example/ctr/test.d.ts +1 -0
- package/www/example/ctr/test.js +33 -7
package/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
6
6
|
*/
|
|
7
7
|
/** --- 当前系统版本号 --- */
|
|
8
|
-
export declare const VER = "3.2.
|
|
8
|
+
export declare const VER = "3.2.22";
|
|
9
9
|
/** --- 框架根目录,以 / 结尾 --- */
|
|
10
10
|
export declare const ROOT_PATH: string;
|
|
11
11
|
export declare const LIB_PATH: string;
|
|
@@ -51,6 +51,8 @@ export interface IConfig {
|
|
|
51
51
|
'lang': IConfigLang;
|
|
52
52
|
's3': Record<string, IConfigS3>;
|
|
53
53
|
'turnstile': IConfigTurnstile;
|
|
54
|
+
'ai': Record<string, IConfigAi>;
|
|
55
|
+
'vector': Record<string, IConfigVector>;
|
|
54
56
|
[key: string]: Record<string, Json>;
|
|
55
57
|
}
|
|
56
58
|
export interface IUrlParse {
|
|
@@ -80,6 +82,18 @@ export interface IConfigS3 {
|
|
|
80
82
|
'region': string;
|
|
81
83
|
'bucket': string;
|
|
82
84
|
}
|
|
85
|
+
/** --- AI --- */
|
|
86
|
+
export interface IConfigAi {
|
|
87
|
+
'skey': string;
|
|
88
|
+
}
|
|
89
|
+
/** --- 向量数据库 --- */
|
|
90
|
+
export interface IConfigVector {
|
|
91
|
+
'host': string;
|
|
92
|
+
'port': number;
|
|
93
|
+
'name': string;
|
|
94
|
+
'user': string;
|
|
95
|
+
'pwd': string;
|
|
96
|
+
}
|
|
83
97
|
/** --- 人机码信息 --- */
|
|
84
98
|
export interface IConfigTurnstile {
|
|
85
99
|
'CF': {
|
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '3.2.
|
|
9
|
+
export const VER = '3.2.22';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/ai.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project: Kebab, User: Tang Rukun, JianSuoQiYue
|
|
3
|
+
* Date: 2025-10-27 21:31:06
|
|
4
|
+
* Last: 2025-10-27 21:31:08
|
|
5
|
+
*/
|
|
6
|
+
import * as openai from 'openai';
|
|
7
|
+
import * as sCtr from '#kebab/sys/ctr.js';
|
|
8
|
+
/**
|
|
9
|
+
* --- 参考:https://help.aliyun.com/zh/model-studio/what-is-model-studio ---
|
|
10
|
+
* --- 阿里模型:https://help.aliyun.com/zh/model-studio/getting-started/models ---
|
|
11
|
+
*/
|
|
12
|
+
/** --- 服务商定义 --- */
|
|
13
|
+
export declare enum ESERVICE {
|
|
14
|
+
/** --- 阿里中国大陆区 --- */
|
|
15
|
+
'ALICN' = 0,
|
|
16
|
+
/** --- 阿里国际区 --- */
|
|
17
|
+
'ALIAS' = 1
|
|
18
|
+
}
|
|
19
|
+
/** --- 选项 --- */
|
|
20
|
+
export interface IOptions {
|
|
21
|
+
/** --- 服务商 ---- */
|
|
22
|
+
'service': ESERVICE;
|
|
23
|
+
/** --- 密钥值 --- */
|
|
24
|
+
'secretKey'?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class Ai {
|
|
27
|
+
/** --- openai 原生对象,建议只读 --- */
|
|
28
|
+
readonly link: openai.OpenAI;
|
|
29
|
+
private readonly _ctr;
|
|
30
|
+
constructor(ctr: sCtr.Ctr, opt: IOptions);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* --- 创建一个 AI 对象 ---
|
|
34
|
+
* @param opt 选项
|
|
35
|
+
*/
|
|
36
|
+
export declare function get(ctr: sCtr.Ctr, opt: IOptions): Ai;
|
package/lib/ai.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project: Kebab, User: Tang Rukun, JianSuoQiYue
|
|
3
|
+
* Date: 2025-10-27 21:31:06
|
|
4
|
+
* Last: 2025-10-27 21:31:08
|
|
5
|
+
*/
|
|
6
|
+
import * as openai from 'openai';
|
|
7
|
+
/**
|
|
8
|
+
* --- 参考:https://help.aliyun.com/zh/model-studio/what-is-model-studio ---
|
|
9
|
+
* --- 阿里模型:https://help.aliyun.com/zh/model-studio/getting-started/models ---
|
|
10
|
+
*/
|
|
11
|
+
/** --- 服务商定义 --- */
|
|
12
|
+
export var ESERVICE;
|
|
13
|
+
(function (ESERVICE) {
|
|
14
|
+
/** --- 阿里中国大陆区 --- */
|
|
15
|
+
ESERVICE[ESERVICE["ALICN"] = 0] = "ALICN";
|
|
16
|
+
/** --- 阿里国际区 --- */
|
|
17
|
+
ESERVICE[ESERVICE["ALIAS"] = 1] = "ALIAS";
|
|
18
|
+
})(ESERVICE || (ESERVICE = {}));
|
|
19
|
+
/** --- openai 的连接对象 --- */
|
|
20
|
+
const links = [];
|
|
21
|
+
export class Ai {
|
|
22
|
+
constructor(ctr, opt) {
|
|
23
|
+
this._ctr = ctr;
|
|
24
|
+
const config = ctr.getPrototype('_config');
|
|
25
|
+
const secretKey = opt.secretKey ?? config.ai?.[ESERVICE[opt.service]]?.skey ?? '';
|
|
26
|
+
let endpoint;
|
|
27
|
+
switch (opt.service) {
|
|
28
|
+
case ESERVICE.ALICN: {
|
|
29
|
+
endpoint = `https://dashscope.aliyuncs.com/compatible-mode/v1`;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
case ESERVICE.ALIAS: {
|
|
33
|
+
endpoint = `https://dashscope-intl.aliyuncs.com/compatible-mode/v1`;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
default: {
|
|
37
|
+
endpoint = undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const token = `${opt.service}-${secretKey}`;
|
|
41
|
+
const link = links.find((item) => item.token === token);
|
|
42
|
+
if (link) {
|
|
43
|
+
this.link = link.link;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.link = new openai.OpenAI({
|
|
47
|
+
'apiKey': secretKey,
|
|
48
|
+
'baseURL': endpoint,
|
|
49
|
+
});
|
|
50
|
+
links.push({
|
|
51
|
+
'token': token,
|
|
52
|
+
'link': this.link,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* --- 创建一个 AI 对象 ---
|
|
58
|
+
* @param opt 选项
|
|
59
|
+
*/
|
|
60
|
+
export function get(ctr, opt) {
|
|
61
|
+
return new Ai(ctr, opt);
|
|
62
|
+
}
|
package/lib/kv.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface IConnectionInfo {
|
|
|
18
18
|
export declare class Pool {
|
|
19
19
|
/** --- 当前 Pool 对象的 kv 连接信息 --- */
|
|
20
20
|
private readonly _etc;
|
|
21
|
-
constructor(ctr: sCtr.Ctr, etc?:
|
|
21
|
+
constructor(ctr: sCtr.Ctr, etc?: IOptions);
|
|
22
22
|
/**
|
|
23
23
|
* --- 设定一个值 ---
|
|
24
24
|
* @param key
|
|
@@ -467,8 +467,17 @@ export declare class Connection {
|
|
|
467
467
|
* --- 获取 Kv Pool 对象 ---
|
|
468
468
|
* @param etc 配置信息可留空
|
|
469
469
|
*/
|
|
470
|
-
export declare function get(ctr: sCtr.Ctr, etc?:
|
|
470
|
+
export declare function get(ctr: sCtr.Ctr, etc?: IOptions): Pool;
|
|
471
471
|
/**
|
|
472
472
|
* --- 获取当前连接池中所有连接的信息 ---
|
|
473
473
|
*/
|
|
474
474
|
export declare function getConnectionList(): IConnectionInfo[];
|
|
475
|
+
/** --- 选项 --- */
|
|
476
|
+
export interface IOptions {
|
|
477
|
+
'host'?: string;
|
|
478
|
+
'port'?: number;
|
|
479
|
+
'index'?: number;
|
|
480
|
+
'pre'?: string;
|
|
481
|
+
'user'?: string;
|
|
482
|
+
'pwd'?: string;
|
|
483
|
+
}
|
package/lib/kv.js
CHANGED
|
@@ -65,12 +65,15 @@ setTimeout(function () {
|
|
|
65
65
|
}, 10_000);
|
|
66
66
|
export class Pool {
|
|
67
67
|
constructor(ctr, etc) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
const configKv = ctr.getPrototype('_config').kv;
|
|
69
|
+
this._etc = {
|
|
70
|
+
'host': etc?.host ?? configKv.host,
|
|
71
|
+
'port': etc?.port ?? configKv.port,
|
|
72
|
+
'index': etc?.index ?? configKv.index,
|
|
73
|
+
'pre': etc?.pre ?? configKv.pre,
|
|
74
|
+
'user': etc?.user ?? configKv.user,
|
|
75
|
+
'pwd': etc?.pwd ?? configKv.pwd,
|
|
76
|
+
};
|
|
74
77
|
}
|
|
75
78
|
/**
|
|
76
79
|
* --- 设定一个值 ---
|
package/lib/s3.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as s3 from '@aws-sdk/client-s3';
|
|
|
7
7
|
import * as stream from 'stream';
|
|
8
8
|
import * as sCtr from '#kebab/sys/ctr.js';
|
|
9
9
|
/**
|
|
10
|
-
* s3 文档:https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/
|
|
10
|
+
* --- s3 文档:https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/ ---
|
|
11
11
|
*/
|
|
12
12
|
/** --- 服务商定义 --- */
|
|
13
13
|
export declare enum ESERVICE {
|
package/lib/s3.js
CHANGED
|
@@ -11,7 +11,7 @@ import * as lText from '#kebab/lib/text.js';
|
|
|
11
11
|
/** --- s3 的连接对象 --- */
|
|
12
12
|
const links = [];
|
|
13
13
|
/**
|
|
14
|
-
* s3 文档:https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/
|
|
14
|
+
* --- s3 文档:https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/ ---
|
|
15
15
|
*/
|
|
16
16
|
/** --- 服务商定义 --- */
|
|
17
17
|
export var ESERVICE;
|
package/lib/ws.js
CHANGED
|
@@ -48,6 +48,9 @@ export class Socket {
|
|
|
48
48
|
},
|
|
49
49
|
end: () => {
|
|
50
50
|
// --- nothing ---
|
|
51
|
+
},
|
|
52
|
+
timeout: () => {
|
|
53
|
+
// --- nothing ---
|
|
51
54
|
}
|
|
52
55
|
};
|
|
53
56
|
if (!request || !socket) {
|
|
@@ -159,6 +162,8 @@ export class Socket {
|
|
|
159
162
|
this._on.end();
|
|
160
163
|
}).on('close', () => {
|
|
161
164
|
this._on.close();
|
|
165
|
+
}).on('timeout', () => {
|
|
166
|
+
this._on.timeout();
|
|
162
167
|
});
|
|
163
168
|
}
|
|
164
169
|
on(event, cb) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maiyunnet/kebab",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.22",
|
|
4
4
|
"description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"#kebab/*": "./*"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aws-sdk/client-s3": "^3.
|
|
23
|
-
"@aws-sdk/lib-storage": "^3.
|
|
22
|
+
"@aws-sdk/client-s3": "^3.917.0",
|
|
23
|
+
"@aws-sdk/lib-storage": "^3.917.0",
|
|
24
24
|
"@litert/http-client": "^1.1.2",
|
|
25
25
|
"@litert/mime": "^0.1.3",
|
|
26
26
|
"@litert/redis": "^3.0.5",
|
|
@@ -28,10 +28,11 @@
|
|
|
28
28
|
"@types/ssh2": "^1.15.5",
|
|
29
29
|
"ejs": "^3.1.10",
|
|
30
30
|
"jszip": "^3.10.1",
|
|
31
|
-
"mysql2": "^3.15.
|
|
31
|
+
"mysql2": "^3.15.3",
|
|
32
|
+
"openai": "^6.7.0",
|
|
32
33
|
"ssh2": "^1.17.0",
|
|
33
34
|
"svg-captcha": "^1.4.0",
|
|
34
|
-
"tencentcloud-sdk-nodejs": "^4.1.
|
|
35
|
+
"tencentcloud-sdk-nodejs": "^4.1.135"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@litert/eslint-plugin-rules": "^0.3.1",
|
package/sys/child.js
CHANGED
|
@@ -554,7 +554,7 @@ process.on('message', function (msg) {
|
|
|
554
554
|
str.push(key + ':' + linkCount[key].toString());
|
|
555
555
|
}
|
|
556
556
|
lCore.display(`[CHILD] Worker ${process.pid} busy: ${str.join(',')}.`);
|
|
557
|
-
lCore.log({}, `[CHILD] Worker ${process.pid} busy: ${str.join(',')}.`, '-
|
|
557
|
+
lCore.log({}, `[CHILD] Worker ${process.pid} busy: ${str.join(',')}.`, '-warning');
|
|
558
558
|
await lCore.sleep(30_000);
|
|
559
559
|
waiting += 30_000;
|
|
560
560
|
if (waiting > 3600_000) {
|
package/sys/cmd.js
CHANGED
|
@@ -146,6 +146,19 @@ async function run() {
|
|
|
146
146
|
config.turnstile['TENCENT'].skey ??= '';
|
|
147
147
|
config.turnstile['TENCENT'].aid ??= '';
|
|
148
148
|
config.turnstile['TENCENT'].akey ??= '';
|
|
149
|
+
// --- config - ai ---
|
|
150
|
+
config.ai ??= {};
|
|
151
|
+
config.ai['ALICN'] ??= {};
|
|
152
|
+
config.ai['ALICN'].skey ??= '';
|
|
153
|
+
config.ai['ALIAS'] ??= {};
|
|
154
|
+
config.ai['ALIAS'].skey ??= '';
|
|
155
|
+
// --- config - vector ---
|
|
156
|
+
config.vector ??= {};
|
|
157
|
+
config.vector.host ??= '127.0.0.1';
|
|
158
|
+
config.vector.port ??= 19530;
|
|
159
|
+
config.vector.name ??= 'default';
|
|
160
|
+
config.vector.user ??= 'root';
|
|
161
|
+
config.vector.pwd ??= 'Milvue';
|
|
149
162
|
// --- 保存 config.json ---
|
|
150
163
|
if (!await lFs.putContent(kebab.CONF_CWD + 'config.json', lText.stringifyJson(config, 4))) {
|
|
151
164
|
lCore.display('KEBAB', 'CREATE', 'FILE', kebab.CONF_CWD + 'config.json', '[FAILED]');
|
package/www/example/ctr/test.js
CHANGED
|
@@ -20,6 +20,7 @@ import * as lZip from '#kebab/lib/zip.js';
|
|
|
20
20
|
import * as lBuffer from '#kebab/lib/buffer.js';
|
|
21
21
|
import * as lLan from '#kebab/lib/lan.js';
|
|
22
22
|
import * as lCron from '#kebab/lib/cron.js';
|
|
23
|
+
import * as lAi from '#kebab/lib/ai.js';
|
|
23
24
|
import * as sCtr from '#kebab/sys/ctr.js';
|
|
24
25
|
// --- mod ---
|
|
25
26
|
import mTest from '../mod/test.js';
|
|
@@ -124,9 +125,8 @@ export default class extends sCtr.Ctr {
|
|
|
124
125
|
`<br><a href="${this._config.const.urlBase}test/mod-split">View "test/mod-split"</a>`,
|
|
125
126
|
`<br><a href="${this._config.const.urlBase}test/mod-insert">View "test/mod-insert"</a>`,
|
|
126
127
|
'<br><br><b>Library test:</b>',
|
|
127
|
-
|
|
128
|
-
`<br><br><a href="${this._config.const.urlBase}test/
|
|
129
|
-
`<br><a href="${this._config.const.urlBase}test/captcha-base64">View "test/captcha-base64"</a>`,
|
|
128
|
+
`<br><br><b>Ai:</b>`,
|
|
129
|
+
`<br><br><a href="${this._config.const.urlBase}test/ai">View "test/ai"</a>`,
|
|
130
130
|
'<br><br><b>Core:</b>',
|
|
131
131
|
`<br><br><a href="${this._config.const.urlBase}test/core-random">View "test/core-random"</a>`,
|
|
132
132
|
`<br><a href="${this._config.const.urlBase}test/core-rand">View "test/core-rand"</a>`,
|
|
@@ -171,10 +171,9 @@ export default class extends sCtr.Ctr {
|
|
|
171
171
|
`<br><a href="${this._config.const.urlBase}test/session?s=kv">View "test/session?s=kv"</a>`,
|
|
172
172
|
`<br><a href="${this._config.const.urlBase}test/session?s=db&auth=1">View "test/session?s=db&auth=1" Header Authorization</a>`,
|
|
173
173
|
`<br><a href="${this._config.const.urlBase}test/session?s=kv&auth=1">View "test/session?s=kv&auth=1" Header Authorization</a>`,
|
|
174
|
-
'<br><br><b>
|
|
175
|
-
`<br><br><a href="${this._config.const.urlBase}test/
|
|
176
|
-
`<br><a href="${this._config.const.urlBase}test/
|
|
177
|
-
`<br><a href="${this._config.const.urlBase}test/jwt?type=auth">View "test/jwt?type=auth" Header Authorization</a>`,
|
|
174
|
+
'<br><br><b>Captcha:</b>',
|
|
175
|
+
`<br><br><a href="${this._config.const.urlBase}test/captcha-fastbuild">View "test/captcha-fastbuild"</a>`,
|
|
176
|
+
`<br><a href="${this._config.const.urlBase}test/captcha-base64">View "test/captcha-base64"</a>`,
|
|
178
177
|
'<br><br><b>Sql:</b>',
|
|
179
178
|
`<br><br><a href="${this._config.const.urlBase}test/sql?type=insert">View "test/sql?type=insert"</a>`,
|
|
180
179
|
`<br><a href="${this._config.const.urlBase}test/sql?type=select">View "test/sql?type=select"</a>`,
|
|
@@ -184,6 +183,10 @@ export default class extends sCtr.Ctr {
|
|
|
184
183
|
`<br><a href="${this._config.const.urlBase}test/sql?type=having">View "test/sql?type=having"</a>`,
|
|
185
184
|
`<br><a href="${this._config.const.urlBase}test/sql?type=by">View "test/sql?type=by"</a>`,
|
|
186
185
|
`<br><a href="${this._config.const.urlBase}test/sql?type=field">View "test/sql?type=field"</a>`,
|
|
186
|
+
'<br><br><b>Jwt:</b>',
|
|
187
|
+
`<br><br><a href="${this._config.const.urlBase}test/jwt">View "test/jwt"</a>`,
|
|
188
|
+
`<br><a href="${this._config.const.urlBase}test/jwt?type=kv">View "test/jwt?type=kv"</a>`,
|
|
189
|
+
`<br><a href="${this._config.const.urlBase}test/jwt?type=auth">View "test/jwt?type=auth" Header Authorization</a>`,
|
|
187
190
|
'<br><br><b>Consistent:</b>',
|
|
188
191
|
`<br><br><a href="${this._config.const.urlBase}test/consistent-hash">View "test/consistent-hash"</a>`,
|
|
189
192
|
`<br><a href="${this._config.const.urlBase}test/consistent-distributed">View "test/consistent-distributed"</a>`,
|
|
@@ -3027,6 +3030,29 @@ rtn.push(reader.readBCDString());</pre>${JSON.stringify(rtn)}`);
|
|
|
3027
3030
|
<pre>${JSON.stringify(lCron.getRegulars(), null, 4)}</pre>`);
|
|
3028
3031
|
return echo.join('') + '<br>' + this._getEnd();
|
|
3029
3032
|
}
|
|
3033
|
+
async ai() {
|
|
3034
|
+
const ai = lAi.get(this, {
|
|
3035
|
+
'service': lAi.ESERVICE.ALICN,
|
|
3036
|
+
});
|
|
3037
|
+
const echo = [`<pre>const ai = lAi.get(this, {
|
|
3038
|
+
'service': lAi.ESERVICE.ALICN,
|
|
3039
|
+
});</pre>`];
|
|
3040
|
+
const completion = await ai.link.chat.completions.create({
|
|
3041
|
+
'model': 'qwen-plus',
|
|
3042
|
+
'messages': [
|
|
3043
|
+
{ 'role': 'system', 'content': 'You are Kebab, a friendly and knowledgeable assistant based on an open-source Node framework. You do not mention any model names or AI identity. You can chat casually, answer questions, and provide guidance naturally. Respond in a human-like, approachable manner, as if you are a helpful companion rather than a traditional AI assistant.' },
|
|
3044
|
+
{ 'role': 'user', 'content': '你是谁?' }
|
|
3045
|
+
],
|
|
3046
|
+
});
|
|
3047
|
+
echo.push(`<pre>await ai.link.chat.completions.create({
|
|
3048
|
+
'model': 'qwen-plus',
|
|
3049
|
+
'messages': [
|
|
3050
|
+
{ 'role': 'system', 'content': 'You are Kebab, a friendly and knowledgeable assistant based on an open-source Node framework. You do not mention any model names or AI identity. You can chat casually, answer questions, and provide guidance naturally. Respond in a human-like, approachable manner, as if you are a helpful companion rather than a traditional AI assistant.' },
|
|
3051
|
+
{ 'role': 'user', 'content': '你是谁?' }
|
|
3052
|
+
],
|
|
3053
|
+
});</pre>` + JSON.stringify(completion.choices[0].message.content));
|
|
3054
|
+
return echo.join('') + '<br><br>' + this._getEnd();
|
|
3055
|
+
}
|
|
3030
3056
|
/**
|
|
3031
3057
|
* --- END ---
|
|
3032
3058
|
*/
|