unified-ai-router 3.3.5 → 3.3.6
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/main.js +19 -12
- package/package.json +1 -1
- package/provider.js +0 -1
- package/tests/chat.js +1 -1
package/main.js
CHANGED
|
@@ -50,22 +50,29 @@ class AIRouter
|
|
|
50
50
|
{
|
|
51
51
|
for await ( const chunk of responseStream )
|
|
52
52
|
{
|
|
53
|
-
|
|
54
|
-
const reasoning = chunk.choices[0]?.delta?.reasoning;
|
|
55
|
-
const tool_calls_delta = chunk.choices[0]?.delta?.tool_calls;
|
|
56
|
-
if ( content !== null )
|
|
53
|
+
try
|
|
57
54
|
{
|
|
58
|
-
|
|
55
|
+
const content = chunk.choices[0]?.delta?.content;
|
|
56
|
+
const reasoning = chunk.choices[0]?.delta?.reasoning;
|
|
57
|
+
const tool_calls_delta = chunk.choices[0]?.delta?.tool_calls;
|
|
58
|
+
if ( content !== null )
|
|
59
|
+
{
|
|
60
|
+
chunk.content = content
|
|
61
|
+
}
|
|
62
|
+
if ( reasoning !== null )
|
|
63
|
+
{
|
|
64
|
+
chunk.reasoning = reasoning
|
|
65
|
+
}
|
|
66
|
+
if ( tool_calls_delta !== null )
|
|
67
|
+
{
|
|
68
|
+
chunk.tool_calls_delta = tool_calls_delta;
|
|
69
|
+
}
|
|
70
|
+
yield chunk;
|
|
59
71
|
}
|
|
60
|
-
|
|
72
|
+
catch ( error )
|
|
61
73
|
{
|
|
62
|
-
|
|
74
|
+
console.log( error );
|
|
63
75
|
}
|
|
64
|
-
if ( tool_calls_delta !== null )
|
|
65
|
-
{
|
|
66
|
-
chunk.tool_calls_delta = tool_calls_delta;
|
|
67
|
-
}
|
|
68
|
-
yield chunk;
|
|
69
76
|
}
|
|
70
77
|
})();
|
|
71
78
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unified-ai-router",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.6",
|
|
4
4
|
"description": "A unified interface for multiple LLM providers with automatic fallback. This project includes an OpenAI-compatible server and a deployable Telegram bot with a Mini App interface. It supports major providers like OpenAI, Google, Grok, and more, ensuring reliability and flexibility for your AI applications.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "mlibre",
|
package/provider.js
CHANGED