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] Docker安装使用 NEXT_PUBLIC_CUSTOM_MODELS 变量自定义模型问题 #509

Closed
lgl1996521 opened this issue Nov 24, 2023 · 39 comments · Fixed by #514 or #773
Closed

[Bug] Docker安装使用 NEXT_PUBLIC_CUSTOM_MODELS 变量自定义模型问题 #509

lgl1996521 opened this issue Nov 24, 2023 · 39 comments · Fixed by #514 or #773
Assignees
Labels
🐛 Bug Something isn't working | 缺陷 released

Comments

@lgl1996521
Copy link

💻 系统环境 | Operating System

Windows

🌐 浏览器 | Browser

Chrome

🐛 问题描述 | Bug Description

Docker安装使用 NEXT_PUBLIC_CUSTOM_MODELS 变量自定义模型没有效果,安装好以后还是显示默认的几个模型

🚦 期望结果 | Expected Behavior

No response

📷 复现步骤 | Recurrence Steps

No response

📝 补充信息 | Additional Information

No response

@lgl1996521 lgl1996521 added the 🐛 Bug Something isn't working | 缺陷 label Nov 24, 2023
@lobehubbot
Copy link
Member

👀 @lgl1996521

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

@mushan0x0
Copy link
Contributor

NEXT_开头的环境变量要写到.env文件里,比如.env.production

@lgl1996521
Copy link
Author

QQ浏览器截图20231125140146
非常感谢,但是我不会设置,可以告诉我该怎么写吗,我是用群晖docker安装的

@lobehubbot
Copy link
Member

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


QQ browser screenshot 20231125140146
Thank you very much, but I don’t know how to set it up. Can you tell me how to write it? I installed it using Synology docker.

@arvinxx
Copy link
Contributor

arvinxx commented Nov 25, 2023

我晚点试下

@arvinxx arvinxx self-assigned this Nov 25, 2023
@lobehubbot
Copy link
Member

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


I'll try it later

@lgl1996521
Copy link
Author

怎么样了,试了吗?

@lobehubbot
Copy link
Member

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


How's it going? Have you tried it?

@mushan0x0
Copy link
Contributor

我试了没问题的,你需要在项目里面新建一个.env.production文件,然后在里面添加一行:

NEXT_PUBLIC_CUSTOM_MODELS=model1,model2,model3

然后把这个文件 push 到项目里就行了

@lobehubbot
Copy link
Member

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


I tried it with no problem. You need to create a new .env.production file in the project, and then add a line in it:

NEXT_PUBLIC_CUSTOM_MODELS=model1,model2,model3

Then just push this file to the project

@lgl1996521
Copy link
Author

QQ截图20231126010450
是这样吗?

@lobehubbot
Copy link
Member

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


QQ screenshot 20231126010450
is that so?

@mushan0x0
Copy link
Contributor

还有你的 docker 镜像不能直接使用 lobehub/lobe-chat,需要自己构建发布一个,因为公共的 lobehub/lobe-chat 镜像里面没有你添加的 .env.production 文件

@arvinxx
Copy link
Contributor

arvinxx commented Nov 27, 2023

怎么样了,试了吗?

@lgl1996521 我试了下的确不行,应该是 Dockerfile 里需要补充支持该变量

@lobehubbot
Copy link
Member

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


How's it going? Have you tried it?

@lgl1996521 I tried it but it didn’t work. It should be that the Dockerfile needs to support this variable.

@lobehubbot
Copy link
Member

@lgl1996521

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

@lobehubbot
Copy link
Member

🎉 This issue has been resolved in version 0.105.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@arvinxx arvinxx reopened this Nov 27, 2023
@lgl1996521
Copy link
Author

新版本我尝试了一下还是不
行,模型变量填上去了但是前端还是没有显示,而且出现了一个新的问题,之前的版本是好的
QQ截图20231128132048

@lobehubbot
Copy link
Member

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


I tried the new version and it still doesn’t work.
OK, the model variables are filled in but the front end still doesn’t display it, and a new problem arises. The previous version was fine.
QQ screenshot 20231128132048

@mushan0x0
Copy link
Contributor

mushan0x0 commented Nov 28, 2023

NEXT_PUBLIC_ 开头的变量是 next build 的时候用的,docker 的环境变量是运行时用的,所以没有效果:
vercel/next.js#34875 (comment)
https://nextjs.org/docs/pages/building-your-application/deploying#environment-variables

有两种解决办法:
1.在 https://github.com/lobehub/lobe-chat/blob/main/Dockerfile#L18 运行 build 命令的时候将每个NEXT_PUBLIC_开头的变量传进去,参考 vercel/next.js#17641 (comment) ,但是这样不方便,变量多了难以维护
2.用 getServerSideProps,获取服务端的环境变量 https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#server-side-rendering-getserversideprops

@lobehubbot
Copy link
Member

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


The variables at the beginning of NEXT_PUBLIC_ are used during next build. The environment variables of docker are used during runtime, so they have no effect:
vercel/next.js#34875 (comment)
https://nextjs.org/docs/pages/building-your-application/deploying#environment-variables

There are two solutions:

  1. When running the build command at https://github.com/lobehub/lobe-chat/blob/main/Dockerfile#L18, pass in each variable starting with NEXT_PUBLIC_, refer to https://github.com/ docker image with NEXT_PUBLIC_ env variables vercel/next.js#17641#discussioncomment-339555, but this is inconvenient, and it is difficult to maintain due to too many variables.
  2. Write a getServerSideProps interface to obtain the environment variables of the server and filter out content that does not begin with NEXT_PUBLIC_, but this means that many places that need to use this variable need to request this interface in advance.

@arvinxx
Copy link
Contributor

arvinxx commented Nov 28, 2023

有两种解决办法:
1.在 https://github.com/lobehub/lobe-chat/blob/main/Dockerfile#L18 运行 build 命令的时候将每个NEXT_PUBLIC_开头的变量传进去,参考 vercel/next.js#17641 (comment) ,但是这样不方便,变量多了难以维护

感谢输入,我之前真不知道有这个情况。晚点我再试试看怎么解这个问题。

@lobehubbot
Copy link
Member

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


There are two solutions:

  1. When running the build command at https://github.com/lobehub/lobe-chat/blob/main/Dockerfile#L18, pass in each variable starting with NEXT_PUBLIC_, refer to docker image with NEXT_PUBLIC_ env variables vercel/next.js#17641 (comment ), but this is inconvenient and difficult to maintain due to too many variables.

Thanks for the input, I didn't know this existed before. I'll try to figure out how to solve this problem later.

@Eobravo
Copy link

Eobravo commented Dec 13, 2023

有两种解决办法:
1.在 https://github.com/lobehub/lobe-chat/blob/main/Dockerfile#L18 运行 build 命令的时候将每个NEXT_PUBLIC_开头的变量传进去,参考 vercel/next.js#17641 (comment) ,但是这样不方便,变量多了难以维护

感谢输入,我之前真不知道有这个情况。晚点我再试试看怎么解这个问题。

我也是docker部署的,部署在Azure webapp,设置了next_public_custom_models不生效,请问需要如何解决?
image
image

@lobehubbot
Copy link
Member

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


There are two solutions:

  1. When running the build command at https://github.com/lobehub/lobe-chat/blob/main/Dockerfile#L18, pass each variable starting with NEXT_PUBLIC_, refer to vercel/next.js# 17641 (comment) , but this is inconvenient and it is difficult to maintain due to too many variables.

Thanks for the input, I really didn't know this happened before. I'll try to figure out how to solve this problem later.

I also deployed it with docker and deployed it on Azure webapp. Setting next_public_custom_models does not take effect. How can I solve it?
image
image

@arvinxx
Copy link
Contributor

arvinxx commented Dec 13, 2023

我也是docker部署的,部署在Azure webapp,设置了next_public_custom_models不生效,请问需要如何解决?

我会作为bug 修复的,请耐心等候一段时间❤️

@lobehubbot
Copy link
Member

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


I also deployed it with docker and deployed it on Azure webapp. Setting next_public_custom_models does not take effect. How can I solve it?

I will fix it as a bug, please wait patiently for a while❤️

@MrDgbot
Copy link

MrDgbot commented Dec 20, 2023

有进展了吗?

@lobehubbot
Copy link
Member

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


Is there any progress?

@arvinxx
Copy link
Contributor

arvinxx commented Dec 20, 2023

@MrDgbot 计划本周内修复

@lobehubbot
Copy link
Member

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


@MrDgbot plans to fix it this week

@lobehubbot
Copy link
Member

@lgl1996521

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

@lobehubbot
Copy link
Member

🎉 This issue has been resolved in version 0.115.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@arvinxx
Copy link
Contributor

arvinxx commented Dec 23, 2023

尝试使用 CUSTOM_MODELS 变量试试

@lobehubbot
Copy link
Member

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


Try using the CUSTOM_MODELS variable

@MrDgbot
Copy link

MrDgbot commented Dec 23, 2023

现在去测一下

@lobehubbot
Copy link
Member

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


Go test it now

@arvinxx
Copy link
Contributor

arvinxx commented Dec 23, 2023

@MrDgbot docker镜像还在自动构建中,估计要等个半小时吧 https://github.com/lobehub/lobe-chat/actions/runs/7307129924

@lobehubbot
Copy link
Member

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


@MrDgbot The docker image is still being built, it will probably take half an hour.

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