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.7k stars 9.81k forks source link

[Bug] 数据库版无法通过url导入api配置 #4479

Open Smart-SangGe opened 4 days ago

Smart-SangGe commented 4 days ago

📦 部署环境

Docker

📌 软件版本

1.22.20

💻 系统环境

Other Linux

🌐 浏览器

Chrome

🐛 问题描述

无法通过url导入配置。 根据文档 https://lobehub.com/zh/docs/self-hosting/advanced/settings-url-share 我将类似的setting复制到我的lobe网址后面,但是总是重定向到 /welcome 路径中。

📷 复现步骤

No response

🚦 期望结果

通过url,能正确导入配置开始聊天界面

📝 补充信息

No response

lobehubbot commented 4 days ago

👀 @Smart-SangGe

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[bot] commented 4 days ago

@Smart-SangGe 你好!我是Dosu,一个可以帮助您解决错误、回答问题并成为贡献者的机器人。在等待人类维护者的过程中,我会尽力帮助您。

I couldn't find specific information about the reasons for redirection to the /welcome path when importing settings via URL in the repository. However, it's important to ensure that your JSON settings are correctly formatted and complete, as incorrect formatting might cause issues. The URL format should be:

https://lobehub.com/?settings=<JSON格式的设置对象>

Make sure that the JSON object is properly structured and includes all necessary fields. If the issue persists, it might be helpful to check for any error messages or logs that could provide more insight into the problem. The handleError function in the codebase captures errors and provides detailed information through the onError callback, which might help diagnose the issue [1].

To continue talking to Dosu, mention @dosu.

arvinxx commented 4 days ago

是不是没登录

lobehubbot commented 4 days ago

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


Are you not logged in?

Smart-SangGe commented 4 days ago

@arvinxx 是登录的状态。我看在控制台看 /welcome 的 referer 是 url/?setting=json 的那个网址,具体跳转逻辑我没细看。

arvinxx commented 4 days ago

你的配置参数发出来看看

lobehubbot commented 4 days ago

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


Send your configuration parameters and take a look.

Smart-SangGe commented 3 days ago
APP_URL=https://lobe.domain/
KEY_VAULTS_SECRET=xxx
DATABASE_URL=postgresql://postgres:xxx@postgresql:5432/lobe
NEXT_AUTH_SECRET=xxx
NEXT_AUTH_SSO_PROVIDERS=logto
NEXTAUTH_URL=https://lobe.domain/api/auth
AUTH_LOGTO_ID=xxx
AUTH_LOGTO_SECRET=xxx
AUTH_LOGTO_ISSUER=https://lobe-auth-api.domain/oidc
HTTP_PROXY=http://xxx
HTTPS_PROXY=http://xxx
S3_ACCESS_KEY_ID=xxx
S3_SECRET_ACCESS_KEY=xxx
S3_ENDPOINT=https://lobe-s3-api.domain
S3_BUCKET=xxx
S3_PUBLIC_DOMAIN=https://lobe-s3-api.domain
S3_ENABLE_PATH_STYLE=1
FEATURE_FLAGS="-check_updates,-welcome_suggest,-market"

具体的请求是

https://lobe.domain/?settings={"keyVaults":{"openai":{"apiKey":"xxx","baseURL":"https://api.domain/v1"}}}
arvinxx commented 3 days ago

@cy948 来帮忙看看?

lobehubbot commented 3 days ago

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


@cy948 Come and help?

cy948 commented 3 days ago

@arvinxx 最近有变更过初始化 store 吗? 我在数据库 1.18 上是测试成功的,在 1.24 上测试不成功。

lobehubbot commented 3 days ago

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


@arvinxx Have you changed the initialization store recently? I tested successfully on database 1.18, but failed on 1.24.

cy948 commented 3 days ago

@Smart-SangGe 临时方案,先这样导入

https://lobe.domain/chat?settings={"keyVaults":{"openai":{"apiKey":"xxx","baseURL":"https://api.domain/v1"}}}
lobehubbot commented 3 days ago

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


@Smart-SangGe Temporary solution, import it like this first

https://lobe.domain/chat?settings={"keyVaults":{"openai":{"apiKey":"xxx","baseURL":"https://api.domain/v1"}}}
Smart-SangGe commented 3 days ago

我目前问题的复现方式找到了。我是把openai的开关关闭了,使用

https://lobe.domain/?settings={"keyVaults":{"openai":{"apiKey":"xxx","baseURL":"https://api.domain/v1"}}}

方式访问时,就会跳转至/welcome。而打开openai开关时,上述方式可以正常导入。

对于临时方案

https://lobe.domain/chat?settings={"keyVaults":{"openai":{"apiKey":"xxx","baseURL":"https://api.domain/v1"}}}

可以在不论openai开关的情况下导入。

我觉得大致的问题算是清楚了,issue就看两位开发者决定是现在关还是修复之后关吧

lobehubbot commented 3 days ago

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


I found a way to reproduce my current problem. I turned off the openai switch and used

https://lobe.domain/?settings={"keyVaults":{"openai":{"apiKey":"xxx","baseURL":"https://api.domain/v1"}}}

When accessed via this method, it will jump to /welcome. When the openai switch is turned on, the above method can be imported normally.

For temporary solutions

https://lobe.domain/chat?settings={"keyVaults":{"openai":{"apiKey":"xxx","baseURL":"https://api.domain/v1"}}}

It can be imported regardless of the openai switch.

I think the general issue is clear. It depends on the two developers to decide whether to close the issue now or after it is fixed.

arvinxx commented 2 days ago

@cy948 /?settings= 这个估计和 首屏 loading 页的 useEffect 时序上冲突了。

https://github.com/lobehub/lobe-chat/blob/main/src/app/(loading)/Redirect.tsx#L21-L46

得想想怎么处理比较合适

lobehubbot commented 2 days ago

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


@cy948 /?settings= This estimate conflicts with the useEffect timing of the first screen loading page.

https://github.com/lobehub/lobe-chat/blob/main/src/app/(loading)/Redirect.tsx#L21-L46

I have to think about how to deal with it more appropriately.