@xyd-js/ask-ai-edge 0.0.0-build-7c0274d-20251004231821 → 0.0.0-build-ae5d7ac-20251012020134
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.js +11 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -34558,7 +34558,8 @@ var pa = function() {
|
|
|
34558
34558
|
}();
|
|
34559
34559
|
var va;
|
|
34560
34560
|
var ma;
|
|
34561
|
-
|
|
34561
|
+
var ya;
|
|
34562
|
+
async function _a18(e3, a2, i2, s2, o2) {
|
|
34562
34563
|
try {
|
|
34563
34564
|
if (!va) {
|
|
34564
34565
|
const n2 = new pa(new URL(e3 || "http://localhost:3000/mcp"));
|
|
@@ -34577,14 +34578,14 @@ async function ya(e3, a2, i2, s2, o2) {
|
|
|
34577
34578
|
default:
|
|
34578
34579
|
throw new Error("Invalid AI provider");
|
|
34579
34580
|
}
|
|
34580
|
-
|
|
34581
|
-
return (await streamText({ model: ma, tools:
|
|
34581
|
+
ya || (ya = await va.tools());
|
|
34582
|
+
return (await streamText({ model: ma, tools: ya, stopWhen: stepCountIs(5), messages: [{ role: "user", content: [{ type: "text", text: o2 }] }] })).textStream;
|
|
34582
34583
|
} catch (e4) {
|
|
34583
34584
|
throw console.error(e4), e4;
|
|
34584
34585
|
}
|
|
34585
34586
|
}
|
|
34586
34587
|
|
|
34587
|
-
class
|
|
34588
|
+
class ga {
|
|
34588
34589
|
constructor(e3) {
|
|
34589
34590
|
this.config = e3, this.corsHeaders = e3.corsHeaders || { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "Content-Type", "Access-Control-Allow-Methods": "POST, OPTIONS" };
|
|
34590
34591
|
}
|
|
@@ -34592,7 +34593,7 @@ class _a18 {
|
|
|
34592
34593
|
return { mcpUrl: e2.MCP_URL || "", aiProvider: e2.AI_PROVIDER || "", aiModel: e2.AI_MODEL || "", aiToken: e2.AI_TOKEN || "" };
|
|
34593
34594
|
}
|
|
34594
34595
|
static New(e3) {
|
|
34595
|
-
const t2 = new
|
|
34596
|
+
const t2 = new ga(e3);
|
|
34596
34597
|
return (e4) => t2.handle(e4);
|
|
34597
34598
|
}
|
|
34598
34599
|
async handle(t2) {
|
|
@@ -34604,7 +34605,7 @@ class _a18 {
|
|
|
34604
34605
|
const n2 = (await t2.json()).prompt;
|
|
34605
34606
|
if (!n2)
|
|
34606
34607
|
return this.error(400, "Missing prompt");
|
|
34607
|
-
const r2 = await
|
|
34608
|
+
const r2 = await _a18(this.config.mcpUrl || e2.MCP_URL || "", this.config.aiProvider || e2.AI_PROVIDER || "", this.config.aiModel || e2.AI_MODEL || "", this.config.aiToken || e2.AI_TOKEN || "", n2), a2 = new TextEncoder, i2 = new ReadableStream({ async start(e3) {
|
|
34608
34609
|
try {
|
|
34609
34610
|
for await (const t3 of r2)
|
|
34610
34611
|
e3.enqueue(a2.encode(t3));
|
|
@@ -34623,12 +34624,12 @@ class _a18 {
|
|
|
34623
34624
|
return console.error("Error:", { status: e3, message: t2 }), new Response(JSON.stringify({ error: t2 }), { status: e3, headers: { ...this.corsHeaders, "Content-Type": "application/json" } });
|
|
34624
34625
|
}
|
|
34625
34626
|
}
|
|
34626
|
-
async function
|
|
34627
|
+
async function ka(e3) {
|
|
34627
34628
|
if (e3 instanceof Request) {
|
|
34628
|
-
return (await
|
|
34629
|
+
return (await ga.New({ ...ga.defaultConfig() }))(e3);
|
|
34629
34630
|
}
|
|
34630
|
-
return
|
|
34631
|
+
return ga.New(e3);
|
|
34631
34632
|
}
|
|
34632
34633
|
export {
|
|
34633
|
-
|
|
34634
|
+
ka as handler
|
|
34634
34635
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyd-js/ask-ai-edge",
|
|
3
|
-
"version": "0.0.0-build-
|
|
3
|
+
"version": "0.0.0-build-ae5d7ac-20251012020134",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xyd-js/ask-ai": "0.0.0-build-
|
|
13
|
+
"@xyd-js/ask-ai": "0.0.0-build-ae5d7ac-20251012020134"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "bun build index.ts --outdir dist --target node --format esm"
|