open-agents-ai 0.187.201 → 0.187.203
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 +30 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -315515,7 +315515,7 @@ body {
|
|
|
315515
315515
|
background: #2a2a30;
|
|
315516
315516
|
border: 1px solid #3a3a42;
|
|
315517
315517
|
color: #b2920a;
|
|
315518
|
-
padding:
|
|
315518
|
+
padding: 10px 16px;
|
|
315519
315519
|
border-radius: 3px;
|
|
315520
315520
|
font-family: inherit;
|
|
315521
315521
|
font-size: 0.75rem;
|
|
@@ -318744,9 +318744,17 @@ async function directChatBackend(opts) {
|
|
|
318744
318744
|
const j = JSON.parse(result.body);
|
|
318745
318745
|
const content = j?.choices?.[0]?.message?.content || "";
|
|
318746
318746
|
jsonResponse(res, 200, {
|
|
318747
|
-
|
|
318747
|
+
id: `chatcmpl-${sessionId.slice(0, 12)}`,
|
|
318748
|
+
object: "chat.completion",
|
|
318749
|
+
created: Math.floor(Date.now() / 1e3),
|
|
318748
318750
|
model: cleanModel,
|
|
318749
|
-
|
|
318751
|
+
choices: [{
|
|
318752
|
+
index: 0,
|
|
318753
|
+
message: { role: "assistant", content },
|
|
318754
|
+
finish_reason: "stop"
|
|
318755
|
+
}],
|
|
318756
|
+
usage: j?.usage || { prompt_tokens: 0, completion_tokens: 0, total_tokens: 0 },
|
|
318757
|
+
session_id: sessionId
|
|
318750
318758
|
});
|
|
318751
318759
|
return content;
|
|
318752
318760
|
}
|
|
@@ -318813,14 +318821,28 @@ async function directChatBackend(opts) {
|
|
|
318813
318821
|
const j = JSON.parse(result.body);
|
|
318814
318822
|
const content = j?.message?.content || "";
|
|
318815
318823
|
if (!content) throw new Error("Backend returned empty message content");
|
|
318824
|
+
const promptTokens = j?.prompt_eval_count ?? 0;
|
|
318825
|
+
const completionTokens = j?.eval_count ?? 0;
|
|
318816
318826
|
jsonResponse(res, 200, {
|
|
318817
|
-
|
|
318827
|
+
id: `chatcmpl-${sessionId.slice(0, 12)}`,
|
|
318828
|
+
object: "chat.completion",
|
|
318829
|
+
created: Math.floor(Date.now() / 1e3),
|
|
318818
318830
|
model: cleanModel,
|
|
318819
|
-
|
|
318831
|
+
choices: [{
|
|
318832
|
+
index: 0,
|
|
318833
|
+
message: { role: "assistant", content },
|
|
318834
|
+
finish_reason: "stop"
|
|
318835
|
+
}],
|
|
318820
318836
|
usage: {
|
|
318821
|
-
prompt_tokens:
|
|
318822
|
-
completion_tokens:
|
|
318823
|
-
|
|
318837
|
+
prompt_tokens: promptTokens,
|
|
318838
|
+
completion_tokens: completionTokens,
|
|
318839
|
+
total_tokens: promptTokens + completionTokens
|
|
318840
|
+
},
|
|
318841
|
+
session_id: sessionId,
|
|
318842
|
+
_oa: {
|
|
318843
|
+
mode: "direct",
|
|
318844
|
+
ollama_total_duration_ns: j?.total_duration,
|
|
318845
|
+
ollama_load_duration_ns: j?.load_duration
|
|
318824
318846
|
}
|
|
318825
318847
|
});
|
|
318826
318848
|
return content;
|
package/package.json
CHANGED