对接oneapi响应为空(已解决,要完全对应格式,多了少了都不行)

明明api格式是正确的,放在nextweb也能用,但是对接oneapi响应为空,这是为什么,怎么排查错误呢

3 个赞

看日志 没有日志就加日志

3 个赞

怎么操作

5 个赞

我怎么知道怎么操作啊,你自己怎么部署的你不清楚吗?

3 个赞

你怕不得拿带 /v1…… 即带后缀的链接搞上去了

4 个赞

没带,非流可以正常请求,流就不行,响应体为空

4 个赞

要么是你 API 不支持
要么是你拿 Vercel 部署的 One API

3 个赞

日志是
[SYS] 2024/05/12 - 20:29:39 | failed to get token encoder for model claude-3-opus-20240229: no encoding for model claude-3-opus-20240229, using encoder for gpt-3.5-turbo
[INFO] 2024/05/12 - 20:29:39 | 2024051220293930669671140326527 | user 1 has enough quota 999999999951307686, trusted and no need to pre-consume
[GIN] 2024/05/12 - 20:29:42 | 2024051220293930669671140326527 | 200 | 3.685860273s | 43.155.22.176 | POST /v1/chat/completions
[INFO] 2024/05/12 - 20:29:43 | 2024051220293930669671140326527 | record consume log: userId=1, channelId=27, promptTokens=10, completionTokens=0, modelName=claude-3-opus-20240229, tokenName=nio, quota=75, content=模型倍率 7.50,分组倍率 1.00,补全倍率 5.00

4 个赞

应该是这段的问题

3 个赞

重启过oneapi容器,这是报错是不对的,后面的日志都没这个

3 个赞

怪事

2 个赞

你去看你的 channel27 是不是响应 200 了然后内容是空的?

1 个赞

而且看到你好像套了个 cf的不知道是 worker 还是什么 也检查一下 就是那个 ip 为43.155.22.176的

1 个赞

没错,但是不通过oneapi调用就正常

1 个赞

你是不是用了 cf 的 worker?

1 个赞

是的

1 个赞

检查你的 cf worker 代码 很可能是传参没传对

1 个赞

可是非流就正常,只有流请求会这样

1 个赞

你要不发一下你的代码?把原 url 替换掉

1 个赞
  const response = await fetch('url' + url.search, {
    method: request.method,
    headers: newHeaders,
    body: request.body
  });

  // 创建一个新的响应对象
  const newResponse = new Response(response.body, {
    status: response.status,
    statusText: response.statusText,
    headers: response.headers
  });

  return newResponse;
}

我只是转发了一下

1 个赞