fix: tool call anchor & wire format, streaming chunk passthrough, WebUI narrow-screen, docs bilingual

This commit is contained in:
root
2026-08-08 11:26:58 +08:00
parent 8e9de95274
commit 5d50b69153
18 changed files with 1119 additions and 42 deletions

View File

@ -72,10 +72,29 @@ function adapter.transform_stream_chunk(raw_chunk)
if not ok then return "" end
if not chunk.message then return "" end
return json.encode({
local unified = {
content = chunk.message.content or "",
done = chunk.done or false
})
}
if chunk.message.reasoning_content then
unified.reasoning_content = chunk.message.reasoning_content
end
if chunk.message.tool_calls then
local tools = {}
for _, tc in ipairs(chunk.message.tool_calls) do
table.insert(tools, {
index = #tools,
id = tc.id or ("call_" .. #tools),
type = "function",
["function"] = {
name = tc["function"] and tc["function"].name or "",
arguments = tc["function"] and (tc["function"].arguments or "{}") or "{}"
}
})
end
unified.tool_calls = tools
end
return json.encode(unified)
end
return adapter