-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
✨ feat: Support Doubao Models #3055
Conversation
@sxjeru is attempting to deploy a commit to the LobeHub Pro Team on Vercel. A member of the Team first needs to authorize it. |
👍 @sxjeru Thank you for raising your pull request and contributing to our Community |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3055 +/- ##
========================================
Coverage 92.30% 92.30%
========================================
Files 498 500 +2
Lines 36243 36363 +120
Branches 3293 3446 +153
========================================
+ Hits 33454 33565 +111
- Misses 2789 2798 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
独立终结点的模式比较像 Azure 的吧?是不是可以参考 azure 的方案来? |
The independent endpoint model is more like Azure's, right? Is it possible to refer to the azure solution? |
所以,这个模型还有希望支持吗 |
So, is there any hope of supporting this model? |
@Sam5440 |
@Sam5440 |
感觉可以参考ChatGPT-Next-Web他们的处理方式 |
I feel like you can refer to ChatGPT-Next-Web for their handling methods. |
@davaded 感谢提醒,差点忘了 lobechat 也支持环境变量端添加 model 来着。 |
@davaded Thanks for the reminder, I almost forgot that lobechat also supports adding model on the environment variable side. |
豆包毕竟是特例,这种在环境变量上操作是最简单的我觉得,期待你的成功,成功后记得call me |
Doubao is a special case after all. This kind of operation on environment variables is the simplest. I look forward to your success. Remember to call me after success. |
怎么样了 |
how's it going |
算是能正常用了,通过在环境变量中预配模型。还有问题需要解决,这边也没啥思路。 |
It works, but there are still problems that need to be solved, and there is no idea here. |
@sxjeru 豆包的实现应该参考 azure 这样的来,azure 也有 deploymentId 的 |
@sxjeru The implementation of beanbag should refer to azure. Azure also has deploymentId. |
@arvinxx 其实没有那么复杂。 豆包不需要独立终结点,只是独立 model id,这点相当于在前端手动添加模型,这是 Lobechat 早已实现了的。 |
@arvinxx It’s not that complicated. Doubao does not require an independent endpoint, only an independent model id. This is equivalent to manually adding a model on the front end, which Lobechat has already implemented. |
@sxjeru azure 每个都是独立 model id 的模式。Azure 的语法我也设计了:
详见: https://lobehub.com/zh/docs/self-hosting/environment-variables/model-provider#azure-model-list 在Doubao的场景下我理解就等价于: doubao_1->user_model_id=豆包模型1 |
@sxjeru azure Each is a schema with an independent model id. I also designed the Azure syntax:
For details, see: https://lobehub.com/zh/docs/self-hosting/environment-variables/model-provider#azure-model-list In Doubao's scenario, I understand it to be equivalent to: doubao_1->user_model_id=doubao model 1 |
可以配置禁用客户端请求,参考下 huggingface 的配置即可 |
CORS can be configured to disable, please refer to the configuration of huggingface. |
这个也参考 Azure 的就好, 直接默认指定一个基础模型,然后用需要在环境变量中添加这个模型以及它的 deployName。走 Azure 模式时会自动替换成请求 deployName 的 |
Just refer to Azure for this. Directly specify a basic model by default, and then add this model and its deployName to the environment variables as needed. If you use Azure mode, it will be automatically replaced by requesting deployName. |
@arvinxx DOUBAO_MODEL_LIST 设置似乎有矛盾,不清楚 Azure 那边的逻辑是怎样的。 若设置 ep-2024xxxx-xxxx->Doubao-pro-32k=1234,聊天时 model 正确传参 ep-2024xxxx-xxxx,但连通性检查时会传递 Doubao-pro-32k,导致检查失败。 如果交换顺序设成 Doubao-pro-32k->ep-2024xxxx-xxxx=1234,连通性检查正常,无法聊天。 |
@arvinxx There seems to be a contradiction in the DOUBAO_MODEL_LIST settings. I don’t know what the logic is on Azure’s side. If ep-2024xxxx-xxxx->Doubao-pro-32k=1234 is set, the model parameter ep-2024xxxx-xxxx is correctly passed during chat, but Doubao-pro-32k is passed during connectivity check, causing the check to fail. If the exchange sequence is set to Doubao-pro-32k->ep-2024xxxx-xxxx=1234, the connectivity check is normal and chat cannot be done. |
之前是因为只有 Azure ,所以这里写死了判断,感觉既然doubao和azure一样,那么这部分的判断完全可以收敛成一个 ProviderCard 的配置,比如叫 lobe-chat/src/services/chat.ts Lines 255 to 267 in 3e467ae
|
Previously, because there was only Azure, the judgment was hard-coded here. I feel that since doubao is the same as azure, this part of the judgment can be completely condensed into a ProviderCard configuration, such as lobe-chat/src/services/chat.ts Lines 255 to 267 in 3e467ae
|
标准写法应该是 |
The standard writing method should be |
@sxjeru 来 rebase 下?还是重新提个 PR ? |
@sxjeru Come to rebase? Or submit a PR again? |
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
参考 #2804 实现,已初步实现聊天。
src/config/modelProviders/doubao.ts
才可进行聊天。不知该如何实现,其他模型也有类似问题参考 Azure 已实现)关于第一点,暂定解决方案是使用环境变量预配,如:
DOUBAO_MODEL_LIST = Doubao-pro-32k->ep-2024xxxx-xxxx=displayName
其中 Doubao-pro-32k 是 deploymentName,请参考 src/config/modelProviders/doubao.ts
参考:https://lobehub.com/zh/docs/self-hosting/environment-variables/model-provider#azure-model-list
📝 补充信息 | Additional Information
模型支持 image_url,暂未适配。根据文档,v3 api 接口暂不支持 image_url。
https://www.volcengine.com/docs/82379/1298454
不确定本 PR 是否还有必要完善,考虑第一个比较严重的问题,很可能会被砍掉。close #5095