From 8bdc8ec7839ea8036d6cb91514ad000e545d9205 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 23 十月 2024 23:31:22 +0800
Subject: [PATCH] 删除无用配置,mysql配置支持从环境变量读取,更改dockerfile, 完善readme

---
 Dockerfile               |   18 ++++++++----------
 app/config/config.py     |    3 ---
 pip_install.sh           |   16 ++++++++++++++--
 app/config/config.yaml   |    5 +----
 app/models/base_model.py |    4 +++-
 README.md                |    7 +++++--
 6 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 3749a2d..234c792 100644
--- a/Dockerfile
+++ b/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
\ No newline at end of file
+# 鍚姩鍛戒护
+CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "9201"]
\ No newline at end of file
diff --git a/README.md b/README.md
index f76440f..a9ab825 100644
--- a/README.md
+++ b/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
diff --git a/app/config/config.py b/app/config/config.py
index e3d254f..dae7353 100644
--- a/app/config/config.py
+++ b/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():
diff --git a/app/config/config.yaml b/app/config/config.yaml
index d3e94a4..944c94b 100644
--- a/app/config/config.yaml
+++ b/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
\ No newline at end of file
+PRIVATE_KEY: str
\ No newline at end of file
diff --git a/app/models/base_model.py b/app/models/base_model.py
index 969c9c3..b8efcb8 100644
--- a/app/models/base_model.py
+++ b/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)
diff --git a/pip_install.sh b/pip_install.sh
index 131e1eb..5fbc0e3 100644
--- a/pip_install.sh
+++ b/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
\ No newline at end of file
+pip install requests
+pip install websockets
+pip install cryptography
\ No newline at end of file

--
Gitblit v1.8.0