瀏覽代碼

删除无用配置,mysql配置支持从环境变量读取,更改dockerfile, 完善readme

zhangqian 1 年之前
父節點
當前提交
8bdc8ec783
共有 6 個文件被更改,包括 31 次插入22 次删除
  1. 8 10
      Dockerfile
  2. 5 2
      README.md
  3. 0 3
      app/config/config.py
  4. 1 4
      app/config/config.yaml
  5. 3 1
      app/models/base_model.py
  6. 14 2
      pip_install.sh

+ 8 - 10
Dockerfile

@@ -1,14 +1,12 @@
 FROM python:3.11
-
-# 安装 PyInstaller
-RUN pip install pyinstaller
-
-# 复制项目文件到容器中
-COPY . /app
+ 
+# 设置工作目录
 WORKDIR /app
+ 
+# copy文件到容器
+COPY . /app
 
-# 安装项目依赖
-RUN pip install -r requirements.txt
+RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
 
-# 使用 PyInstaller 打包应用,并确保文件被复制到 dist 目录
-RUN pyinstaller -F main.py
+# 启动命令
+CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "9201"]

+ 5 - 2
README.md

@@ -7,8 +7,11 @@ RAG Gateway 是一个用于处理请求和响应的网关服务。它使用 Fast
 ## 目录结构
 rag-gateway/
 ├── app/
-│   └── init.py
-│   └── main.py
+│   └── api
+│   └── config  项目配置目录
+│   └── models
+│   └── service
+|   └── utils 
 ├── main.py
 ├── requirements.txt
 ├── test_main.http

+ 0 - 3
app/config/config.py

@@ -10,9 +10,6 @@ class Settings:
     database_url: str = ''
     PUBLIC_KEY: str
     PRIVATE_KEY: str
-    bisheng_agent_id: str
-    ragflow_agent_id: str
-    ragflow_chat_id: str
     def __init__(self, **kwargs):
         # Check if all required fields are provided and set them
         for field in self.__annotations__.keys():

+ 1 - 4
app/config/config.yaml

@@ -7,7 +7,4 @@ PUBLIC_KEY: |
   -----BEGIN PUBLIC KEY-----
   MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArq9XTUSeYr2+N1h3Afl/z8Dse/2yD0ZGrKwx+EEEcdsBLca9Ynmx3nIB5obmLlSfmskLpBo0UACBmB5rEjBp2Q2f3AG3Hjd4B+gNCG6BDaawuDlgANIhGnaTLrIqWrrcm4EMzJOnAOI1fgzJRsOOUEfaS318Eq9OVO3apEyCCt0lOQK6PuksduOjVxtltDav+guVAA068NrPYmRNabVKRNLJpL8w4D44sfth5RvZ3q9t+6RTArpEtc5sh5ChzvqPOzKGMXW83C95TxmXqpbK6olN4RevSfVjEAgCydH6HN6OhtOQEcnrU97r9H0iZOWwbw3pVrZiUkuRD1R56Wzs2wIDAQAB
   -----END PUBLIC KEY-----
-PRIVATE_KEY: str
-bisheng_agent_id: 29dd57cf-1bd6-440d-af2c-2aac1c954770
-ragflow_agent_id: 690f42554ac84ed7b8bf7605db603b2f
-ragflow_chat_id: e1d131a1b89b488e97c2194d9e2d345c
+PRIVATE_KEY: str

+ 3 - 1
app/models/base_model.py

@@ -1,10 +1,12 @@
+import os
+
 from sqlalchemy import create_engine
 from sqlalchemy.ext.declarative import declarative_base
 from sqlalchemy.orm import sessionmaker, Session
 
 from app.config.config import settings
 
-DATABASE_URL = settings.database_url
+DATABASE_URL = os.getenv('DATABASE_URL') or settings.database_url
 
 engine = create_engine(DATABASE_URL)
 SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

+ 14 - 2
pip_install.sh

@@ -1,5 +1,17 @@
-pip install PyMySQL & pip install fastapi & pip install sqlalchemy & pip install PyJWT & pip install rsa & pip install httpx & pip install uvicorn & pip install bcrypt & pip install PyYAML & pip install pycryptodomex & pip install passlib
+pip install PyMySQL
+pip install fastapi
+pip install sqlalchemy
+pip install PyJWT
+pip install rsa
+pip install httpx
+pip install uvicorn
+pip install bcrypt
+pip install PyYAML
+pip install pycryptodomex
+pip install passlib
 pip install werkzeug
 pip install openpyxl
 pip install python-multipart
-pip install requests
+pip install requests
+pip install websockets
+pip install cryptography