@maiyunnet/kebab 3.2.33 → 3.2.35
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 +1 -1
- package/index.js +1 -1
- package/lib/ai.d.ts +2 -2
- package/lib/ai.js +2 -2
- package/lib/cron.d.ts +1 -1
- package/package.json +1 -1
- package/sys/mod.d.ts +4 -2
- package/sys/mod.js +8 -4
package/index.d.ts
CHANGED
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.35';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/ai.d.ts
CHANGED
|
@@ -40,9 +40,9 @@ export declare class Ai {
|
|
|
40
40
|
private readonly _ctr;
|
|
41
41
|
constructor(ctr: sCtr.Ctr, opt: IOptions);
|
|
42
42
|
/** --- 创建非流式对话 --- */
|
|
43
|
-
chat(body: openai.default.Chat.Completions.ChatCompletionCreateParamsNonStreaming): openai.APIPromise<openai.default.Chat.ChatCompletion> | false
|
|
43
|
+
chat(body: openai.default.Chat.Completions.ChatCompletionCreateParamsNonStreaming): Promise<openai.APIPromise<openai.default.Chat.ChatCompletion> | false>;
|
|
44
44
|
/** --- 创建流式对话 --- */
|
|
45
|
-
chat(body: openai.default.Chat.Completions.ChatCompletionCreateParamsStreaming): openai.APIPromise<streaming.Stream<openai.default.Chat.ChatCompletionChunk>> | false
|
|
45
|
+
chat(body: openai.default.Chat.Completions.ChatCompletionCreateParamsStreaming): Promise<openai.APIPromise<streaming.Stream<openai.default.Chat.ChatCompletionChunk>> | false>;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* --- 创建一个 AI 对象 ---
|
package/lib/ai.js
CHANGED
|
@@ -73,9 +73,9 @@ export class Ai {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
/** --- 创建对话 --- */
|
|
76
|
-
chat(body) {
|
|
76
|
+
async chat(body) {
|
|
77
77
|
try {
|
|
78
|
-
return this.link.chat.completions.create(body);
|
|
78
|
+
return await this.link.chat.completions.create(body);
|
|
79
79
|
}
|
|
80
80
|
catch (e) {
|
|
81
81
|
lCore.debug('[AI][CHAT]', e);
|
package/lib/cron.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare function regular(task: IRegular, immediate?: string): Promise<boo
|
|
|
12
12
|
export declare function run(): void;
|
|
13
13
|
/** --- 定时任务 --- */
|
|
14
14
|
export interface IRegular {
|
|
15
|
-
/** ---
|
|
15
|
+
/** --- 任务名称,只能小写字母、数字、短横线、下划线,长度 1-32 --- */
|
|
16
16
|
'name': string;
|
|
17
17
|
/** --- 任务日期对象(系统时区) --- */
|
|
18
18
|
'date': {
|
package/package.json
CHANGED
package/sys/mod.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project: Kebab, User: JianSuoQiYue
|
|
3
3
|
* Date: 2019-6-4 21:35
|
|
4
|
-
* Last: 2020-4-14 13:33:51, 2022-07-23 16:01:34, 2022-09-06 22:59:26, 2023-5-24 19:11:37, 2023-6-13 21:47:58, 2023-7-10 18:54:03, 2023-8-23 17:03:16, 2023-12-11 15:21:22, 2023-12-20 23:12:03, 2024-3-8 16:05:29, 2024-3-20 19:58:15, 2024-8-11 21:14:54, 2024-10-5 14:00:22, 2024-12-14 19:58:34, 2025-9-23 11:01:36
|
|
4
|
+
* Last: 2020-4-14 13:33:51, 2022-07-23 16:01:34, 2022-09-06 22:59:26, 2023-5-24 19:11:37, 2023-6-13 21:47:58, 2023-7-10 18:54:03, 2023-8-23 17:03:16, 2023-12-11 15:21:22, 2023-12-20 23:12:03, 2024-3-8 16:05:29, 2024-3-20 19:58:15, 2024-8-11 21:14:54, 2024-10-5 14:00:22, 2024-12-14 19:58:34, 2025-9-23 11:01:36, 2025-11-5 16:34:31
|
|
5
5
|
*/
|
|
6
6
|
import * as lSql from '#kebab/lib/sql.js';
|
|
7
7
|
import * as lDb from '#kebab/lib/db.js';
|
|
@@ -217,7 +217,7 @@ export default class Mod {
|
|
|
217
217
|
'index'?: string;
|
|
218
218
|
}): T;
|
|
219
219
|
/**
|
|
220
|
-
* ---
|
|
220
|
+
* --- 根据主键(或 key 字段)获取对象 ---
|
|
221
221
|
* @param db 数据库对象
|
|
222
222
|
* @param val 主键值
|
|
223
223
|
* @param lock 是否加锁
|
|
@@ -229,6 +229,8 @@ export default class Mod {
|
|
|
229
229
|
'raw'?: boolean;
|
|
230
230
|
'pre'?: string;
|
|
231
231
|
'index'?: string | string[];
|
|
232
|
+
/** --- 通过 key 字段获取,默认为 false,即从主键获取 --- */
|
|
233
|
+
'key'?: boolean;
|
|
232
234
|
}): Promise<false | null | (T & Record<string, any>)>;
|
|
233
235
|
static one(db: lDb.Pool | lDb.Transaction, s: string | kebab.Json, opt: {
|
|
234
236
|
'ctr'?: sCtr.Ctr;
|
package/sys/mod.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project: Kebab, User: JianSuoQiYue
|
|
3
3
|
* Date: 2019-6-4 21:35
|
|
4
|
-
* Last: 2020-4-14 13:33:51, 2022-07-23 16:01:34, 2022-09-06 22:59:26, 2023-5-24 19:11:37, 2023-6-13 21:47:58, 2023-7-10 18:54:03, 2023-8-23 17:03:16, 2023-12-11 15:21:22, 2023-12-20 23:12:03, 2024-3-8 16:05:29, 2024-3-20 19:58:15, 2024-8-11 21:14:54, 2024-10-5 14:00:22, 2024-12-14 19:58:34, 2025-9-23 11:01:36
|
|
4
|
+
* Last: 2020-4-14 13:33:51, 2022-07-23 16:01:34, 2022-09-06 22:59:26, 2023-5-24 19:11:37, 2023-6-13 21:47:58, 2023-7-10 18:54:03, 2023-8-23 17:03:16, 2023-12-11 15:21:22, 2023-12-20 23:12:03, 2024-3-8 16:05:29, 2024-3-20 19:58:15, 2024-8-11 21:14:54, 2024-10-5 14:00:22, 2024-12-14 19:58:34, 2025-9-23 11:01:36, 2025-11-5 16:34:31
|
|
5
5
|
*/
|
|
6
6
|
import * as lSql from '#kebab/lib/sql.js';
|
|
7
7
|
import * as lTime from '#kebab/lib/time.js';
|
|
@@ -418,19 +418,23 @@ export default class Mod {
|
|
|
418
418
|
});
|
|
419
419
|
}
|
|
420
420
|
/**
|
|
421
|
-
* ---
|
|
421
|
+
* --- 根据主键(或 key 字段)获取对象 ---
|
|
422
422
|
* @param db 数据库对象
|
|
423
423
|
* @param val 主键值
|
|
424
424
|
* @param lock 是否加锁
|
|
425
425
|
* @param opt 选项
|
|
426
426
|
*/
|
|
427
|
-
static find(db, val, opt = {}) {
|
|
427
|
+
static async find(db, val, opt = {}) {
|
|
428
|
+
if (opt.key && !this._$key) {
|
|
429
|
+
lCore.debug('[MOD][find] key not found');
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
428
432
|
return new this({
|
|
429
433
|
'db': db,
|
|
430
434
|
'ctr': opt.ctr,
|
|
431
435
|
'pre': opt.pre,
|
|
432
436
|
'where': [{
|
|
433
|
-
[this._$primary]: val
|
|
437
|
+
[opt.key ? this._$key : this._$primary]: val,
|
|
434
438
|
}],
|
|
435
439
|
'raw': opt.raw,
|
|
436
440
|
'index': opt.index,
|