omnius 1.0.78 → 1.0.79
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 +24 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -615358,13 +615358,17 @@ ${lines.join("\n")}`);
|
|
|
615358
615358
|
}
|
|
615359
615359
|
async telegramRouterJsonCompletion(backend, request) {
|
|
615360
615360
|
try {
|
|
615361
|
-
|
|
615361
|
+
const result = await backend.chatCompletion({
|
|
615362
615362
|
...request,
|
|
615363
615363
|
responseFormat: TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT
|
|
615364
615364
|
});
|
|
615365
|
+
const visible = result.choices.some(
|
|
615366
|
+
(choice) => stripTelegramHiddenThinking(choice.message.content ?? "").trim().length > 0
|
|
615367
|
+
);
|
|
615368
|
+
if (visible) return result;
|
|
615365
615369
|
} catch {
|
|
615366
|
-
return backend.chatCompletion(request);
|
|
615367
615370
|
}
|
|
615371
|
+
return backend.chatCompletion(request);
|
|
615368
615372
|
}
|
|
615369
615373
|
async repairTelegramInteractionDecision(backend, rawOutput, forcedRoute, timeoutMs) {
|
|
615370
615374
|
const rawPreview = telegramRouterRawPreview(rawOutput, 4e3);
|
|
@@ -637795,6 +637799,7 @@ async function directChatBackend(opts) {
|
|
|
637795
637799
|
if (typeof ef["presence_penalty"] === "number") ollamaOpts["presence_penalty"] = ef["presence_penalty"];
|
|
637796
637800
|
if (Array.isArray(ef["stop"]) || typeof ef["stop"] === "string") ollamaOpts["stop"] = ef["stop"];
|
|
637797
637801
|
const hasTools = Array.isArray(ef["tools"]) && ef["tools"].length > 0;
|
|
637802
|
+
const ollamaFormat = ollamaFormatFromOpenAIResponseFormat(ef["response_format"]);
|
|
637798
637803
|
const reqBody = JSON.stringify({
|
|
637799
637804
|
model: cleanModel,
|
|
637800
637805
|
messages: messages2,
|
|
@@ -637804,7 +637809,7 @@ async function directChatBackend(opts) {
|
|
|
637804
637809
|
...hasTools ? {} : { think: false },
|
|
637805
637810
|
...hasTools ? { tools: ef["tools"] } : {},
|
|
637806
637811
|
...ef["tool_choice"] !== void 0 ? { tool_choice: ef["tool_choice"] } : {},
|
|
637807
|
-
...
|
|
637812
|
+
...ollamaFormat !== void 0 ? { format: ollamaFormat } : {},
|
|
637808
637813
|
options: ollamaOpts
|
|
637809
637814
|
});
|
|
637810
637815
|
if (stream) {
|
|
@@ -637907,6 +637912,22 @@ async function directChatBackend(opts) {
|
|
|
637907
637912
|
}
|
|
637908
637913
|
}
|
|
637909
637914
|
}
|
|
637915
|
+
function ollamaFormatFromOpenAIResponseFormat(value2) {
|
|
637916
|
+
if (typeof value2 === "string") return value2;
|
|
637917
|
+
if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) return void 0;
|
|
637918
|
+
const record = value2;
|
|
637919
|
+
if (record["type"] === "json_object") return "json";
|
|
637920
|
+
if (record["type"] === "json_schema") {
|
|
637921
|
+
const jsonSchema = record["json_schema"];
|
|
637922
|
+
if (jsonSchema && typeof jsonSchema === "object" && !Array.isArray(jsonSchema)) {
|
|
637923
|
+
const schemaRecord = jsonSchema;
|
|
637924
|
+
return schemaRecord["schema"] ?? jsonSchema;
|
|
637925
|
+
}
|
|
637926
|
+
return "json";
|
|
637927
|
+
}
|
|
637928
|
+
if (record["type"] === "object" || record["properties"] !== void 0) return record;
|
|
637929
|
+
return void 0;
|
|
637930
|
+
}
|
|
637910
637931
|
function backendAuthHeaders(endpoint) {
|
|
637911
637932
|
const key = endpoint?.authKey ?? loadConfig().apiKey;
|
|
637912
637933
|
if (key) return { Authorization: `Bearer ${key}` };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.79",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.79",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED