Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI DeepSeek 422 Unprocessable Entity #14347

Closed
3 tasks done
J4gQBqqR opened this issue Mar 11, 2025 · 22 comments
Closed
3 tasks done

AI DeepSeek 422 Unprocessable Entity #14347

J4gQBqqR opened this issue Mar 11, 2025 · 22 comments
Assignees
Labels
Milestone

Comments

@J4gQBqqR
Copy link

J4gQBqqR commented Mar 11, 2025

AI Error in docker container: Invalid type for 'messages.[3].content'

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

  1. No extension installed
  2. Exact same config works in Windows desktop client
  3. Not working in hosted docker container

Expected result

Should work regardless of platform.

Screenshot or screen recording presentation

Image

Version environment

- Version: v3.1.24 
- Operating System: docker
- Browser (if used): up-to-date Firefox

Log file

E 2025/03/11 09:50:42 openai.go:55: create chat completion failed: error, status code: 400, status: 400 Bad Request, message: Invalid type for 'messages.[3].content': expected one of a string or array of objects, but got an object instead.

More information

Not sure why docker version does not work. Is it because of the networking is different for docker? Does the user need to config something such as DNS to make it work?

@88250
Copy link
Member

88250 commented Mar 12, 2025

Please provide the complete log.

ps: I guess it may be a docker network configuration problem.

@sz2013
Copy link

sz2013 commented Mar 14, 2025

一样的问题

这就是全部日志
E 2025/03/14 18:19:32 openai.go:55: create chat completion failed: error, status code: 400, status: 400 Bad Request, message: Invalid type for 'messages.[3].content': expected one of a string or array of objects, but got an object instead. (request id: 2025031418193220789630037510643)

@winsonet
Copy link

I have the same issue~

@J4gQBqqR
Copy link
Author

This entry of log is the only one that is related to AI failure. The other logs are unrelated. Please set up a container yourself, it is very easy to reproduce.

@winsonet
Copy link

actually, just the Aliyun API has this issue, if using Siliconflow API then it will be fine

@88250
Copy link
Member

88250 commented Mar 15, 2025

actually, just the Aliyun API has this issue, if using Siliconflow API then it will be fine

Thanks for the information. It is possible that the Aliyun API is incompatible with the OpenAI API specification in some details. We cannot change this. Thanks for your feedback and discussion.

@88250 88250 closed this as completed Mar 15, 2025
@J4gQBqqR
Copy link
Author

As stated, it works in windows client, not in docker. This seems like an platform dependent implementation error instead of an error from aliyun from my perspective.

@88250
Copy link
Member

88250 commented Mar 17, 2025

The implementation code of this part has nothing to do with the specific platform and is the same code.

@J4gQBqqR
Copy link
Author

I tried another AI provider: https://api.deepinfra.com/v1/openai
I got the same error in docker container again.

Not sure why this ticket is closed. Could you verify it before closing it? This should be very easy to verify. Just put in any provider in a docker container frontend. You will see the error.

@88250
Copy link
Member

88250 commented Mar 21, 2025

I tested https://api.deepseek.com/v1 with SiYuan Docker and it is available. The configuration is as follows:

Image

I think you could try changing this https://api.deepinfra.com/v1/openai to https://api.deepinfra.com/v1

@sz2013
Copy link

sz2013 commented Mar 21, 2025

Image

我这不行,docker依然报错,但桌面端不报错

Image

@TCOTC
Copy link
Contributor

TCOTC commented Mar 21, 2025

超时时间改成600试试

@sz2013
Copy link

sz2013 commented Mar 21, 2025

超时时间改成600试试

不行,一样的错
E 2025/03/21 17:01:55 openai.go:55: create chat completion failed: error, status code: 422, status: 422 Unprocessable Entity, message: invalid character 'F' looking for beginning of value, body: Failed to deserialize the JSON body into the target type: messages[0]: missing field content at line 1 column 53

@88250
Copy link
Member

88250 commented Mar 21, 2025

你用的是 ai 的哪个功能?

@sz2013
Copy link

sz2013 commented Mar 21, 2025

你用的是 ai 的哪个功能?

就问了 “你好”

@88250
Copy link
Member

88250 commented Mar 21, 2025

我这里在 docker 上测试正常:

Image

建议还是检查一下网络相关配置。

@sz2013
Copy link

sz2013 commented Mar 21, 2025

终于知道怎么重现了,真不容易

随便填个错误的key,然后用一次,会报错,再把key改回正确的,还是会报错

重启docker后就不报错了

推测应该是缓存问题

@sz2013
Copy link

sz2013 commented Mar 21, 2025

只要报一次错,以后无论配置哪家的AI都会报错

@J4gQBqqR
Copy link
Author

重启docker后就不报错了

Thanks for the trick, I rebooted my container by purging it and force recreate, it now works with the https://api.deepinfra.com/v1/openai API. Exact same API, no change in configuration. What always failed now works like nothing happened before.

只要报一次错,以后无论配置哪家的AI都会报错

Really not sure why a failure can persist.

@88250 88250 self-assigned this Mar 22, 2025
@88250
Copy link
Member

88250 commented Mar 22, 2025

@sz2013 找到问题了,DeepSeek 不支持 content 为空字符串,这个问题下个版本解决,感谢反馈。

@88250 88250 added the Bug label Mar 22, 2025
@88250 88250 added this to the 3.1.26 milestone Mar 22, 2025
@88250 88250 changed the title AI Error in docker container: Invalid type for 'messages.[3].content' AI DeepSeek 422 Unprocessable Entity Mar 22, 2025
@phdbbs
Copy link

phdbbs commented Mar 25, 2025

Image

@88250
Copy link
Member

88250 commented Mar 25, 2025

@phdbbs Please upgrade to the latest SiYuan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants