feat:新增投顾agent和nl2sqlagent

This commit is contained in:
2026-09-13 16:19:24 +08:00
parent c80c6acac0
commit 163192bf55
122 changed files with 7488 additions and 362 deletions
+31
View File
@@ -0,0 +1,31 @@
"""基金业绩指标仓储。"""
from __future__ import annotations
from sqlalchemy import select
from model.fund_performance import FundPerformance
from repositories.base import BaseRepository
class FundPerformanceRepo(BaseRepository):
model = FundPerformance
async def get_latest_for_product(self, product_id: int) -> FundPerformance | None:
stmt = (
select(FundPerformance)
.where(FundPerformance.product_id == product_id)
.order_by(
FundPerformance.calc_date.desc(),
FundPerformance.id.desc(),
)
.limit(1)
)
return (await self.db.scalars(stmt)).first()
async def list_for_product(self, product_id: int) -> list[FundPerformance]:
stmt = (
select(FundPerformance)
.where(FundPerformance.product_id == product_id)
.order_by(FundPerformance.period.asc())
)
return list((await self.db.scalars(stmt)).all())