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

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

Closed
CaffeineCM opened this issue Oct 23, 2024 · 46 comments
Closed

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

CaffeineCM opened this issue Oct 23, 2024 · 46 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@CaffeineCM
Copy link

CaffeineCM commented Oct 23, 2024

📦 部署环境

Docker

📌 软件版本

v1.22.26

💻 系统环境

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

@CaffeineCM CaffeineCM added the 🐛 Bug Something isn't working | 缺陷 label Oct 23, 2024
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Oct 23, 2024
@lobehubbot
Copy link
Member

👀 @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
Copy link
Member

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

@CaffeineCM CaffeineCM changed the title [Bug] [Bug] 对话中使用图片报错 Oct 23, 2024
Copy link

dosubot bot commented Oct 23, 2024

@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
Copy link
Author

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

@lobehubbot
Copy link
Member

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
Copy link
Contributor

arvinxx commented Oct 23, 2024

试试 LLM_VISION_IMAGE_USE_BASE64=1

@lobehubbot
Copy link
Member

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


Try LLM_VISION_IMAGE_USE_BASE64=1

@CaffeineCM
Copy link
Author

CaffeineCM commented Oct 23, 2024

试试LLM_VISION_IMAGE_USE_BASE64=1

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

@lobehubbot
Copy link
Member

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…

@CaffeineCM
Copy link
Author

更新到最新版本 v1.22.26仍然存在该问题

@lobehubbot
Copy link
Member

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


Updated to the latest version v1.22.26 and the problem still exists

@SpeedupMaster
Copy link
Contributor

MINIO_LOBE_BUCKET=lobe 改成MINIO_LOBE_BUCKET=casdoor 试试

@lobehubbot
Copy link
Member

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


Change MINIO_LOBE_BUCKET=lobe to MINIO_LOBE_BUCKET=casdoor and try

@CaffeineCM
Copy link
Author

MINIO_LOBE_BUCKET=lobe 改成MINIO_LOBE_BUCKET=casdoor 试试

感觉你提供的方法,但是刚刚我尝试过了,这样修改不行,并且用报错的信息去访问无法访问到图片,需要将url中的casdoor改为lobe才能访问到
20241024165641

@lobehubbot
Copy link
Member

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


Change MINIO_LOBE_BUCKET=lobe to MINIO_LOBE_BUCKET=casdoor and try

I feel like the method you provided, but I just tried it. This modification does not work, and the image cannot be accessed using the error message. You need to change the casdoor in the URL to lobe to access it.
20241024165641

@SpeedupMaster
Copy link
Contributor

image
新的Access Key 和 Secret Key有在.env里面更改吗?

@lobehubbot
Copy link
Member

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


image
Have the new Access Key and Secret Key been changed in .env?

@lobehubbot
Copy link
Member

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


lobe

No changes, I just replaced the IP

@CaffeineCM
Copy link
Author

image 新的Access Key 和 Secret Key有在.env里面更改吗?

没有改,我就只替换了ip

@lobehubbot
Copy link
Member

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


image 新的Access Key 和Has the Secret Key been changed in .env?

No changes, I just replaced the IP

@CaffeineCM
Copy link
Author

image 新的Access Key 和 Secret Key有在.env里面更改吗?

我看文档中的意思,理解成了:如果不需要用户自行修改头像,后续步骤就不用管了

@lobehubbot
Copy link
Member

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


![image](https://private-user-images.githubusercontent.com/130642629/379697158-889259ee-2c53-4263-8d36-73d29b5ca8ef.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3Mi OiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mjk3NjEzNzAsIm5iZiI6MTcyOTc2MTA3MCwicGF0aCI6Ii8xMzA2NDI2 MjkvMzc5Njk3MTU4LTg4OTI1OWVlLTJjNTMtNDI2My04ZDM2LTczZDI5YjVjYThlZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRF lMU0E1M1BRSzRaQSUyRjIwMjQxMDI0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MTAyNFQwOTExMTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16 LVNpZ25hdHVyZT00NzI0NjI2MzlmODRkODYzNGZiYjA4NzIxNTQxNjQxMzdmMWZkMGMyM jc2MTU3Njg0YWE3NjZmNzk5YjA3Nzk3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.zQ a7nL6pM83_P0SGKjc3S1jXDrkNdT-tgvJKCLsVEYA) New Access Have the Key and Secret Key been changed in .env?

I read the meaning in the document and understood it to be: If the user does not need to modify the avatar by himself, there is no need to worry about the subsequent steps.

@CaffeineCM
Copy link
Author

image 新的Access Key 和 Secret Key有在.env里面更改吗?

按照教程配置了,.env里也替换了新的Access Key 和 Secret Key,桶名在.env和casdoor中都配置为lobe,仍然有同样的问题

@lobehubbot
Copy link
Member

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


![image](https://private-user-images.githubusercontent.com/130642629/379697158-889259ee-2c53-4263-8d36-73d29b5ca8ef.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3Mi OiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mjk3NjI1NDUsIm5iZiI6MTcyOTc2MjI0NSwicGF0aCI6Ii8xMzA2NDI2 MjkvMzc5Njk3MTU4LTg4OTI1OWVlLTJjNTMtNDI2My04ZDM2LTczZDI5YjVjYThlZi5wbmc_WC1 BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFl MU0E1M1BRSzRaQSUyRjIwMjQxMDI0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MTAyNFQwOTMwNDVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16 LVNpZ25hdHVyZT1lYjBlMDkzZjA1ZWQ3MjFkZThiNTIwZTE3NmU0YmViN2U3MDZmZjJkMm M3Y2JiNTBiYjZiNWYzNGE0Yjg2ZGRjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.WJ6 3hvAIewIzRMHwmqLR-ooOSkC-rxxFe4312GZ-p_0 ) Have the new Access Key and Secret Key been changed in .env?

I configured it according to the tutorial, and replaced the new Access Key and Secret Key in .env. The bucket name was configured as lobe in both .env and casdoor, but I still have the same problem.

@SpeedupMaster
Copy link
Contributor

image 新的Access Key 和 Secret Key有在.env里面更改吗?

按照教程配置了,.env里也替换了新的Access Key 和 Secret Key,桶名在.env和casdoor中都配置为lobe,仍然有同样的问题

直接用localhost有没有问题?

@lobehubbot
Copy link
Member

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


! [Image] (https://private- user-images.githubuserContent.com/130642629/379697158-889259ee-2C53-4263-73D29B5Ca8ef.png?jwt=ey JHBGCIOJIUZIISINR5CCI6IKPXVCJ9.EYJPC3MIOIJNAXRODWIUY29TIIWIY XVKIJOICMF3LMDPDGH1YNVZZZCCIIJNAXRODWIUY29TIIGH1YNLMNVBSVBSIMTLETUILCJLE Haioje3mjk3nji1ndusim5izii6MTCyotc2MJI0NSWICGF0ACI6II8XMZA2NDI 2MJKVMZC5NJK3MTG4OTG4oti1VlltjNDM2Ltczzdi5yjvjy Thlzi5WBMC_WC_WC_WC_WCQWXNB3JPDGHTGHTPUFXUZQTSE1BQY1TSEEYMWC1BBXOTQ3JLZGLHBD1BS0LBVKNPRFLMUYRJQXMDI0jtjg DXMTZWFZDC0XJGCZMLMKZHD3M0X3JLCXVLC3QMWC1BBXOTRGF0ZT0YMDI0MT AynfQWOTMWNDVAJLGTQW16CGLYZXM9MZAW16LVNPZ25HDHVYZT1L Yjblmdkzzja1zwq3mjfkzthinTiwzte3nMu0ymvin2u3mdzmzjjkmmm3y2jintbi IWizrmhwmqlr-Oooskc-RXXFE4312GZ- p_0) Have the new Access Key and Secret Key been changed in .env?

Configured according to the tutorial, replaced the new Access Key and Secret Key in .env, and configured the bucket name as lobe in both .env and casdoor, but still have the same problem

Is there any problem using localhost directly?

@SpeedupMaster
Copy link
Contributor

我在VPS上用IP试了下没问题

@lobehubbot
Copy link
Member

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


I tried using IP on VPS and it worked fine.

@CaffeineCM
Copy link
Author

我在VPS上用IP试了下没问题

我全部重新部署试一下,感谢您的解答

@lobehubbot
Copy link
Member

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


I tried using IP on VPS and it worked fine.

I'll redeploy everything and give it a try. Thank you for your answer.

@CaffeineCM
Copy link
Author

我在VPS上用IP试了下没问题

请问一下是否需要ip为公网ip呢,我是局域网部署的,刚刚重新部署了一下,发现仍然存在这个问题。哪怕我将桶设置为public都不行

@lobehubbot
Copy link
Member

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


I tried using IP on VPS and it worked fine.

I would like to ask if the IP needs to be a public IP. I deployed it on the LAN. I just redeployed it and found that this problem still exists. It doesn't work even if I set the bucket to public

@SpeedupMaster
Copy link
Contributor

我在VPS上用IP试了下没问题

请问一下是否需要ip为公网ip呢,我是局域网部署的,刚刚重新部署了一下,发现仍然存在这个问题。哪怕我将桶设置为public都不行

局域网就不太清楚了,没试过

@lobehubbot
Copy link
Member

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


I tried using IP on VPS and it worked fine.

I would like to ask if the IP needs to be a public IP. I deployed it on the LAN. I just redeployed it and found that this problem still exists. It doesn't work even if I set the bucket to public

I'm not sure about the LAN, I haven't tried it yet.

@CaffeineCM
Copy link
Author

我在VPS上用IP试了下没问题

请问一下是否需要ip为公网ip呢,我是局域网部署的,刚刚重新部署了一下,发现仍然存在这个问题。哪怕我将桶设置为public都不行

局域网就不太清楚了,没试过

您好,我刚试了一下,确实是局域网的问题,我将minio的端口开公网,docker-compose.yml中的lobe.environment中minio相关的ip改为域名,casdoor也改为域名,再次尝试对话,能够成功解析。

@github-project-automation github-project-automation bot moved this from Roadmap - Chat 1.x to Done in Lobe Chat Routine Oct 24, 2024
@lobehubbot
Copy link
Member

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


I tried using IP on VPS and it worked fine.

I would like to ask if the IP needs to be a public IP. I deployed it on the LAN. I just redeployed it and found that this problem still exists. It doesn't work even if I set the bucket to public

I’m not sure about LAN, I haven’t tried it yet

Hello, I just tried it, and it is indeed a LAN problem. I opened the minio port to the public network, changed the minio-related IP in lobe.environment in docker-compose.yml to the domain name, and changed the casdoor to the domain name. Again Try the conversation and it can be parsed successfully.

@lobehubbot
Copy link
Member

@CaffeineCM

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

@CaffeineCM
Copy link
Author

@arvinxx 您好,这个问题已经找到解决方案,但是对没有公网ip的小伙伴来说,明显不是很友好,辛苦看下能否优化一下这个问题

@lobehubbot
Copy link
Member

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


@arvinxx Hello, a solution has been found for this problem, but it is obviously not very friendly to friends who do not have a public IP address. Let’s see if we can optimize this problem.

@arvinxx
Copy link
Contributor

arvinxx commented Oct 25, 2024

LLM_VISION_IMAGE_USE_BASE64=1 这个应该有用的吧,你是不是开启了客户端请求额

@lobehubbot
Copy link
Member

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


LLM_VISION_IMAGE_USE_BASE64=1 This should be useful. Have you enabled the client request amount?

@arvinxx
Copy link
Contributor

arvinxx commented Oct 25, 2024

相关参考:#3888

@CaffeineCM
Copy link
Author

LLM_VISION_IMAGE_USE_BASE64=1 这个应该有用的吧,你是不是开启了客户端请求额

是开了,我试一下关掉公网ip映射,关掉客户端请求试试看

@lobehubbot
Copy link
Member

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


LLM_VISION_IMAGE_USE_BASE64=1 This should be useful. Have you enabled the client request amount?

It is enabled. Let me try turning off the public IP mapping and turning off client requests.

@CaffeineCM
Copy link
Author

LLM_VISION_IMAGE_USE_BASE64=1 这个应该有用的吧,你是不是开启了客户端请求额

确实,是客户端请求的问题,感谢

@lobehubbot
Copy link
Member

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


LLM_VISION_IMAGE_USE_BASE64=1 This should be useful. Have you enabled the client request amount?

Indeed, it is a problem with the client request, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Archived in project
Development

No branches or pull requests

4 participants