fix: chat→responses 转换 input 始终输出数组

单条消息时原逻辑把 input 塌缩成单个对象,火山方舟等上游只接受
[]*InputItem 数组,直接 400(Mismatch type)。chat/messages 经
vole 渠道转换因此全挂。改为恒为数组,三种协议全矩阵实测恢复。
This commit is contained in:
Sakurasan
2026-08-27 09:57:48 +08:00
parent 305b3ed731
commit 0b31cc209e
@@ -240,11 +240,9 @@ func chatToResponsesReq(body []byte) ([]byte, error) {
if len(system) > 0 {
out["instructions"] = strings.Join(system, "\n")
}
if len(input) == 1 {
out["input"] = input[0] // 单条消息项
} else {
out["input"] = input
}
// input 必须是数组:部分上游(如火山方舟)只接受 []*InputItem,
// 单对象会被拒(400 Mismatch type)。
out["input"] = input
if len(req.Tools) > 0 {
tools := make([]any, 0, len(req.Tools))