The visual model encounters an error when recognizing images through image links
Self Checks
- [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [X] I have searched for existing issues search for existing issues, including closed ones.
- [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [X] Please do not modify this template :) and fill in all the required fields.
Dify version
0.10.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
- The visual model encounters an error when recognizing images through image links.
-
error
-
error logs
2024-10-24 15:47:57,611.611 ERROR [Dummy-8] [completion.py:148] - internal server error.
Traceback (most recent call last):
File "/app/api/controllers/console/app/completion.py", line 123, in post
response = AppGenerateService.generate(
File "/app/api/services/app_generate_service.py", line 60, in generate
ChatAppGenerator().generate(
File "/app/api/core/app/apps/chat/app_generator.py", line 110, in generate
file_objs = file_factory.build_from_mappings(
File "/app/api/factories/file_factory.py", line 102, in build_from_mappings
files = [
File "/app/api/factories/file_factory.py", line 103, in <listcomp>
build_from_mapping(
File "/app/api/factories/file_factory.py", line 62, in build_from_mapping
file = _build_from_remote_url(
File "/app/api/factories/file_factory.py", line 181, in _build_from_remote_url
resp.raise_for_status()
File "/app/api/.venv/lib/python3.10/site-packages/httpx/_models.py", line 763, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '403 Forbidden' for url 'http://192.22.149.190:30081/base/micro/oss/file/preview/dfa97051e4a54af8a70ad6a6c1329bdf/a5ec78bc-1e5f-4e07-b982-6565e734f884.png'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
2024-10-24 15:47:57,612.612 ERROR [Dummy-8] [app.py:838] - Exception on /console/api/apps/2cddb66d-cf78-4d44-86a3-a2963c2acb10/chat-messages [POST]
Traceback (most recent call last):
File "/app/api/controllers/console/app/completion.py", line 123, in post
response = AppGenerateService.generate(
File "/app/api/services/app_generate_service.py", line 60, in generate
ChatAppGenerator().generate(
File "/app/api/core/app/apps/chat/app_generator.py", line 110, in generate
file_objs = file_factory.build_from_mappings(
File "/app/api/factories/file_factory.py", line 102, in build_from_mappings
files = [
File "/app/api/factories/file_factory.py", line 103, in <listcomp>
build_from_mapping(
File "/app/api/factories/file_factory.py", line 62, in build_from_mapping
file = _build_from_remote_url(
File "/app/api/factories/file_factory.py", line 181, in _build_from_remote_url
resp.raise_for_status()
File "/app/api/.venv/lib/python3.10/site-packages/httpx/_models.py", line 763, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '403 Forbidden' for url 'http://192.22.149.190:30081/base/micro/oss/file/preview/dfa97051e4a54af8a70ad6a6c1329bdf/a5ec78bc-1e5f-4e07-b982-6565e734f884.png'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper
resp = resource(*args, **kwargs)
File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
resp = meth(*args, **kwargs)
File "/app/api/controllers/console/setup.py", line 65, in decorated
return view(*args, **kwargs)
File "/app/api/libs/login.py", line 93, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
File "/app/api/controllers/console/wraps.py", line 22, in decorated
return view(*args, **kwargs)
File "/app/api/controllers/console/app/wraps.py", line 49, in decorated_view
return view_func(*args, **kwargs)
File "/app/api/controllers/console/app/completion.py", line 149, in post
raise InternalServerError()
werkzeug.exceptions.InternalServerError: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
I found a similar closed issue that might be relevant to the error you're encountering: Knowledge base image recall cannot be accessed. The suggested solution in that issue was to ensure that the CONSOLE_API_URL and FILES_URL are properly configured in your environment settings. Here are the relevant configurations:
# Console API base URL
CONSOLE_API_URL=http://127.0.0.1:5001
# Files URL
FILES_URL=http://127.0.0.1:5001
# The time in seconds after the signature is rejected
FILES_ACCESS_TIMEOUT=300
Additionally, make sure that the timestamp, nonce, and sign parameters are correctly passed and validated in the image-preview endpoint implementation in the Dify codebase [1].
This might help resolve the 403 Forbidden error you're experiencing when the visual model tries to recognize images through image links.
To continue talking to Dosu, mention @dosu.
same in v0.10.1
I have encountered the same problem as you, have you solved it?
I have encountered the same problem as you, have you solved it?
No
Hi, @andylzming. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.
Issue Summary
- Internal server error occurs when processing image links in Dify version 0.10.0.
- Likely related to handling remote URLs in a self-hosted setup.
- I suggested checking
CONSOLE_API_URLandFILES_URLconfigurations. - Other users, including hanfangyuan4396 and Erincrying, reported similar issues.
- You confirmed the issue remains unresolved.
Next Steps
- Please confirm if this issue is still relevant to the latest version of Dify. If so, you can keep the discussion open by commenting here.
- Otherwise, this issue will be automatically closed in 15 days.
Thank you for your understanding and contribution!