diff --git a/Dockerfile b/Dockerfile index afd8d8c..9a6fc34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt /app/ -RUN pip install --no-cache-dir -r requirements.txt +RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple COPY . /app diff --git a/elastic/indexes.py b/elastic/indexes.py index 13b4ba0..2bd3a5a 100644 --- a/elastic/indexes.py +++ b/elastic/indexes.py @@ -1,5 +1,5 @@ INDEX_NAME = "wordsearch266666" -USER_NAME = "users" +USER_NAME = "users11111" ACHIEVEMENT_INDEX_NAME = INDEX_NAME USER_INDEX_NAME = USER_NAME GLOBAL_INDEX_NAME = "global11111" diff --git a/elastic/views.py b/elastic/views.py index a1b801b..427d199 100644 --- a/elastic/views.py +++ b/elastic/views.py @@ -267,8 +267,10 @@ def ocr_and_extract_info(image_path: str): # raise RuntimeError("缺少 AISTUDIO_API_KEY,请在环境变量或 settings 中配置") - api_key="188f57db3766e02ed2c7e18373996d84f4112272" - base_url="https://aistudio.baidu.com/llm/lmapi/v3" + api_key = getattr(settings, "AISTUDIO_API_KEY", "") + base_url = getattr(settings, "OPENAI_BASE_URL", "") + if not api_key or not base_url: + raise RuntimeError("缺少模型服务配置,请设置 AISTUDIO_API_KEY 与 OPENAI_BASE_URL") client = OpenAI(api_key=api_key, base_url=base_url) types = get_type_list() diff --git a/requirements.txt b/requirements.txt index efd6d56..4212bfe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,3 @@ ---index-url https://pypi.tuna.tsinghua.edu.cn/simple ---extra-index-url https://pypi.org/simple Django==5.2.8 elasticsearch==7.17.9 django-elasticsearch-dsl==7.4.0 @@ -7,6 +5,7 @@ django-elasticsearch-dsl-drf==0.22 elasticsearch-dsl==7.4.1 requests==2.32.3 openai==1.52.2 +httpx==0.27.2 Pillow==10.4.0 gunicorn==21.2.0 whitenoise==6.6.0