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

Google API 配置报错 #7013

Open
s906903912 opened this issue Mar 17, 2025 · 8 comments
Open

Google API 配置报错 #7013

s906903912 opened this issue Mar 17, 2025 · 8 comments
Labels
Gemini unconfirm 未被维护者确认的问题

Comments

@s906903912
Copy link

📦 部署环境

Docker

📦 部署模式

服务端模式(lobe-chat-database 镜像)

📌 软件版本

1.71.5

💻 系统环境

Other Linux

🌐 浏览器

Chrome

🐛 问题描述

.ENV中配置Google API key 和 PROXY url 前端检查会报错:
[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-lite:streamGenerateContent?alt=sse: fetch failed
Image

不通过配置文件配置,可以检查通过
Image

📷 复现步骤

No response

🚦 期望结果

No response

📝 补充信息

No response

@s906903912 s906903912 added the unconfirm 未被维护者确认的问题 label Mar 17, 2025
@lobehubbot
Copy link
Member

👀 @s906903912

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。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@dosubot dosubot bot added the Gemini label Mar 17, 2025
Copy link

dosubot bot commented Mar 17, 2025

@s906903912 你好!我是Dosu,一个可以帮助你解决bug、回答问题并成为贡献者的机器人。我会在等待人类维护者的时候帮助你。期待和你一起解决问题!🤖

I found a similar discussion regarding Google API configuration issues in Lobe Chat. The discussion mentions that Google's AI SDK currently does not support setting a BASE_URL, and integration on the Lobe Chat side will be possible once this feature is implemented by Google. As a workaround, it is suggested to consider deploying using Vercel to bypass regional restrictions [1].

For configuring the Google API key and PROXY URL in the .ENV file, the format should be as follows:

# GOOGLE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

For the PROXY URL, while there is no specific configuration mentioned for Google AI, you can adapt the example provided for OpenAI if needed:

# OPENAI_PROXY_URL=https://api.openai.com/v1

You can replace OPENAI_PROXY_URL with a similar variable for Google if required, although it is not explicitly mentioned in the provided documentation [2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@s906903912
Copy link
Author

我是用官网的Google API,只配置GOOGLE_API_KEY不行。
配置 GOOGLE_API_KEY + GOOGLE_PROXY_URL 也不行

@lobehubbot
Copy link
Member

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


I use the Google API of the official website, and only configuring GOOGLE_API_KEY cannot be done.
It is also not possible to configure GOOGLE_API_KEY + GOOGLE_PROXY_URL

@arvinxx
Copy link
Contributor

arvinxx commented Mar 17, 2025

fetch failed 是没连通吧?你配置的 GOOGLE_PROXY_URL 是不是连接不上?

@s906903912
Copy link
Author

服务器上可以通的,直接服务器上curl也是好的

@lobehubbot
Copy link
Member

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


It can be accessed on the server, and curl directly on the server is also good

@bbbugg
Copy link
Contributor

bbbugg commented Mar 17, 2025

vercel上部署没出现该问题,只在环境变量里填写了key
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gemini unconfirm 未被维护者确认的问题
Projects
None yet
Development

No branches or pull requests

4 participants