@maiyunnet/kebab 3.2.32 → 3.2.34
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/db.js +2 -0
- package/package.json +1 -1
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.34';
|
|
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/db.js
CHANGED
|
@@ -183,10 +183,12 @@ export class Pool {
|
|
|
183
183
|
});
|
|
184
184
|
conn = c;
|
|
185
185
|
connections.push(conn);
|
|
186
|
+
break;
|
|
186
187
|
}
|
|
187
188
|
catch (err) {
|
|
188
189
|
if (err.message === 'ETIMEOUT') {
|
|
189
190
|
lCore.debug('[DB][_getConnection][ETIMEOUT]', err);
|
|
191
|
+
await lCore.sleep(300);
|
|
190
192
|
continue;
|
|
191
193
|
}
|
|
192
194
|
const msg = `[DB][_getConnection] ${err.message}(${this._etc.host}:${this._etc.port})`;
|