added configurable backend port through dotenv

This commit is contained in:
tcsenpai 2025-05-02 10:30:12 +02:00
parent 487670d207
commit bb3d1ae46a
3 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,4 @@
SEARXNG_BASE_URL="http://127.0.0.1:8080" SEARXNG_BASE_URL="http://127.0.0.1:8080"
OPENAI_API_KEY='xxxxx' OPENAI_API_KEY='xxxxx'
DEEPSEEK_API_KEY='xxxxx' DEEPSEEK_API_KEY='xxxxx'
BACKEND_PORT=8000

5
api.py
View File

@ -22,6 +22,9 @@ from sources.utility import pretty_print
from sources.logger import Logger from sources.logger import Logger
from sources.schemas import QueryRequest, QueryResponse from sources.schemas import QueryRequest, QueryResponse
from dotenv import load_dotenv
load_dotenv()
from celery import Celery from celery import Celery
@ -234,4 +237,4 @@ async def process_query(request: QueryRequest):
interaction.save_session() interaction.save_session()
if __name__ == "__main__": if __name__ == "__main__":
uvicorn.run(api, host="0.0.0.0", port=8000) uvicorn.run(api, host="0.0.0.0", port=os.getenv("BACKEND_PORT") or 8000)

View File

@ -42,6 +42,7 @@ sentencepiece>=0.2.0
openai openai
sniffio sniffio
tqdm>4 tqdm>4
python-dotenv>=1.0.0
# if use chinese # if use chinese
ordered_set ordered_set
pypinyin pypinyin