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] 自定义供应商使用客户端请求获取模型时还是走的服务端请求 #6964

Open
Borber opened this issue Mar 14, 2025 · 3 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@Borber
Copy link

Borber commented Mar 14, 2025

📦 Platform

Official Preview

📦 Deploymenet mode

client pgelite db (lobe-chat-pglite image)

📌 Version

v1.71.0

💻 Operating System

Windows

🌐 Browser

Chrome

🐛 Bug Description

Image

📷 Recurrence Steps

No response

🚦 Expected Behavior

自定义供应商客户端请求, 请直接使用客户端好吗?

📝 Additional Information

No response

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

👀 @Borber

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

Copy link

dosubot bot commented Mar 14, 2025

The issue you're experiencing seems to be related to the lobe-chat framework not correctly routing requests to the client when using a custom provider. The configuration for custom AI providers is handled in the src/services/aiProvider/index.ts file, and it determines whether requests are made from the client or server based on the NEXT_PUBLIC_SERVICE_MODE environment variable. If this is set to 'server', it uses ServerService; otherwise, it uses ClientService [1].

Additionally, the logic for determining whether to fetch from the client is detailed in src/store/aiInfra/slices/aiProvider/selectors.ts. It includes conditions such as:

  1. If no baseUrl and apikey are provided, it forces the request to be made on the server.
  2. If only baseUrl is provided, it forces the request to be made on the client.
  3. It follows user settings if specified.
  4. By default, requests are made on the server [2].

To resolve your issue, ensure that the NEXT_PUBLIC_SERVICE_MODE is correctly set to enable client-side requests, and verify that your provider configuration meets the conditions for client-side fetching.

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

Copy link

dosubot bot commented Mar 14, 2025

The issue you're experiencing seems to be related to the lobe-chat framework not using client-side requests for custom providers, even when configured to do so in the client pgelite db deployment mode. In version v1.71.0, there might be a configuration or implementation issue causing the requests to still be routed through the server.

To address this, ensure that the client-side fetching is correctly enabled for your custom provider. According to the expected behavior in the framework, client-side fetching should be enabled if an endpoint is provided [1]. Double-check your configuration settings to ensure that the endpoint is correctly set and that any necessary API keys are provided.

If the issue persists, it might be a bug specific to version v1.71.0, as there are no specific changes or known issues documented for this version related to custom provider requests [1]. You may want to verify if there are any updates or patches available that address this behavior.

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

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
Status: Roadmap - Chat 1.x
Development

No branches or pull requests

2 participants