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] Error getting OPENAI_API_KEY from .env.development.local: ENOENT: no such file or directory #46

Open
swamichandra opened this issue Dec 7, 2023 · 4 comments

Comments

@swamichandra
Copy link

On Windows 10. Trying to generate a new data source and when I run pnpm run generate <datasource-name> get the following error. The OpenAI key is set in .env.development.local. The app works, but not the data source generation. Related to #23 which was closed as addressed.

Error getting OPENAI_API_KEY from .env.development.local: ENOENT: no such file or directory, open 'C:\C:\Users\xxx\Documents\WORKSPACES\GenerativeAI\chat-llamaindex\.env.development.local'
 ELIFECYCLE  Command failed with exit code 1.
@marcusschiesser
Copy link
Collaborator

It seems like this line is not working on Windows:
78b3af8#diff-68cac859f8dcc9a6c395c198dbb376ca147a13a3e84d127dc43a8ff0f88d6b34R50

It produces the prefix C:\C:\ instead of just C:\

I do not have Windows, can you give this one a try:

const __dirname = path.dirname(import.meta.url.pathname);

@swamichandra
Copy link
Author

It seems like this line is not working on Windows: 78b3af8#diff-68cac859f8dcc9a6c395c198dbb376ca147a13a3e84d127dc43a8ff0f88d6b34R50

It produces the prefix C:\C:\ instead of just C:\

I do not have Windows, can you give this one a try:

const __dirname = path.dirname(import.meta.url.pathname);

Did not work. Different error

Error getting OPENAI_API_KEY from .env.development.local: The "path" argument must be of type string. Received undefined
 ELIFECYCLE  Command failed with exit code 1.

@swamichandra
Copy link
Author

This was the fix.

import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

While the new data source is successfully generated/created and I see the folder name incl contents in /cache, I don't see the datasource appearing in the app UI. Should I be seeing the new data source as a bot in the left hand side of the app UI?

@marcusschiesser
Copy link
Collaborator

@swamichandra Great. Want to sent a PR with your fix?
Currently, there is not a UI that shows data sources. You'll have to assign it to a bot as described here: https://github.com/run-llama/chat-llamaindex#-data-sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants