-
Notifications
You must be signed in to change notification settings - Fork 666
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
采用了node方式启动项目,在新建的项目根目录下放了修改后的.env
和.migpt.js
文件,但是仍然报错提示Missing userId or password.
#19
Comments
在你自己的 Node 项目里导包,需要把 .migpt.js 里的参数放到 MiGPT 对象初始化参数,具体看 example 分支的示例代码。 |
外部引用 mi-gpt package 需要在你自己的项目里传入初始化参数,并确保正确读取了环境变量。此时 mi-gpt 不会主动读取并解析根目录的 .ENV 和 .migpt.js。 |
手动引入了.ENV 和 .migpt.js,同时打印了process.env,发现了.env 已经生效,但是仍然报了401的错误 2024/06/03 02:39:26 Open AI ❌ ❌ openai chat failed AuthenticationError: 401 Invalid Authentication |
未复现,请检查你的 API_KEY 是否可用。 |
2024/06/18 13:42:35 database ❌ 初始化数据库失败! Error: ❌ Assertion failed Node.js v20.14.0 |
@smallfawn 发下你的项目代码,和启动命令。最好给一个最小可复现代码仓库。另外,你可以尝试切换到 example 分支运行演示代码(切换后删掉旧的node_models然后 pnpm i 重新安装依赖),看看是否正常。 |
D:\document\Github\mi-gpt-2> node main.js
2024/06/03 01:33:07 MiGPT ❌ Missing userId or password.
file:///D:/document/Github/mi-gpt-2/node_modules/.pnpm/mi-gpt@2.1.1/node_modules/mi-gpt/dist/index.js:231
throw Error("\u274C Assertion failed");
^
Error: ❌ Assertion failed
at _LoggerManager.assert (file:///D:/document/Github/mi-gpt-2/node_modules/.pnpm/mi-gpt@2.1.1/node_modules/mi-gpt/dist/index.js:231:13)
at __Logger.assert (file:///D:/document/Github/mi-gpt-2/node_modules/.pnpm/mi-gpt@2.1.1/node_modules/mi-gpt/dist/index.js:268:19)
at _MiGPT.create (file:///D:/document/Github/mi-gpt-2/node_modules/.pnpm/mi-gpt@2.1.1/node_modules/mi-gpt/dist/index.js:2266:19)
at main (file:///D:/document/Github/mi-gpt-2/main.js:4:24)
at file:///D:/document/Github/mi-gpt-2/main.js:14:1
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:34:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
The text was updated successfully, but these errors were encountered: