sub2api icon indicating copy to clipboard operation
sub2api copied to clipboard

麻烦作者看一下:你们有出现这个报错吗? '^[a-zA-Z0-9_-]+$'.

Open taiguguai opened this issue 2 months ago • 1 comments

Invalid 'input[405].name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_-]+$'. 最终定位是这个工具导致的:没有针对普通历史 function_call.name 的正则校验或自愈

具体代码问题

Sub2API 0.2.8 同时支持两套工具协议:

  1. Codex 私有 namespace 表示:

{ "type": "function_call", "namespace": "image_gen", "name": "imagegen" }

  1. 标准 Responses 的扁平 function 表示:

{ "type": "function_call", "name": "image_gen__imagegen" }

但源码中还显式保留了这种名称:

image_gen.imagegen

对应常量:

const codexImageGenerationFunctionToolName = "image_gen.imagegen"

这个名称中的点号不符合标准 Responses 的:

^[a-zA-Z0-9_-]+$

Sub2API 还存在另外两个缺口:

  • namespace、function、custom、tool_search 在不同转发路径中转换规则不完全一致;
  • 转发历史 input[].function_call.name 前没有统一做合法性检查。

taiguguai avatar Sep 25 '26 06:09 taiguguai

我也有这个报错

Lemon-57 avatar Sep 26 '26 10:09 Lemon-57