Merge pull request #90 from JefferyHcool/feature/kuaishou

refactor(backend): 更新默认提供商路径获取方法并配置前端请求基础 URL
This commit is contained in:
Jianwu Huang
2025-05-09 10:42:53 +08:00
committed by GitHub
2 changed files with 10 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
import axios from 'axios'
const request = axios.create({
baseURL: '/api', // 默认请求路径前缀
baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000',
timeout: 10000,
})

View File

@@ -1,5 +1,6 @@
import json
import os
import sys
from app.db.sqlite_client import get_connection
from app.utils.logger import get_logger
@@ -8,6 +9,13 @@ logger = get_logger(__name__)
def get_builtin_providers_path():
if getattr(sys, 'frozen', False):
base_path = sys._MEIPASS
else:
base_path = os.path.dirname(__file__)
return os.path.join(base_path, 'builtin_providers.json')
def seed_default_providers():
conn = get_connection()
if conn is None:
@@ -24,7 +32,7 @@ def seed_default_providers():
conn.close()
return
json_path = os.path.join(os.path.dirname(__file__), 'builtin_providers.json')
json_path = get_builtin_providers_path()
try:
with open(json_path, 'r', encoding='utf-8') as f:
providers = json.load(f)
@@ -47,7 +55,6 @@ def seed_default_providers():
p['type'],
p.get('enabled', 1)
))
conn.commit()
logger.info("Default providers seeded successfully.")
except Exception as e: