zhangqian
2024-10-23 8bdc8ec7839ea8036d6cb91514ad000e545d9205
删除无用配置,mysql配置支持从环境变量读取,更改dockerfile, 完善readme
6个文件已修改
53 ■■■■■ 已修改文件
Dockerfile 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/config/config.py 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/config/config.yaml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/models/base_model.py 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pip_install.sh 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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"]
README.md
@@ -7,8 +7,11 @@
## 目录结构
rag-gateway/
├── app/
│   └── init.py
│   └── main.py
│   └── api
│   └── config  项目配置目录
│   └── models
│   └── service
|   └── utils
├── main.py
├── requirements.txt
├── test_main.http
app/config/config.py
@@ -10,9 +10,6 @@
    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():
app/config/config.yaml
@@ -7,7 +7,4 @@
  -----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
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)
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