[GH-ISSUE #57] Chat not working #598

Closed
opened 2026-04-21 22:39:52 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @caseypaite on GitHub (Nov 15, 2025).
Original GitHub issue: https://github.com/reconurge/flowsint/issues/57

Looking at the code flowsint-api/app/api/routes/chat.py it appears that adding Mistral API key as environment variable MISTRAL_API_KEY in .env would allow me to use Mistral AI. But even after adding the API key there Chat generates error saying Failed to get AI completion: 500: Mistral API key not configured . Adding the key in Vault does not resolve the issue either.

Originally created by @caseypaite on GitHub (Nov 15, 2025). Original GitHub issue: https://github.com/reconurge/flowsint/issues/57 Looking at the code `flowsint-api/app/api/routes/chat.py` it appears that adding Mistral API key as environment variable `MISTRAL_API_KEY` in `.env` would allow me to use Mistral AI. But even after adding the API key there Chat generates error saying `Failed to get AI completion: 500: Mistral API key not configured` . Adding the key in Vault does not resolve the issue either.
Author
Owner

@dextmorgn commented on GitHub (Nov 15, 2025):

Hello @caseypaite,

Thanks for raising this issue.

The chat should normally work if you add the api key in the .env file.

But you need to restart the services and make sure the env is correctly setup.

I'd suggest deleting all .env files in app/api/core then add your api key in .env.example and relaunch the install.

I'll work on a better documentation and Vault support.

Let me know !

<!-- gh-comment-id:3536268489 --> @dextmorgn commented on GitHub (Nov 15, 2025): Hello @caseypaite, Thanks for raising this issue. The chat should normally work if you add the api key in the `.env` file. But you need to restart the services and make sure the env is correctly setup. I'd suggest deleting all `.env` files in app/api/core then add your api key in `.env.example` and relaunch the install. I'll work on a better documentation and Vault support. Let me know !
Author
Owner

@caseypaite commented on GitHub (Nov 15, 2025):

Hi @dextmorgn , thanks for the suggestion and also thank you for developing this whole package.

Here is what i did:

make stop
docker image rm flowsint-prod-api
docker image rm flowsint-prod-app
docker image rm flowsint-prod-celery
rm .env
rm flowsint-api/.env
rm flowsint-app/.env
rm flowsint-core/.env

Added MISTRAL_API_KEY=key_from_mistral to the .env.example file, then:
make prod

Issue still not resolved.

PDCP_API_KEY and ASNMAP added through Vault worked perfectly fine. Wished Mistral integration can also be done through Valut.

<!-- gh-comment-id:3536297790 --> @caseypaite commented on GitHub (Nov 15, 2025): Hi @dextmorgn , thanks for the suggestion and also thank you for developing this whole package. Here is what i did: ``` make stop docker image rm flowsint-prod-api docker image rm flowsint-prod-app docker image rm flowsint-prod-celery rm .env rm flowsint-api/.env rm flowsint-app/.env rm flowsint-core/.env ``` Added `MISTRAL_API_KEY=key_from_mistral` to the `.env.example` file, then: `make prod` Issue still not resolved. `PDCP_API_KEY` and `ASNMAP` added through Vault worked perfectly fine. Wished Mistral integration can also be done through Valut.
Author
Owner

@dextmorgn commented on GitHub (Nov 15, 2025):

Cool, thank you for testing and letting me know.

I'll work on this probably next week, and let you know on this thread.

<!-- gh-comment-id:3536308453 --> @dextmorgn commented on GitHub (Nov 15, 2025): Cool, thank you for testing and letting me know. I'll work on this probably next week, and let you know on this thread.
Author
Owner

@caseypaite commented on GitHub (Nov 15, 2025):

Finally figured it out.
The MISTRAL_API_KEY environment variable was not declared in docker-compose.prod.yml, this API Key is required only by the API backend. So, I added the environment variable in the docker-compose file:

  # FastAPI Backend (Production)
  api:
...
    environment:
      ...
      - REDIS_URL=redis://redis:6379/0
      - MISTRAL_API_KEY=${MISTRAL_API_KEY}        

This resolved the issue.

@dextmorgn It would be convenient for users if .env.example contain placeholders for the variable names (could be commented out). Also the docker-compose files should also contain references to all the environment variables to be imported from the .env files.

I'm closing the issue at my end.

Regards.

<!-- gh-comment-id:3536490090 --> @caseypaite commented on GitHub (Nov 15, 2025): Finally figured it out. The `MISTRAL_API_KEY` environment variable was not declared in `docker-compose.prod.yml`, this API Key is required only by the API backend. So, I added the environment variable in the docker-compose file: ``` # FastAPI Backend (Production) api: ... environment: ... - REDIS_URL=redis://redis:6379/0 - MISTRAL_API_KEY=${MISTRAL_API_KEY} ``` This resolved the issue. @dextmorgn It would be convenient for users if `.env.example` contain placeholders for the variable names (could be commented out). Also the docker-compose files should also contain references to all the environment variables to be imported from the `.env` files. I'm closing the issue at my end. Regards.
Author
Owner

@dextmorgn commented on GitHub (Nov 15, 2025):

@caseypaite,

Thanks for figuring it out.

Would you mind creating a PR for this fix ?

Thanks !

<!-- gh-comment-id:3536573318 --> @dextmorgn commented on GitHub (Nov 15, 2025): @caseypaite, Thanks for figuring it out. Would you mind creating a PR for this fix ? Thanks !
Author
Owner

@caseypaite commented on GitHub (Nov 15, 2025):

Hi @dextmorgn , I have commited changes to files .env.example and docker-compose.prod.yml. But managed to create PR for one of them. I'm not so good with git operations.

<!-- gh-comment-id:3536622351 --> @caseypaite commented on GitHub (Nov 15, 2025): Hi @dextmorgn , I have commited changes to files `.env.example` and `docker-compose.prod.yml`. But managed to create PR for one of them. I'm not so good with git operations.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/flowsint#598