shiroai 2.0.5 → 2.0.7
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/cli.js +7 -2
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -274,9 +274,14 @@ initMessages();
|
|
|
274
274
|
// ===== STREAMING API =====
|
|
275
275
|
function streamChat(msgs, tools) {
|
|
276
276
|
return new Promise((resolve, reject) => {
|
|
277
|
+
// DO inference doesn't allow system messages - convert to user context
|
|
278
|
+
const filteredMsgs = msgs.map(m => {
|
|
279
|
+
if (m.role === 'system') return { role: 'user', content: `[CONTEXT]\n${m.content}` };
|
|
280
|
+
return m;
|
|
281
|
+
});
|
|
277
282
|
const payload = {
|
|
278
283
|
model: MODEL,
|
|
279
|
-
messages:
|
|
284
|
+
messages: filteredMsgs,
|
|
280
285
|
stream: true,
|
|
281
286
|
max_tokens: 8192
|
|
282
287
|
};
|
|
@@ -292,7 +297,7 @@ function streamChat(msgs, tools) {
|
|
|
292
297
|
method: 'POST',
|
|
293
298
|
headers: {
|
|
294
299
|
'Content-Type': 'application/json',
|
|
295
|
-
'Authorization': 'Bearer
|
|
300
|
+
'Authorization': 'Bearer doo_v1_0c7c1b1cba3bef6d7a51b1b9d279cf070c18dfd222a774f072e973cee282d527',
|
|
296
301
|
'Content-Length': Buffer.byteLength(body)
|
|
297
302
|
}
|
|
298
303
|
}, res => {
|