feat: 增加会员服务与估价模版智能体

会员服务改为固定栏目,首页在线服务不再进入报告审核。估价模版智能体可多会话制作模版并下载,下载过程显示加载状态。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-11-23 13:36:19 +08:00
1 parent 55b5a87482
commit 2074a45681
63 files changed
+6428 -461

No files matched your search

+51
View File
@@ -111,6 +111,47 @@ class ValuationSuggestion(Base):
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=_now)
COACH_WELCOME = (
"我是估价模版智能体,专门帮你制作估价智能体要用的报告模版。"
"可以上传历史 Word 或 PPT,也可以上传 pdf、表格和图片作参考。"
"直接说要保留哪些章节、做成 Word 还是 PPT。"
"整理好后下载到本地,你可以再改,然后回到模版列表里自己上传。"
"这里不会把文件直接放进模版列表,也不回答具体估价问题。"
)
class ValuationCoachSession(Base):
__tablename__ = "valuation_coach_session"
__table_args__ = _mysql_args()
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
owner_key: Mapped[str] = mapped_column(String(32), nullable=False, index=True)
title: Mapped[str] = mapped_column(String(80), nullable=False, default="新会话")
outline_name: Mapped[str] = mapped_column(String(80), nullable=False, default="")
outline_format: Mapped[str] = mapped_column(String(8), nullable=False, default="")
outline_text: Mapped[str] = mapped_column(_long_text(), nullable=False, default="")
source_text: Mapped[str] = mapped_column(_long_text(), nullable=False, default="")
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=_now)
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=_now)
class ValuationCoachMessage(Base):
__tablename__ = "valuation_coach_message"
__table_args__ = _mysql_args()
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
session_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True)
role: Mapped[str] = mapped_column(String(16), nullable=False)
content: Mapped[str] = mapped_column(_long_text(), nullable=False, default="")
thought: Mapped[str] = mapped_column(_long_text(), nullable=False, default="")
attachments: Mapped[str] = mapped_column(Text, nullable=False, default="")
kind: Mapped[str] = mapped_column(String(16), nullable=False, default="chat")
draft_format: Mapped[str] = mapped_column(String(8), nullable=False, default="")
draft_name: Mapped[str] = mapped_column(String(80), nullable=False, default="")
outline: Mapped[str] = mapped_column(_long_text(), nullable=False, default="")
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=_now)
def ensure_valuation_columns(db) -> None:
bind = db.get_bind()
if bind.dialect.name != "mysql":
@@ -134,6 +175,16 @@ def ensure_valuation_columns(db) -> None:
db.execute(
text(f"ALTER TABLE {table} ADD COLUMN owner_key VARCHAR(32) NOT NULL DEFAULT ''")
)
tables = set(inspect(bind).get_table_names())
if "valuation_coach_session" in tables:
coach_columns = {column["name"] for column in inspect(bind).get_columns("valuation_coach_session")}
if "title" not in coach_columns:
db.execute(
text(
"ALTER TABLE valuation_coach_session "
"ADD COLUMN title VARCHAR(80) NOT NULL DEFAULT '新会话'"
)
)
for table, column in (
("valuation_message", "content"),
("valuation_message", "thought"),