supercompat 2.5.0 → 2.6.1
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/index.cjs +43 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +43 -29
- package/dist/index.js.map +1 -1
- package/dist/supercompat.cjs +8 -0
- package/dist/supercompat.cjs.map +1 -1
- package/dist/supercompat.js +8 -0
- package/dist/supercompat.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -471,6 +471,11 @@ var supercompatFetch = function(param) {
|
|
|
471
471
|
});
|
|
472
472
|
});
|
|
473
473
|
};
|
|
474
|
+
// src/lib/azureOpenai/endpointFromBaseUrl.ts
|
|
475
|
+
var endpointFromBaseUrl = function(param) {
|
|
476
|
+
var baseURL = param.baseURL;
|
|
477
|
+
return baseURL.replace(/\/+openai$/, "");
|
|
478
|
+
};
|
|
474
479
|
// src/supercompat.ts
|
|
475
480
|
var supercompat = function(param) {
|
|
476
481
|
var client = param.client, storage = param.storage, runAdapter = param.runAdapter;
|
|
@@ -478,6 +483,9 @@ var supercompat = function(param) {
|
|
|
478
483
|
return new import_openai.AzureOpenAI({
|
|
479
484
|
apiKey: client.client.apiKey,
|
|
480
485
|
apiVersion: client.client.apiVersion,
|
|
486
|
+
endpoint: endpointFromBaseUrl({
|
|
487
|
+
baseURL: client.client.baseURL
|
|
488
|
+
}),
|
|
481
489
|
fetch: supercompatFetch({
|
|
482
490
|
client: client,
|
|
483
491
|
storage: storage,
|
|
@@ -874,7 +882,7 @@ var openaiClientAdapter = function(param) {
|
|
|
874
882
|
return {
|
|
875
883
|
client: openai,
|
|
876
884
|
requestHandlers: {
|
|
877
|
-
"^/v1/chat/completions$": completions2({
|
|
885
|
+
"^/(?:v1|/?openai)/chat/completions$": completions2({
|
|
878
886
|
openai: openai
|
|
879
887
|
})
|
|
880
888
|
}
|
|
@@ -2205,6 +2213,16 @@ var completionsRunAdapter = function() {
|
|
|
2205
2213
|
};
|
|
2206
2214
|
}();
|
|
2207
2215
|
};
|
|
2216
|
+
// src/lib/messages/messagesRegexp.ts
|
|
2217
|
+
var messagesRegexp = "^/(?:v1|/?openai)/threads/([^/]+)/messages$";
|
|
2218
|
+
// src/lib/runs/runsRegexp.ts
|
|
2219
|
+
var runsRegexp = "^/(?:v1|/?openai)/threads/([^/]+)/runs$";
|
|
2220
|
+
// src/lib/runs/runRegexp.ts
|
|
2221
|
+
var runRegexp = "^/(?:v1|/?openai)/threads/([^/]+)/runs/([^/]+)$";
|
|
2222
|
+
// src/lib/runs/submitToolOutputsRegexp.ts
|
|
2223
|
+
var submitToolOutputsRegexp = "^/(?:v1|/?openai)/threads/([^/]+)/runs/([^/]+)/submit_tool_outputs$";
|
|
2224
|
+
// src/lib/steps/stepsRegexp.ts
|
|
2225
|
+
var stepsRegexp = "^/(?:v1|/?openai)/threads/([^/]+)/runs/([^/]+)/steps$";
|
|
2208
2226
|
// src/adapters/storage/prismaStorageAdapter/threads/post.ts
|
|
2209
2227
|
var import_dayjs3 = __toESM(require("dayjs"), 1);
|
|
2210
2228
|
// src/adapters/storage/prismaStorageAdapter/threads/serializeThread.ts
|
|
@@ -2343,7 +2361,7 @@ var post7 = function(param) {
|
|
|
2343
2361
|
switch(_state.label){
|
|
2344
2362
|
case 0:
|
|
2345
2363
|
url = new URL(urlString);
|
|
2346
|
-
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(
|
|
2364
|
+
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(messagesRegexp)), 2), threadId = _url_pathname_match[1];
|
|
2347
2365
|
body = JSON.parse(options.body);
|
|
2348
2366
|
role = body.role, content = body.content;
|
|
2349
2367
|
return [
|
|
@@ -2390,7 +2408,7 @@ var get = function(param) {
|
|
|
2390
2408
|
switch(_state.label){
|
|
2391
2409
|
case 0:
|
|
2392
2410
|
url = new URL(urlString);
|
|
2393
|
-
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(
|
|
2411
|
+
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(messagesRegexp)), 2), threadId = _url_pathname_match[1];
|
|
2394
2412
|
_ref = (0, import_radash7.assign)({
|
|
2395
2413
|
limit: "20",
|
|
2396
2414
|
order: "desc"
|
|
@@ -2504,7 +2522,7 @@ var get2 = function(param) {
|
|
|
2504
2522
|
switch(_state.label){
|
|
2505
2523
|
case 0:
|
|
2506
2524
|
url = new URL(urlString);
|
|
2507
|
-
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(
|
|
2525
|
+
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(runsRegexp)), 2), threadId = _url_pathname_match[1];
|
|
2508
2526
|
_ref = (0, import_radash8.assign)({
|
|
2509
2527
|
limit: "20",
|
|
2510
2528
|
order: "desc"
|
|
@@ -2928,7 +2946,7 @@ var post8 = function(param) {
|
|
|
2928
2946
|
switch(_state.label){
|
|
2929
2947
|
case 0:
|
|
2930
2948
|
url = new URL(urlString);
|
|
2931
|
-
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(
|
|
2949
|
+
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(runsRegexp)), 2), threadId = _url_pathname_match[1];
|
|
2932
2950
|
body = JSON.parse(options.body);
|
|
2933
2951
|
assistant_id = body.assistant_id, stream = body.stream;
|
|
2934
2952
|
return [
|
|
@@ -3111,7 +3129,7 @@ var get3 = function(param) {
|
|
|
3111
3129
|
switch(_state.label){
|
|
3112
3130
|
case 0:
|
|
3113
3131
|
url = new URL(urlString);
|
|
3114
|
-
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(
|
|
3132
|
+
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(runRegexp)), 3), threadId = _url_pathname_match[1], runId = _url_pathname_match[2];
|
|
3115
3133
|
return [
|
|
3116
3134
|
4,
|
|
3117
3135
|
prisma.run.findUnique({
|
|
@@ -3163,7 +3181,7 @@ var get4 = function(param) {
|
|
|
3163
3181
|
switch(_state.label){
|
|
3164
3182
|
case 0:
|
|
3165
3183
|
url = new URL(urlString);
|
|
3166
|
-
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(
|
|
3184
|
+
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(stepsRegexp)), 4), threadId = _url_pathname_match[1], runId = _url_pathname_match[3];
|
|
3167
3185
|
_ref = (0, import_radash10.assign)({
|
|
3168
3186
|
limit: "20",
|
|
3169
3187
|
order: "desc"
|
|
@@ -3405,7 +3423,7 @@ var post9 = function(param) {
|
|
|
3405
3423
|
switch(_state.label){
|
|
3406
3424
|
case 0:
|
|
3407
3425
|
url = new URL(urlString);
|
|
3408
|
-
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(
|
|
3426
|
+
_url_pathname_match = _sliced_to_array(url.pathname.match(new RegExp(submitToolOutputsRegexp)), 3), threadId = _url_pathname_match[1], runId = _url_pathname_match[2];
|
|
3409
3427
|
body = JSON.parse(options.body);
|
|
3410
3428
|
tool_outputs = body.tool_outputs, stream = body.stream;
|
|
3411
3429
|
if (!stream) return [
|
|
@@ -3583,30 +3601,26 @@ var prismaStorageAdapter = function(param) {
|
|
|
3583
3601
|
var prisma = param.prisma;
|
|
3584
3602
|
return function(param) {
|
|
3585
3603
|
var runAdapter = param.runAdapter;
|
|
3604
|
+
var _obj;
|
|
3586
3605
|
return {
|
|
3587
|
-
requestHandlers: {
|
|
3588
|
-
"^/v1/threads$": threads({
|
|
3589
|
-
prisma: prisma
|
|
3590
|
-
}),
|
|
3591
|
-
"^/v1/threads/([^/]+)/messages$": messages2({
|
|
3606
|
+
requestHandlers: (_obj = {
|
|
3607
|
+
"^/(?:v1|/?openai)/threads$": threads({
|
|
3592
3608
|
prisma: prisma
|
|
3593
|
-
}),
|
|
3594
|
-
"^/v1/threads/([^/]+)/runs$": runs({
|
|
3595
|
-
prisma: prisma,
|
|
3596
|
-
runAdapter: runAdapter
|
|
3597
|
-
}),
|
|
3598
|
-
"^/v1/threads/([^/]+)/runs/([^/]+)$": run({
|
|
3599
|
-
prisma: prisma,
|
|
3600
|
-
runAdapter: runAdapter
|
|
3601
|
-
}),
|
|
3602
|
-
"^/v1/threads/([^/]+)/runs/([^/]+)/steps$": steps({
|
|
3603
|
-
prisma: prisma
|
|
3604
|
-
}),
|
|
3605
|
-
"^/v1/threads/([^/]+)/runs/([^/]+)/submit_tool_outputs$": submitToolOutputs({
|
|
3606
|
-
prisma: prisma,
|
|
3607
|
-
runAdapter: runAdapter
|
|
3608
3609
|
})
|
|
3609
|
-
}
|
|
3610
|
+
}, _define_property(_obj, messagesRegexp, messages2({
|
|
3611
|
+
prisma: prisma
|
|
3612
|
+
})), _define_property(_obj, runsRegexp, runs({
|
|
3613
|
+
prisma: prisma,
|
|
3614
|
+
runAdapter: runAdapter
|
|
3615
|
+
})), _define_property(_obj, runRegexp, run({
|
|
3616
|
+
prisma: prisma,
|
|
3617
|
+
runAdapter: runAdapter
|
|
3618
|
+
})), _define_property(_obj, stepsRegexp, steps({
|
|
3619
|
+
prisma: prisma
|
|
3620
|
+
})), _define_property(_obj, submitToolOutputsRegexp, submitToolOutputs({
|
|
3621
|
+
prisma: prisma,
|
|
3622
|
+
runAdapter: runAdapter
|
|
3623
|
+
})), _obj)
|
|
3610
3624
|
};
|
|
3611
3625
|
};
|
|
3612
3626
|
};
|