xiaodcs-copilot-api 2.5.1-public.2 → 2.5.1-public.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.
@@ -225,10 +225,12 @@ function parseChat(value) {
225
225
  ...typeof message.tool_call_id === "string" ? { tool_call_id: message.tool_call_id } : {}
226
226
  });
227
227
  }
228
- if (!["user", "tool"].includes(conversation.at(-1)?.role ?? "")) throw new BridgeError("The last conversation message must be from the user");
229
228
  if (Buffer.byteLength(system.join("\n") + JSON.stringify(conversation) + JSON.stringify(tools)) > 1024 * 1024) throw new BridgeError("Text exceeds the 1 MiB limit", 413);
230
- const history = conversation.slice(0, -1);
231
- const prompt = history.length ? `Previous conversation (JSON data):\n${JSON.stringify(history)}\n\nCurrent message (JSON data):\n${conversation.at(-1)?.role === "tool" ? JSON.stringify(conversation.at(-1)) : conversation.at(-1).content}` : conversation[0].content;
229
+ const last = conversation.at(-1);
230
+ const continuation = last?.role === "assistant";
231
+ const history = continuation ? conversation : conversation.slice(0, -1);
232
+ const current = continuation ? "Continue the assistant response from the conversation above. Do not repeat the existing response or invent missing tool results." : last?.role === "tool" ? JSON.stringify(last) : last?.content ?? "Respond according to the provided instructions.";
233
+ const prompt = history.length ? `Previous conversation (JSON data):\n${JSON.stringify(history)}\n\n${continuation ? "Continuation request" : "Current message (JSON data)"}:\n${current}` : current;
232
234
  return {
233
235
  model: input.model.trim(),
234
236
  stream: input.stream === true,
@@ -1,4 +1,4 @@
1
- import { c as makeImage, d as BridgeError, f as record, l as validateImageUrl, s as decodeDataImage, u as clientToolServer } from "./protocol-BTFLbI8m.js";
1
+ import { c as makeImage, d as BridgeError, f as record, l as validateImageUrl, s as decodeDataImage, u as clientToolServer } from "./protocol-CpMGdO6U.js";
2
2
  import { mkdtemp, rm } from "node:fs/promises";
3
3
  import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
@@ -369,6 +369,8 @@ function createBackend(runQuery = query, token) {
369
369
  id: m.value,
370
370
  name: m.displayName,
371
371
  context_window: m.defaultContextWindow ?? Math.min(...m.availableContextWindows?.length ? m.availableContextWindows : [m.maxInputTokens ?? 128e3]),
372
+ reasoning_efforts: m.efforts,
373
+ default_reasoning_level: m.defaultEffort,
372
374
  max_input_tokens: m.maxInputTokens,
373
375
  max_output_tokens: m.maxOutputTokens,
374
376
  available_context_windows: m.availableContextWindows,