melih-unsal/DemoGPT

The .env file seems not working

redreamality opened this issue · 1 comments

Describe the bug

To Reproduce
Steps to reproduce the behavior:

  1. put .env file into the current folder
  2. run demogpt
  3. goto the webpage and type name and description for the app and submit.
  4. "please enter the openai api key"

Expected behavior
in the .env file I changed the "OPENAI_API_BASE" and specified the 'OPENAI_API_KEY', so when clicked on submit, it should directly call the llm

Hi @redreamality,

Thank you for bringing this issue to our attention. I apologize for the inconvenience you're experiencing.

For the application to properly read the .env file, it should be placed in the $DEMOGPT_PATH/demogpt/plan folder. This is because the load_dotenv function operates in the scope of the application code that resides in this particular folder. Once the .env file is in the correct location, the application should automatically load the OPENAI_API_KEY from it and populate the text area on the left side of the interface.

Currently, the application is configured to only support OPENAI_API_KEY. To resolve your issue, please ensure that your .env file is in the $DEMOGPT_PATH/demogpt/plan folder and try running the application again.

Alternatives:

  1. You can manually enter your OpenAI API Key in the text area on the left side of the web interface for immediate testing.
  2. Another approach is to directly define OPENAI_API_KEY as an environment variable in your system. You can do this by running the export OPENAI_API_KEY=your_api_key_here command in your terminal session or by adding the same command to your .bashrc file.

Thank you for your understanding and cooperation. Please let me know if you encounter further issues or have additional questions.

Best regards,
Melih.