@wacry/codeks-bridge 0.0.21 → 0.0.22

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.
@@ -88,7 +88,8 @@ export function buildGeminiRequest(context) {
88
88
  return;
89
89
  flushModel();
90
90
  const last = contents.at(-1);
91
- if (last?.role === "user")
91
+ // Preserve the boundary between tool results and a new user instruction.
92
+ if (last?.role === "user" && Boolean(last.parts[0]?.functionResponse) === Boolean(parts[0]?.functionResponse))
92
93
  last.parts.push(...parts);
93
94
  else
94
95
  contents.push({ role: "user", parts });
@@ -37,7 +37,7 @@
37
37
 
38
38
  ## 消息、工具与图片
39
39
 
40
- 开头的 instructions、system 和 developer 指令进入 `systemInstruction`;中途 system/developer 指令转换为原位置的 user `<system-reminder>`,不会为每条新指令重写顶部。user 与 assistant 对应原生 `user` / `model`;相邻同角色内容按原协议组成 parts。
40
+ 开头的 instructions、system 和 developer 指令进入 `systemInstruction`;中途 system/developer 指令转换为原位置的 user `<system-reminder>`,不会为每条新指令重写顶部。user 与 assistant 对应原生 `user` / `model`;相邻同类内容组成 parts,但工具结果与后续的新用户指令分别保留为独立 Content。连续的并行工具结果仍在同一 Content 中按调用顺序排列。实测 Vertex AI 路由中,将结果和新指令合并会返回“Requests ending with a model turn are not supported”,保留两条相邻 user Content 则成功;不据此声称所有原生端点都禁止混合 parts。
41
41
 
42
42
  Lite 的 `additional_tools` 按历史顺序合并,声明放入顶层 `tools.functionDeclarations`,同身份保留最新版本。namespace 名称、自由文本工具和 Lark/regex 语法沿用[共同工具转换](tools.md),不为 Gemini 另造命名约定。工具调用成为 `functionCall`,结果成为 `functionResponse`;跨消息交错的调用与结果先使用现有工具历史配对规则整理。
43
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wacry/codeks-bridge",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "Configurable local Responses API bridge for codeks with GPT, Claude Messages, DeepSeek Chat, and native Gemini adapters.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "David Zhang",