Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ CODEBUDDY2API_MAX_CONCURRENT=64
# CODEBUDDY2API_MAX_INFLIGHT_PER_ACCOUNT=0
# Optional session/attempt tracing; legacy preserves existing upstream header behavior.
# CODEBUDDY2API_REQUEST_CONTEXT_MODE=legacy
# Responses projection is hot and WebUI-editable unless explicitly set here.
# balanced rewrites only recognized harness blocks with stable summaries; other text stays verbatim.
# CODEBUDDY2API_RESPONSES_PROJECTION_MODE=balanced
# Per-item head/tail limit for generated assistant text, tool arguments and tool results;
# zero disables per-item trimming. Global request/output gates still apply.
# Non-zero values must be between 256 and 33554432 bytes.
# CODEBUDDY2API_RESPONSES_PROJECTION_MAX_BYTES=40000
# compatible preserves aggregation; realtime forwards all protocol output incrementally
# and does not regenerate malformed tool arguments.
# CODEBUDDY2API_STREAM_MODE=compatible
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The template binds to localhost only. Configure HTTPS and restrict network acces
- **No Docker?** After installing dependencies and the WebUI, run `uv run converter.py` or `python3 converter.py` without `.env`. First local startup saves a default key and displays it once — see [Local Python setup](docs/deployment.md#local-python-setup).
- **Where is my data?** Everything lives in `auth/` (or `/data/auth` in Docker): credentials, settings and log databases — see [Data and backups](docs/webui.md#data-and-backups).
- **Which image tag should I use?** `latest` follows stable releases, `edge` follows main, version tags pin one release — see [Published images](docs/deployment.md#use-published-images).
- **Responses tool output/arguments compressed or need verbatim passthrough?** Set `responses_projection_mode` (default `balanced`, or `passthrough` to disable projection) and `responses_projection_max_bytes` (default `40000`, `0` disables per-item trimming). Balanced trimming keeps the head/tail and reports original bytes, estimated tokens and total lines; client addresses stay unchanged — see [Responses projection](docs/clients.md#responses-projection) and [details](docs/advanced.md#responses-projection).

## Disclaimer

Expand Down
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ docker compose up -d --no-build
- **没有 Docker?** 准备依赖和 WebUI 后,直接 `uv run converter.py` 或 `python3 converter.py`,无需 `.env`;首次本地启动保存默认 key 并仅在终端显示一次——见[本地 Python 运行](docs/deployment.zh-CN.md#本地-python-运行)。
- **数据在哪里?** 全部位于 `auth/`(Docker 中为 `/data/auth`):凭证、设置与日志数据库——见[数据与备份](docs/webui.zh-CN.md#数据与备份)。
- **镜像标签怎么选?** `latest` 跟随稳定版,`edge` 跟随 main,版本标签固定某一发行版——见[使用已发布镜像](docs/deployment.zh-CN.md#使用已发布镜像)。
- **Responses 工具输出/参数被压缩或需要完全原样?** 设置 `responses_projection_mode`(默认 `balanced`,设 `passthrough` 可完全关闭投影)及 `responses_projection_max_bytes`(默认 `40000`,`0` 禁用单项裁剪)。balanced 裁剪保留头尾并显示原始 bytes、估算 tokens 与总行数,客户端地址不变——见 [Responses 投影](docs/clients.zh-CN.md#responses-投影)及[详细说明](docs/advanced.zh-CN.md#responses-投影)。

## 免责声明

Expand Down
5 changes: 4 additions & 1 deletion app/adapters/responses_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,17 @@ def _flush_assistant():

# Merge calls into the preceding assistant message.
if item_type == "function_call":
arguments = item.get("arguments", "{}")
if not isinstance(arguments, str):
raise ValueError("function_call.arguments must be a JSON string")
if pending_assistant_content is None:
pending_assistant_content = ""
pending_tool_calls.append({
"id": item.get("call_id", item.get("id", _rand_id("call_"))),
"type": "function",
"function": {
"name": item.get("name", ""),
"arguments": item.get("arguments", "{}"),
"arguments": arguments,
},
})
continue
Expand Down
Loading
Loading