lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
43.12k stars 9.71k forks source link

[Bug] 对话中使用图片报错 #4454

Open CaffeineCM opened 3 hours ago

CaffeineCM commented 3 hours ago

📦 部署环境

Docker

📌 软件版本

1.22.17

💻 系统环境

Other Linux

🌐 浏览器

Edge

🐛 问题描述

当我在对话中使用图片得到以下报错 { "error": { "code": "invalid_image_url", "type": "invalid_request_error", "param": "", "message": "Error while downloading http://192.168.x.xxx:9000/lobe/files/480463/c5f2ac82-953c-4594-830e-6f9cefca02b8.png. (request id: 2024102307175920149166410055977) (request id: 2024102307172919437048602547446)" }, "endpoint": "https://ai****ix.com/v1", "provider": "openai" }

当我使用浏览器,根据错误信息中的url去访问时,图片能够正常访问

📷 复现步骤

No response

🚦 期望结果

No response

📝 补充信息

No response

lobehubbot commented 3 hours ago

👀 @CaffeineCM

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

lobehubbot commented 3 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


📦 Deployment environment

Docker

📌 Software version

1.22.17

💻 System environment

Other Linux

🌐 Browser

Edge

🐛 Problem description

When I use an image in a conversation I get the following error { "error": { "code": "invalid_image_url", "type": "invalid_request_error", "param": "", "message": "Error while downloading http://192.168.x.xxx:9000/lobe/files/480463/c5f2ac82-953c-4594-830e-6f9cefca02b8.png. (request id: 2024102307175920149166410055977) (request id: 2024102307172919437048602547446) " }, "endpoint": "https://ai****ix.com/v1", "provider": "openai" }

When I use the browser to access according to the URL in the error message, the image can be accessed normally.

📷 Steps to reproduce

No response

🚦 Expected results

No response

📝 Supplementary information

No response

dosubot[bot] commented 3 hours ago

@CaffeineCM 你好!我是 Dosu,一个可以帮助你解决 bug、回答问题并成为贡献者的机器人。我会在等待人类维护者处理你的问题时提供帮助。

I found a similar issue related to handling image URLs in the lobe-chat framework. The framework converts image URLs to base64 format internally, and an 'invalid_image_url' error can occur if the URL does not conform to expected formats or cannot be processed correctly. This might happen if the URL does not result in a valid base64 conversion or if the URL type is not recognized [1].

To resolve a similar issue, it was suggested to add an environment variable LLM_VISION_IMAGE_USE_BASE64=1. This might help in resolving the "invalid image" problem [2].

To continue talking to Dosu, mention @dosu.

CaffeineCM commented 2 hours ago

我的部署参考该文档https://lobehub.com/zh/docs/self-hosting/server-database/docker-compose 后续使用的发布到生产(IP 模式)步骤进行,仅仅只替换了局域网ip

lobehubbot commented 2 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


My deployment refers to this document https://lobehub.com/zh/docs/self-hosting/server-database/docker-compose The subsequent steps of publishing to production (IP mode) are carried out, only the LAN IP is replaced.

arvinxx commented 2 hours ago

试试 LLM_VISION_IMAGE_USE_BASE64=1

lobehubbot commented 2 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Try LLM_VISION_IMAGE_USE_BASE64=1

CaffeineCM commented 2 hours ago

试试LLM_VISION_IMAGE_USE_BASE64=1

我在排查问题的时候看到了这个解决方案,然后确认了一下配置文件,发现本来就是存在这个参数的 0D557DA1-8542-406B-9C53-A64A972F04EA

lobehubbot commented 2 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Try LLM_VISION_IMAGE_USE_BASE64=1

I saw this solution when I was troubleshooting the problem, and then I checked the configuration file and found that this parameter already existed. ![Uploading 0D557DA1-8542-406B-9C53-A64A972F04EA.png…]()