You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Power Automate调用AzureOpenAI Chat Playground HTTP Post报错解决方案

解决Power Automate调用Azure OpenAI Chat Playground的数组类型报错

报错原因

错误''[{"role":"user","content":"Who is mahatma gandhi?"}]' is not of type 'array' - 'messages'的核心问题是:你传递给Azure OpenAI API的messages参数是带引号包裹的字符串,但API要求messages必须是原生JSON数组类型。

解决步骤

  • 修正HTTP请求体的messages字段:直接传入数组内容,不要用引号包裹。比如不要写成"[{\"role\":\"user\",\"content\":\"Who is mahatma gandhi?\"}]",而是使用:
    [{"role":"user","content":"Who is mahatma gandhi?"}]
    
  • 检查动态内容/表达式:如果是通过Power Automate的动态内容或表达式生成messages,避免用string()这类函数将数组转为字符串,直接输出数组本身。
  • 确认请求体格式:完整的JSON请求体示例如下(替换为你的模型信息):
    {
      "model": "gpt-35-turbo",
      "messages": [
        {
          "role": "user",
          "content": "Who is mahatma gandhi?"
        }
      ],
      "temperature": 0.7
    }
    
  • 验证请求头:确保HTTP动作的Content-Type设置为application/json,保证API能正确解析请求体的JSON结构。

内容的提问来源于stack exchange,提问作者Farhaan Pasha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 13:45:32