fix(adapters): reflow live sensenova reasoning field, add trae adapter

sensenova: the deployed /etc/llmsproxy/adapters/sensenova.lua carried a fix that
never made it back into the repo — sensenova-6.8-flash-lite reports its chain of
thought in `reasoning` rather than `reasoning_content`, in both the single-shot
response and the stream deltas. Without this the model's output looked empty.
Repo and deployment now match byte for byte.

trae: the adapter was in use on this deployment but untracked, so a fresh
install had no way to serve the trae source.
This commit is contained in:
JianFeeeee
2026-08-30 08:06:22 +08:00
parent 6575058556
commit 02cb8c0e33
2 changed files with 182 additions and 3 deletions

View File

@ -57,6 +57,9 @@ function adapter.transform_response(raw_body)
unified.content = ch.message.content or ""
if ch.message.reasoning_content then
unified.reasoning_content = ch.message.reasoning_content
elseif ch.message.reasoning then
-- sensenova-6.8-flash-lite 用 reasoning 字段而不是 reasoning_content
unified.reasoning_content = ch.message.reasoning
end
end
unified.finish_reason = ch.finish_reason or ""
@ -97,10 +100,11 @@ function adapter.transform_stream_chunk(raw_chunk)
local delta = chunk.choices[1].delta or {}
-- Sensenova: delta has reasoning_content but no content
-- Sensenova: delta has reasoning_content (deepseek-v4-flash) or reasoning
-- (sensenova-6.8-flash-lite) but no content field
local content = delta.content or ""
if content == "" and delta.reasoning_content then
content = delta.reasoning_content
if content == "" and (delta.reasoning_content or delta.reasoning) then
content = delta.reasoning_content or delta.reasoning
end
-- Sensenova: finish_reason is "" on every chunk, "stop" on last