fix: 修复前台4项问题(MCP列举/微信技能上限/Word资产栏/技能MCP反馈) + 同步容器live状态

- #549 平台MCP列举: 注入全量已启用MCP清单, AI不再凭空编造
- #550 微信Bot技能自动发现上限 15->300
- #551 知识库Word文档同步资产后Word栏可见 + 双向删除同步(assets/knowledge级联软删)
- #552 对话反馈实际使用的技能/MCP(used_mcp字段), 含历史消息序列化
- 同步容器内其他未提交live改动(im_bot_platform/TokenDashboard/WechatBot/ChatPage)
This commit is contained in:
QihuAI Design committed 2026-07-18 08:06:37 +08:00
1 parent 7fb7c07f57
commit 1578d68f95
10 files changed
+1927 -1719

No files matched your search

+17 -2
View File
@@ -1149,15 +1149,21 @@ def _split_content_into_chunks(content: str, chunk_size: int = 500) -> list:
def _sync_asset_for_knowledge_doc(db: Session, user_id: str, doc_id: str, filename: str, file_type: str, file_size: int):
"""将知识库文档同步为资产记录(问题9:资产关联知识库文档用量)"""
try:
# 文件类型归一化为前端子分类标签(docx/doc->word 等),确保出现在「文件 > Word」子栏
_ft_label = {
"pdf": "pdf", "docx": "word", "doc": "word", "xlsx": "excel", "xls": "excel",
"pptx": "ppt", "ppt": "ppt", "csv": "txt", "md": "md", "txt": "txt",
}.get((file_type or "").lower(), "other")
asset = Asset(
id=gen_uuid(),
user_id=user_id,
name=filename,
category="doc",
category="file",
description=f"知识库文档 (ID: {doc_id})",
file_type=file_type,
file_type=_ft_label,
size=file_size,
status="active",
knowledge_doc_id=doc_id,
created_at=datetime.now(),
updated_at=datetime.now(),
)
@@ -1191,6 +1197,15 @@ def delete_document(
pass # total_size removed
kb.updated_at = datetime.now()
# 同步删除知识库文档对应的资产记录(双向同步)
try:
linked_asset = db.query(Asset).filter(Asset.knowledge_doc_id == doc_id).first()
if linked_asset:
linked_asset.status = "deleted"
linked_asset.updated_at = datetime.now()
except Exception as _e:
logger.warning(f"同步删除关联资产失败: {_e}")
db.delete(doc)
db.commit()