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