chatbox icon indicating copy to clipboard operation
chatbox copied to clipboard

[BUG]使用魔塔社区 API 报错

Open liuyanxi975 opened this issue 8 months ago • 1 comments

Bug Description 使用魔塔社区 API 报错(deepseek r1模型),pc 和移动端均可100%复现,,在1.11.8版本及之前都没有问题,新版本无法使用。

api 地址 https://api-inference.modelscope.cn/v1/

Steps to Reproduce 不需要任何复现步骤,100%报错

Expected Results 正常使用

Actual Results 连接 Custom Provider 失败。这通常是由于配置错误或 Custom Provider 账户问题。请检查您的设置并验证您的 Custom Provider 账户状态,或购买Chatbox AI License即可立即解锁所有高级模型,无需任何配置。

API Error: Error from Custom: AI_TypeValidationError: Type validation failed: Value: {"id":"chatcmpl-e5e7acff-1f99-9b72-85b0-d90374354ef9","object":"chat.completion.chunk","created":1745061229,"model":"deepseek-ai/DeepSeek-R1","system_fingerprint":"","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":null,"function_calls":null,"reasoning_content":"好的"},"finish_reason":null,"message":{"role":"","content":"","tool_calls":null,"function_calls":null,"reasoning_content":""}}],"usage":{"prompt_tokens":0,"completion_tokens":0,"total_tokens":0}}. Error message: [ { "code": "invalid_union", "unionErrors": [ { "issues": [ { "received": "", "code": "invalid_enum_value", "options": [ "assistant" ], "path": [ "choices", 0, "delta", "role" ], "message": "Invalid enum value. Expected 'assistant', received ''" } ], "name": "ZodError" }, { "issues": [ { "code": "invalid_type", "expected": "object", "received": "undefined", "path": [ "error" ], "message": "Required" } ], "name": "ZodError" } ], "path": [], "message": "Invalid input" } ]

Screenshots 错误信息已提供

Desktop (please complete the following information):

全平台,1.11.8以上

liuyanxi975 avatar Apr 19 '25 11:04 liuyanxi975

这个是因为新版本使用了vercel ai sdk,会对返回的event data schema进行校验,从上面的报错信息来看,魔搭返回的schema不正确,role字段为空字符串(正确的空值应该是null或者省略该字段),之前版本使用的sdk未对返回数据进行严格校验所以没有问题,这个问题我们给魔搭反馈一下

themez avatar Apr 19 '25 14:04 themez