shiroai 2.0.2 → 2.0.4
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 +6 -5
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ const c = {
|
|
|
17
17
|
|
|
18
18
|
// ===== CONFIG =====
|
|
19
19
|
const API_URL = 'https://inference.do-ai.run/v1/chat/completions';
|
|
20
|
-
const MODEL = '
|
|
20
|
+
const MODEL = 'openai-gpt-oss-120b';
|
|
21
21
|
const CWD = process.cwd();
|
|
22
22
|
const CONFIG_DIR = path.join(os.homedir(), '.shiroai');
|
|
23
23
|
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
@@ -262,13 +262,14 @@ initMessages();
|
|
|
262
262
|
// ===== STREAMING API =====
|
|
263
263
|
function streamChat(msgs, tools) {
|
|
264
264
|
return new Promise((resolve, reject) => {
|
|
265
|
-
const
|
|
265
|
+
const payload = {
|
|
266
266
|
model: MODEL,
|
|
267
267
|
messages: msgs,
|
|
268
|
-
tools: tools,
|
|
269
268
|
stream: true,
|
|
270
269
|
max_tokens: 8192
|
|
271
|
-
}
|
|
270
|
+
};
|
|
271
|
+
if (tools && tools.length) payload.tools = tools;
|
|
272
|
+
const body = JSON.stringify(payload);
|
|
272
273
|
const url = new URL(API_URL);
|
|
273
274
|
const client = url.protocol === 'https:' ? https : http;
|
|
274
275
|
|
|
@@ -279,7 +280,7 @@ function streamChat(msgs, tools) {
|
|
|
279
280
|
method: 'POST',
|
|
280
281
|
headers: {
|
|
281
282
|
'Content-Type': 'application/json',
|
|
282
|
-
'Authorization':
|
|
283
|
+
'Authorization': 'Bearer doo_v1_c1723ee6ceca27f7c2ac2dfa896e6f40ec36d88668ca921eccd81591314b4bd2',
|
|
283
284
|
'Content-Length': Buffer.byteLength(body)
|
|
284
285
|
}
|
|
285
286
|
}, res => {
|