Merge branch 'develop' of http://47.106.207.27:3000/AI260626/Mutual_Fund into develop_feature_kefu
# Conflicts: # .gitignore # api/router.py # main.py # sql/schema.sql
This commit is contained in:
+62
@@ -21,6 +21,68 @@ wheels/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# 虚拟环境(非常重要,防止把本地依赖包提交上去)
|
||||
venv/
|
||||
env/
|
||||
.idea
|
||||
.idea/
|
||||
.venv/
|
||||
ENV/
|
||||
|
||||
# 日志文件
|
||||
*.log
|
||||
|
||||
# 操作系统文件
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# pytest 测试产物
|
||||
.pytest_cache/
|
||||
.coverage
|
||||
coverage.xml
|
||||
htmlcov/
|
||||
junit.xml
|
||||
|
||||
# mypy 类型检查缓存
|
||||
.mypy_cache/
|
||||
# 向量库、本地数据库、模型文件(大文件不要提交git)
|
||||
*.db
|
||||
*.sqlite
|
||||
*.milvus
|
||||
*.neo4j
|
||||
*.bin
|
||||
*.pth
|
||||
*.ckpt
|
||||
*.onnx
|
||||
|
||||
# 本地导出数据、临时csv/excel
|
||||
data/tmp/
|
||||
data/output/
|
||||
*.csv
|
||||
*.xlsx
|
||||
*.parquet
|
||||
# Python 缓存与编译文件
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# 虚拟环境(非常重要,防止把本地依赖包提交上去)
|
||||
venv/
|
||||
env/
|
||||
|
||||
@@ -7,9 +7,14 @@ from api.routers import auth
|
||||
from api.routers import customer_agent
|
||||
from api.routers import knowledge
|
||||
from api.routers import auth, product, questionnaire
|
||||
from api.routers import account, auth, holdings, purchase, redeem
|
||||
|
||||
api_router = APIRouter()
|
||||
api_router.include_router(auth.router, prefix="/api", tags=["认证"])
|
||||
api_router.include_router(account.router, prefix="/api", tags=["资金账户"])
|
||||
api_router.include_router(holdings.router, prefix="/api", tags=["持仓"])
|
||||
api_router.include_router(purchase.router, prefix="/api", tags=["交易"])
|
||||
api_router.include_router(redeem.router, prefix="/api", tags=["交易"])
|
||||
api_router.include_router(customer_agent.router, prefix="/api/agent/customer", tags=["客服Agent"])
|
||||
api_router.include_router(knowledge.router, prefix="/api/knowledge", tags=["知识库"])
|
||||
api_router.include_router(product.router, prefix="/api", tags=["产品"])
|
||||
|
||||
-1256
File diff suppressed because it is too large
Load Diff
-1265
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
"""应用入口:四库异步生命周期 + 中间件 + 全局异常 + 路由装配。"""
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
import uvicorn
|
||||
from fastapi import FastAPI
|
||||
|
||||
from api.router import api_router
|
||||
@@ -17,8 +18,6 @@ from utils.request_id import RequestIdMiddleware
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
setup_logging() # 幂等:分级日志 + trace_id + 脱敏
|
||||
app.state.customer_agent_runtime = build_default_runtime()
|
||||
app.state.knowledge_upload_service = build_default_knowledge_upload_service()
|
||||
# 四库会话懒创建:启动不连接任何库,首次访问才建,可手动预热:
|
||||
# asyncio.run(database.init_db())
|
||||
yield
|
||||
@@ -34,8 +33,4 @@ app.include_router(api_router)
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return {"message": "智能公募基金系统 API", "docs": "/docs"}
|
||||
|
||||
if __name__ == '__main__':
|
||||
import uvicorn
|
||||
uvicorn.run('main:app', host="127.0.0.1", port=8000)
|
||||
return {"message": "智能公募基金系统 API", "docs": "/docs"}
|
||||
@@ -22,4 +22,16 @@ neo4j~=6.3.0
|
||||
redis~=8.1.0
|
||||
pymilvus~=3.0.1
|
||||
pydantic-settings~=2.15.0
|
||||
pyjwt~=2.13.0
|
||||
fastapi~=0.141.1
|
||||
sqlalchemy~=2.0.52
|
||||
aiomysql~=0.3.2
|
||||
cryptography~=50.0.1
|
||||
httpx~=0.28.1
|
||||
pydantic~=2.13.5
|
||||
starlette~=1.6.0
|
||||
neo4j~=6.3.0
|
||||
redis~=8.1.0
|
||||
pymilvus~=3.0.1
|
||||
pydantic-settings~=2.15.0
|
||||
pyjwt~=2.13.0
|
||||
+8
-3
@@ -267,9 +267,14 @@ CREATE TABLE IF NOT EXISTS conversation_archive (
|
||||
tool_calls JSON NULL COMMENT '工具调用记录 [{"tool":"nl2sql",...}]',
|
||||
trace_id VARCHAR(64) NULL COMMENT '请求链路追踪ID',
|
||||
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
trace_id VARCHAR(64) NULL COMMENT '请求链路追踪ID',
|
||||
KEY idx_session (session_id),
|
||||
KEY idx_user_time (user_id, create_time),
|
||||
KEY idx_agent (agent_type)
|
||||
KEY idx_agent (agent_type),
|
||||
message_id VARCHAR(64) NULL COMMENT '消息唯一ID,用于归档幂等',
|
||||
agent_run_id VARCHAR(64) NULL COMMENT 'Agent运行ID,用于调用链路追踪',
|
||||
UNIQUE KEY uk_session_message (session_id, message_id),
|
||||
KEY idx_agent_run (agent_run_id)
|
||||
) COMMENT='会话归档表(审计回溯 + Agent 持续学习素材,归档前脱敏)';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
@@ -337,7 +342,7 @@ CREATE TABLE IF NOT EXISTS audit_log (
|
||||
target VARCHAR(128) NULL COMMENT '操作对象(单号/ID)',
|
||||
detail TEXT NULL COMMENT '详情(JSON 字符串)',
|
||||
ip VARCHAR(64) NULL,
|
||||
trace_id VARCHAR(64) NULL COMMENT '链路号',
|
||||
trace_id VARCHAR(32) NULL COMMENT '链路号',
|
||||
status VARCHAR(8) NOT NULL DEFAULT '成功' COMMENT '成功/失败',
|
||||
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
KEY idx_user (user_id),
|
||||
@@ -437,4 +442,4 @@ CREATE TABLE IF NOT EXISTS portfolio_benchmark (
|
||||
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY uk_risk_level (risk_level)
|
||||
) COMMENT='组合基准配置表(投顾Agent 再平衡参照,运营可调整)';
|
||||
) COMMENT='组合基准配置表(投顾Agent 再平衡参照,运营可调整)';
|
||||
Reference in New Issue
Block a user