我在电脑版的代码可以正常请求 但是搬到手机版就不行 是我命令用法不对吗
===============================================[手机版]===============================================
Function 豆包文本提问(提问文本, 模型名称, apikey)
Dim req, resp, JsonStr
Dim aa
aa = Replace(提问文本, Chr(34), Chr(92) & Chr(34))
JsonStr = "{" & _
"""model"":""" & 模型名称 & """," & _
"""input"":[{" & _
"""role"":""user""," & _
"""content"":[{""type"":""input_text"",""text"":""" & aa & """}]" & _
"}]}"
TracePrint JsonStr
req = { _
"url":"https://ark.cn-beijing.volces.com/api/v3/responses", _
"method":"

OST", _
"headers":{ _
"Content-Type":"application/json", _
"Authorization":"Bearer " & apikey _
}, _
"body":JsonStr _
}
resp = Url.Request(req)
TracePrint "完整返回:" & resp["data"]
豆包文本提问 = ""
If resp["code"] = 0 Then
Dim retTable
retTable = Encode.JsonToTable(resp["data"])
If retTable["error"] <> Null Then
TracePrint "接口错误返回"
Exit Function
End If
'手机数组下标从1开始
豆包文本提问 = retTable["output"][2]["content"][1]["output_text"]
End If
End Function
TracePrint 豆包文本提问("你好","doubao-seed-2-1-pro-260628","ark-81dc485b-967e-4c35-9197-de4a31928903-54db7")
===============================================[电脑版]===============================================
Function 豆包文本提问(提问文本, 模型名称, apikey)
Dim http, JsonStr, status
Set http = CreateObject("Microsoft.XMLHTTP")
'拼接纯文本JSON,转义双引号
JsonStr = "{" & _
"""model"":""" & 模型名称 & """," & _
"""input"":[" & _
"{" & _
"""role"":""user""," & _
"""content"":[" & _
"{""type"":""input_text"",""text"":""" & Replace(提问文本, """", "\""") & """}" & _
"]" & _
"}" & _
"]" & _
"}"
TracePrint JsonStr
http.Open "

OST", "https://ark.cn-beijing.volces.com/api/v3/responses", False
http.setRequestHeader "Authorization", "Bearer " & apikey
http.setRequestHeader "Content-Type", "application/json"
http.Send JsonStr
豆包文本提问 = ""
status = http.Status
If status = 200 Then
'output[0]推理,output[1]正式回答
豆包文本提问 = LibE.对接.json_键值提取(http.responseText,"output[1].content[0].text")
End If
Set http = Nothing
End Function
'调用示例
TracePrint 豆包文本提问("你好","doubao-seed-2-1-pro-260628","ark-81dc485b-967e-4c35-9197-de4a31928903-54db7")
===============================================[报文]===============================================
POST
https://ark.cn-beijing.volces.com/api/v3/responses HTTP/1.1
Accept: */*
Authorization: Bearer ark-81dc485b-967e-4c35-9197-de4a31928903-54db7
Content-Type: application/json
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; Trident/7.0; rv:11.0) like Gecko
Host: ark.cn-beijing.volces.com
Content-Length: 114
Connection: Keep-Alive
Cache-Control: no-cache
{"model":"doubao-seed-2-1-pro-260628","input":[{"role":"user","content":[{"type":"input_text","text":"你好"}]}]}