chore(align): sync Git with running container as authoritative source
One-time alignment to close drift between the running container (qihu-aiflow / image qihuaiflow:with-deps) and this Git repository. Container hotfixes previously persisted only via `docker commit` are now captured in Git so Git becomes the single source of truth. Backend: - chat_service.py: accumulated fixes incl. EigenFlux README guidance - chat_context.py / chat_media.py: URL/web-repo context injection - api/url_reader.py: NEW SSRF-safe web/README reader (Issue #725) - skills_admin.py & Skills.tsx: 14-scene capability unification - pgvector_search.py, orchestrator.py, platform_knowledge.py, market.py, admin/models.py: drift sync Frontend: - ChatPage.tsx: collapsible AI think/act block (Issue #724) - MarketPage / EvolutionDashboard / TokenDashboard styling sync Migrations: - 018_normalize_marketapp_scene.sql: fixed capability allowlist (prevents capability wipe on restart) Alignment performed 2026-07-23 05:42:47. No deletions; secrets/venv/node_modules/ caches were not touched (tracked-source-only copy).
This commit is contained in:
1 parent
49f7503978
commit
a08ec87b22
19 files changed
+7474
-7196
No files matched your search
@@ -81,6 +81,41 @@ PLATFORM_KNOWLEDGE = """# 七虎AI平台能力全览
|
||||
"""
|
||||
|
||||
|
||||
def get_platform_knowledge() -> str:
|
||||
"""获取平台全功能知识库文本,注入到AI对话系统提示中"""
|
||||
return PLATFORM_KNOWLEDGE
|
||||
def get_platform_knowledge(db=None, user_id=None) -> str:
|
||||
"""获取平台全功能知识库文本,注入到AI对话系统提示中。
|
||||
|
||||
若传入 db,则动态追加当前平台已上线的官方技能目录
|
||||
(source=official 且 status=published),确保管理员/前台导入或下架技能后,
|
||||
AI 能及时感知并使用「平台自身已有内容」,而非停留在陈旧硬编码清单(见 #712)。
|
||||
任何异常均安全回退到静态 PLATFORM_KNOWLEDGE。
|
||||
"""
|
||||
if db is None:
|
||||
return PLATFORM_KNOWLEDGE
|
||||
try:
|
||||
from .models import MarketApp
|
||||
|
||||
apps = (
|
||||
db.query(MarketApp)
|
||||
.filter(MarketApp.source == "official", MarketApp.status == "published")
|
||||
.order_by(MarketApp.capability, MarketApp.name)
|
||||
.all()
|
||||
)
|
||||
if not apps:
|
||||
return PLATFORM_KNOWLEDGE
|
||||
|
||||
lines = [
|
||||
"",
|
||||
"## 平台已上线技能(官方,优先推荐)",
|
||||
"以下为平台当前已发布上线的技能/应用,回答用户相关问题时**优先推荐使用**这些平台能力:",
|
||||
]
|
||||
for a in apps:
|
||||
name = getattr(a, "name", None) or "未命名"
|
||||
cap = getattr(a, "capability", None) or getattr(a, "category", None) or "通用"
|
||||
desc = (getattr(a, "description", "") or "").strip().replace("\n", " ")
|
||||
if len(desc) > 60:
|
||||
desc = desc[:60] + "…"
|
||||
lines.append(f"- **{name}**({cap}): {desc}")
|
||||
return PLATFORM_KNOWLEDGE + "\n" + "\n".join(lines)
|
||||
except Exception as e:
|
||||
logger.warning(f"[platform_knowledge] 动态构建失败,回退静态知识库: {e}")
|
||||
return PLATFORM_KNOWLEDGE
|
||||
Reference in new issue
Block a user