@maiyunnet/kebab 3.2.30 → 3.2.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/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/ai.d.ts +5 -1
- package/lib/ai.js +12 -0
- package/lib/core.d.ts +2 -1
- package/lib/core.js +4 -0
- package/package.json +1 -1
- package/sys/cmd.js +6 -0
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.31';
|
|
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
|
@@ -16,7 +16,11 @@ export declare enum ESERVICE {
|
|
|
16
16
|
/** --- 阿里国际区 --- */
|
|
17
17
|
'ALIAS' = 1,
|
|
18
18
|
/** --- 微软 Azure --- */
|
|
19
|
-
'AZURE' = 2
|
|
19
|
+
'AZURE' = 2,
|
|
20
|
+
/** --- 微软 Azure 2 --- */
|
|
21
|
+
'AZURE2' = 3,
|
|
22
|
+
/** --- 微软 Azure 3 --- */
|
|
23
|
+
'AZURE3' = 4
|
|
20
24
|
}
|
|
21
25
|
/** --- 选项 --- */
|
|
22
26
|
export interface IOptions {
|
package/lib/ai.js
CHANGED
|
@@ -17,6 +17,10 @@ export var ESERVICE;
|
|
|
17
17
|
ESERVICE[ESERVICE["ALIAS"] = 1] = "ALIAS";
|
|
18
18
|
/** --- 微软 Azure --- */
|
|
19
19
|
ESERVICE[ESERVICE["AZURE"] = 2] = "AZURE";
|
|
20
|
+
/** --- 微软 Azure 2 --- */
|
|
21
|
+
ESERVICE[ESERVICE["AZURE2"] = 3] = "AZURE2";
|
|
22
|
+
/** --- 微软 Azure 3 --- */
|
|
23
|
+
ESERVICE[ESERVICE["AZURE3"] = 4] = "AZURE3";
|
|
20
24
|
})(ESERVICE || (ESERVICE = {}));
|
|
21
25
|
/** --- openai 的连接对象 --- */
|
|
22
26
|
const links = [];
|
|
@@ -38,6 +42,14 @@ export class Ai {
|
|
|
38
42
|
endpoint = opt.endpoint ?? config.ai?.[ESERVICE[opt.service]]?.endpoint ?? '';
|
|
39
43
|
break;
|
|
40
44
|
}
|
|
45
|
+
case ESERVICE.AZURE2: {
|
|
46
|
+
endpoint = opt.endpoint ?? config.ai?.[ESERVICE[opt.service]]?.endpoint ?? '';
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case ESERVICE.AZURE3: {
|
|
50
|
+
endpoint = opt.endpoint ?? config.ai?.[ESERVICE[opt.service]]?.endpoint ?? '';
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
41
53
|
default: {
|
|
42
54
|
endpoint = undefined;
|
|
43
55
|
}
|
package/lib/core.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as http from 'http';
|
|
2
2
|
import * as http2 from 'http2';
|
|
3
3
|
import * as stream from 'stream';
|
|
4
|
+
import * as net from 'net';
|
|
4
5
|
import * as kebab from '#kebab/index.js';
|
|
5
6
|
import * as lResponse from '#kebab/lib/net/response.js';
|
|
6
7
|
import * as sCtr from '#kebab/sys/ctr.js';
|
|
@@ -255,4 +256,4 @@ export declare function writeEventStreamHead(res: http2.Http2ServerResponse | ht
|
|
|
255
256
|
* @param res 响应对象
|
|
256
257
|
* @param data 数据
|
|
257
258
|
*/
|
|
258
|
-
export declare function write(res: http2.Http2ServerResponse | http.ServerResponse, data: string | Buffer): void;
|
|
259
|
+
export declare function write(res: http2.Http2ServerResponse | http.ServerResponse | net.Socket, data: string | Buffer): void;
|
package/lib/core.js
CHANGED
|
@@ -7,6 +7,7 @@ import * as cp from 'child_process';
|
|
|
7
7
|
import * as http2 from 'http2';
|
|
8
8
|
import * as stream from 'stream';
|
|
9
9
|
import * as os from 'os';
|
|
10
|
+
import * as net from 'net';
|
|
10
11
|
import * as kebab from '#kebab/index.js';
|
|
11
12
|
import * as lTime from '#kebab/lib/time.js';
|
|
12
13
|
import * as lFs from '#kebab/lib/fs.js';
|
|
@@ -821,6 +822,9 @@ export function write(res, data) {
|
|
|
821
822
|
if (res instanceof http2.Http2ServerResponse) {
|
|
822
823
|
res.write(data);
|
|
823
824
|
}
|
|
825
|
+
else if (res instanceof net.Socket) {
|
|
826
|
+
res.write(data);
|
|
827
|
+
}
|
|
824
828
|
else {
|
|
825
829
|
res.write(data);
|
|
826
830
|
}
|
package/package.json
CHANGED
package/sys/cmd.js
CHANGED
|
@@ -155,6 +155,12 @@ async function run() {
|
|
|
155
155
|
config.ai['AZURE'] ??= {};
|
|
156
156
|
config.ai['AZURE'].endpoint ??= '';
|
|
157
157
|
config.ai['AZURE'].skey ??= '';
|
|
158
|
+
config.ai['AZURE2'] ??= {};
|
|
159
|
+
config.ai['AZURE2'].endpoint ??= '';
|
|
160
|
+
config.ai['AZURE2'].skey ??= '';
|
|
161
|
+
config.ai['AZURE3'] ??= {};
|
|
162
|
+
config.ai['AZURE3'].endpoint ??= '';
|
|
163
|
+
config.ai['AZURE3'].skey ??= '';
|
|
158
164
|
// --- config - vector ---
|
|
159
165
|
config.vector ??= {};
|
|
160
166
|
config.vector.host ??= '127.0.0.1';
|