@opentiny/genui-sdk-server 0.0.1-alpha.1 → 1.0.0-beta.2
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/dist/cli.js +43 -43
- package/dist/index.d.ts +6 -2
- package/dist/index.js +27 -27
- package/dist/start-server-4eW5WScr.js +5481 -0
- package/package.json +3 -2
- package/dist/start-server-D22jR-7Y.js +0 -5518
package/dist/cli.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Command as
|
|
5
|
-
import { s as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import v from "dotenv";
|
|
3
|
+
import b from "node:path";
|
|
4
|
+
import { Command as B } from "commander";
|
|
5
|
+
import { s as C } from "./start-server-4eW5WScr.js";
|
|
6
|
+
const e = c;
|
|
7
|
+
(function(o, x) {
|
|
8
|
+
const n = c, t = o();
|
|
9
|
+
for (; ; )
|
|
10
|
+
try {
|
|
11
|
+
if (-parseInt(n(309)) / 1 + -parseInt(n(336)) / 2 * (parseInt(n(331)) / 3) + -parseInt(n(320)) / 4 * (parseInt(n(330)) / 5) + parseInt(n(306)) / 6 + parseInt(n(321)) / 7 + -parseInt(n(332)) / 8 + parseInt(n(334)) / 9 === x) break;
|
|
12
|
+
t.push(t.shift());
|
|
13
|
+
} catch {
|
|
14
|
+
t.push(t.shift());
|
|
15
|
+
}
|
|
16
|
+
})(y, 745865);
|
|
17
|
+
function c(o, x) {
|
|
18
|
+
o = o - 296;
|
|
19
|
+
const n = y();
|
|
20
|
+
let t = n[o];
|
|
21
|
+
if (c.JNIAud === void 0) {
|
|
22
|
+
var a = function(s) {
|
|
23
|
+
const l = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=";
|
|
13
24
|
let f = "", u = "";
|
|
14
|
-
for (let
|
|
15
|
-
i =
|
|
16
|
-
for (let
|
|
17
|
-
u += "%" + ("00" + f.charCodeAt(
|
|
25
|
+
for (let r = 0, p, i, U = 0; i = s.charAt(U++); ~i && (p = r % 4 ? p * 64 + i : i, r++ % 4) ? f += String.fromCharCode(255 & p >> (-2 * r & 6)) : 0)
|
|
26
|
+
i = l.indexOf(i);
|
|
27
|
+
for (let r = 0, p = f.length; r < p; r++)
|
|
28
|
+
u += "%" + ("00" + f.charCodeAt(r).toString(16)).slice(-2);
|
|
18
29
|
return decodeURIComponent(u);
|
|
19
30
|
};
|
|
20
|
-
|
|
31
|
+
c.Oycahb = a, c.gOjGNF = {}, c.JNIAud = !0;
|
|
21
32
|
}
|
|
22
|
-
const
|
|
23
|
-
return
|
|
33
|
+
const m = n[0], _ = o + m, d = c.gOjGNF[_];
|
|
34
|
+
return d ? t = d : (t = c.Oycahb(t), c.gOjGNF[_] = t), t;
|
|
24
35
|
}
|
|
25
|
-
const n = a;
|
|
26
36
|
function y() {
|
|
27
|
-
const
|
|
37
|
+
const o = ["phbVCNq+", "B3b0Aw9U", "lwGSic0TAgvSCa", "qvbjx0Tfwq", "zgvZy3jPChrPBW", "mJm5ntbfquzpq2m", "mtjxz1vUB3e", "mJC1mtiWmfHxBfnMtW", "6iEQ5A6A5lMj546V5Akd5y+y6yEp5PAh5lU26lEV", "mtmZmZyYmZzouxfWDKW", "yxjNDG", "mZa0mtq4yLLIwKjz", "C2vYDMvY", "ue9sva", "5PYn5yQH5zcV5yQO56UV5y+J77Yi6BUy6k6Kia", "zw52", "ieDLBLvj", "5P+L55Yl5zg95lUK5BIU5yQP5l+H5OgV", "Aw9UieHuvfaGCW", "Bwf4qxr0zw1WDa", "mZeWmo+8JoAiLUIaHEs9V+EuQoEoRW", "5Akd5lIT6k6+572Uiefqsv9l", "y29UzMLN", "y3DK", "zxjYB3i", "odyYndq2mg1HDKzpqq", "CMvZB2X2zq", "zxHPDa", "nZCXndi4CKTZwKHJ", "5Akd5y+y6yEpifbpuLtVViK", "AgvSCe9WDgLVBG", "Cgf0Aa", "ywn0Aw9U", "lwuSic0Tzw52rG", "zxj2AwnLigzVCG", "yxbPs2v5", "ic5LBNyG5OIw57o757UF546V", "5B6e77Yi6BUy6k6K6k+75y+w5B2t5yMn55UU5B2v", "lMvUDG", "nZyWAeHxv052", "mZiYmJyYnvrJvfnuza", "5lIl55Qeic5LBNBVViK", "CgfYC2u", "Cg9YDa"];
|
|
28
38
|
return y = function() {
|
|
29
|
-
return
|
|
39
|
+
return o;
|
|
30
40
|
}, y();
|
|
31
41
|
}
|
|
32
|
-
(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const x = n, { envFile: e, port: t } = r;
|
|
45
|
-
if (e) {
|
|
46
|
-
const m = C[x(152)](process.cwd(), e), f = {};
|
|
47
|
-
f[x(155)] = m, l[x(142)](f);
|
|
48
|
-
} else l[x(142)]({ path: C.resolve(process[x(122)](), x(147)) });
|
|
49
|
-
const s = process.env[x(144)], d = process[x(151)].API_KEY;
|
|
50
|
-
!s && (console[x(124)](x(154) + x(163) + "境中设置 BASE_" + x(134)), process[x(156)](1)), !d && (console[x(124)]("环境变量未配置:请在 .env 或系统环境中设置 API_KEY"), process[x(156)](1));
|
|
51
|
-
const _ = process[x(151)][x(143)] ? Number(process[x(151)][x(143)]) : void 0, v = (t ? Number(t) : void 0) ?? _ ?? 3100, o = {};
|
|
52
|
-
o[x(125)] = v, o[x(132)] = s, o.apiKey = d, o[x(131) + "s"] = 10, w(o);
|
|
53
|
-
}), b[n(165)](process.argv);
|
|
42
|
+
const A = new B();
|
|
43
|
+
A.name("genui-sdk-" + e(337))[e(329) + "n"]("Start a chat complet" + e(299) + e(315) + e(297))[e(326)](e(314) + "ile <path>", e(333) + e(318) + e(322)).option("-p --port " + e(325), e(339) + e(301) + e(310))[e(311)](e(327), e(298))[e(313)]((o) => {
|
|
44
|
+
const x = e, { envFile: n, port: t } = o;
|
|
45
|
+
if (n) {
|
|
46
|
+
const l = b.resolve(process[x(304)](), n), f = {};
|
|
47
|
+
f[x(312)] = l, v[x(303)](f);
|
|
48
|
+
} else v[x(303)]({ path: b[x(307)](process[x(304)](), x(319)) });
|
|
49
|
+
const a = process[x(296)].BASE_URL, m = process[x(296)][x(328)];
|
|
50
|
+
!a && (console[x(305)]("环境变量未配置:请在 .env 或系统环境中设置 BASE_URL"), process[x(308)](1)), !m && (console[x(305)]("环境变量未配置:请在" + x(317) + x(302) + "EY"), process[x(308)](1));
|
|
51
|
+
const _ = process[x(296)][x(338)] ? Number(process.env[x(338)]) : void 0, d = (t ? Number(t) : void 0) ?? _ ?? 3100, s = {};
|
|
52
|
+
s[x(324)] = d, s.baseURL = a, s[x(316)] = m, s[x(300) + "s"] = 10, C(s);
|
|
53
|
+
}), A[e(323)](process[e(335)]);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ChatCompletionCreateParamsBase } from '
|
|
1
|
+
import { ChatCompletionCreateParamsBase } from 'openai/resources/chat/completions';
|
|
2
2
|
import { Express as Express_2 } from 'express';
|
|
3
3
|
import { IncomingMessage } from 'node:http';
|
|
4
|
-
import { IRequestOptions } from '@opentiny/genui-sdk-chat-completions';
|
|
5
4
|
import { ServerResponse } from 'node:http';
|
|
6
5
|
|
|
7
6
|
export declare function createChatCompletionHandler(config: IChatCompletionHandlerConfig): {
|
|
@@ -28,6 +27,11 @@ export declare interface IEquipChatCompletionsOptions {
|
|
|
28
27
|
baseURL: string;
|
|
29
28
|
}
|
|
30
29
|
|
|
30
|
+
declare interface IRequestOptions {
|
|
31
|
+
signal?: AbortSignal | undefined | null;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
export declare interface IStartServerOptions extends Omit<IEquipChatCompletionsOptions, 'route'> {
|
|
32
36
|
port?: number;
|
|
33
37
|
maxAttempts?: number;
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { G as l, c as
|
|
2
|
-
function
|
|
3
|
-
n = n -
|
|
4
|
-
var r =
|
|
5
|
-
if (
|
|
6
|
-
var s = function(
|
|
7
|
-
for (var C = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",
|
|
8
|
-
|
|
9
|
-
for (var
|
|
10
|
-
I += "%" + ("00" +
|
|
1
|
+
import { G as l, c as J, e as K, s as b } from "./start-server-4eW5WScr.js";
|
|
2
|
+
function e(n, m) {
|
|
3
|
+
n = n - 348;
|
|
4
|
+
var r = a(), t = r[n];
|
|
5
|
+
if (e.AnyRDg === void 0) {
|
|
6
|
+
var s = function(h) {
|
|
7
|
+
for (var C = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=", f = "", I = "", o = 0, i, x, w = 0; x = h.charAt(w++); ~x && (i = o % 4 ? i * 64 + x : x, o++ % 4) ? f += String.fromCharCode(255 & i >> (-2 * o & 6)) : 0)
|
|
8
|
+
x = C.indexOf(x);
|
|
9
|
+
for (var v = 0, y = f.length; v < y; v++)
|
|
10
|
+
I += "%" + ("00" + f.charCodeAt(v).toString(16)).slice(-2);
|
|
11
11
|
return decodeURIComponent(I);
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
e.RPhGuK = s, e.QXkwIN = {}, e.AnyRDg = !0;
|
|
14
14
|
}
|
|
15
|
-
var
|
|
16
|
-
return
|
|
15
|
+
var d = r[0], p = n + d, u = e.QXkwIN[p];
|
|
16
|
+
return u ? t = u : (t = e.RPhGuK(t), e.QXkwIN[p] = t), t;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
var n = ["
|
|
20
|
-
return
|
|
18
|
+
function a() {
|
|
19
|
+
var n = ["otGZmZiYmNjmsvHcsa", "oti3vvv3wLLg", "mJeXnJC1nJbsBfz6u3y", "odeWtfPvyM9J", "nwzQvwLcuq", "mZz1vw9vt2S", "mJm3nZy0mwjICKjgCG", "mtC1ndG1nK5KCNzRDa", "mZq3mZyXmKXMthbJEG", "mJq3mtyWneDksK9YtW"];
|
|
20
|
+
return a = function() {
|
|
21
21
|
return n;
|
|
22
|
-
},
|
|
22
|
+
}, a();
|
|
23
23
|
}
|
|
24
|
-
(function(n,
|
|
25
|
-
for (var r =
|
|
24
|
+
(function(n, m) {
|
|
25
|
+
for (var r = e, t = n(); ; )
|
|
26
26
|
try {
|
|
27
|
-
var s = parseInt(r(
|
|
28
|
-
if (s ===
|
|
29
|
-
|
|
27
|
+
var s = parseInt(r(354)) / 1 * (-parseInt(r(356)) / 2) + parseInt(r(349)) / 3 + -parseInt(r(351)) / 4 + -parseInt(r(357)) / 5 * (parseInt(r(352)) / 6) + -parseInt(r(353)) / 7 + parseInt(r(350)) / 8 * (parseInt(r(348)) / 9) + parseInt(r(355)) / 10;
|
|
28
|
+
if (s === m) break;
|
|
29
|
+
t.push(t.shift());
|
|
30
30
|
} catch {
|
|
31
|
-
|
|
31
|
+
t.push(t.shift());
|
|
32
32
|
}
|
|
33
|
-
})(
|
|
33
|
+
})(a, 726213);
|
|
34
34
|
export {
|
|
35
35
|
l as GenUIChatAPIError,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
J as createChatCompletionHandler,
|
|
37
|
+
K as equipChatCompletions,
|
|
38
|
+
b as startServer
|
|
39
39
|
};
|