From c84fa50ef23493ffbfc648ac7c559998ec89020f Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Fri, 28 Feb 2025 00:26:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=80=E4=BA=9B=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E7=9B=B8=E5=85=B3=E7=9A=84=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/__init__.py | 2 +- src/main.py | 4 +++- test/data/A_Dream_of_Red_Mansions_tiny.jsonl | 5 +++++ web/vite.config.js | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 test/data/A_Dream_of_Red_Mansions_tiny.jsonl diff --git a/src/config/__init__.py b/src/config/__init__.py index 522788bd..e8476be3 100644 --- a/src/config/__init__.py +++ b/src/config/__init__.py @@ -4,7 +4,7 @@ import yaml from pathlib import Path from src.utils.logging_config import logger -with open(Path("src/static/models.yaml"), "r") as f: +with open(Path("src/static/models.yaml"), 'r', encoding='utf-8') as f: _models = yaml.safe_load(f) MODEL_NAMES = _models["MODEL_NAMES"] diff --git a/src/main.py b/src/main.py index 9266eb32..c5bea229 100644 --- a/src/main.py +++ b/src/main.py @@ -1,11 +1,13 @@ import uvicorn from dotenv import load_dotenv + +load_dotenv("src/.env") + from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from src.routers import router from src.utils.logging_config import logger -load_dotenv() app = FastAPI() app.include_router(router) diff --git a/test/data/A_Dream_of_Red_Mansions_tiny.jsonl b/test/data/A_Dream_of_Red_Mansions_tiny.jsonl new file mode 100644 index 00000000..5283f7db --- /dev/null +++ b/test/data/A_Dream_of_Red_Mansions_tiny.jsonl @@ -0,0 +1,5 @@ +{"h": "贾代善", "t": "贾源", "r": "子"} +{"h": "娄氏", "t": "贾源", "r": "重孙媳妇"} +{"h": "贾母", "t": "贾代善", "r": "妻"} +{"h": "老姨奶奶", "t": "贾代善", "r": "妾"} +{"h": "贾敏", "t": "贾代善", "r": "女"} \ No newline at end of file diff --git a/web/vite.config.js b/web/vite.config.js index 47f2337a..2c0b3e13 100644 --- a/web/vite.config.js +++ b/web/vite.config.js @@ -14,7 +14,7 @@ export default defineConfig(({ mode }) => { server: { proxy: { '^/api': { - target: env.VITE_API_URL || 'http://localhost:5000', + target: env.VITE_API_URL || 'http://localhost:5050', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '') }