Invalid value: 'text'. Supported values are: 'input_text', 'input_image', 'outpu...

2026年03月06日 14:48 状态: processing

🚨 错误信息

Invalid value: 'text'. Supported values are: 'input_text', 'input_image', 'output_text', 'refusal', 'input_file', 'computer_screenshot', 'summary_text', and 'tether_browsing_display'.

🤖 AI解决方案

报错分析报告

1.错误翻译



原文:Invalid value: 'text'. Supported values are: 'input_text', 'input_image', 'output_text', 'refusal', 'input_file', 'computer_screenshot', 'summary_text', and 'tether_browsing_display'.
译文:无效值:'text'。支持的值为:'input_text'、'input_image'、'output_text'、'refusal'、'input_file'、'computer_screenshot'、'summary_text'和'tether_browsing_display'。

2. 原因分析


  • 根本原因:代码中使用了参数不支持的取值text

  • 发生位置:设置某参数(如API请求的type/value字段)时传入了非法值text,该参数仅接受列出的8种合法值。
  • 3.解决方案


    根据业务需求选择合法值替换text,以下是通用修复示例:
    python

    原错误代码(示例):使用非法值'text'


    param = "text"

    修复后代码:替换为合法值(如业务需输入文本则选'input_text')


    param = "input_text" # 或 output_text/summary_text 等匹配场景的值

    javascript
    // 原错误代码(示例):API请求传非法值
    fetch("/api", { body: JSON.stringify({ type: "text" }) });

    // 修复后代码:改用合法值
    fetch("/api", { body: JSON.stringify({ type: "input_text" }) });

    4. 预防措施


  • 查文档优先:调用API/设置参数前,必看官方文档的「合法取值列表」;

  • 加校验逻辑:用枚举类型(如Python的Enum、TS的union type)约束参数值,避免硬编码非法值。
  • 推荐工具:VS Code IntelliSense(参数提示)、Postman(预验证请求)、ESLint(JS参数校验规则)。

    ---
    请按上述方案替换非法值,确保参数匹配业务场景与文档要求。