sync update from LAN repo (source ji @ 85078a31)

This commit is contained in:
gozeros committed 2026-10-21 15:09:16 +08:00
1 parent 5d6627af50
commit e602d88695
864 files changed
+99150 -6346

No files matched your search

@@ -42,11 +42,14 @@ from app.gateway.routers import (
compact_menu_overrides,
dashboard_sessions,
deep_research,
direct_chat,
external_llmwiki,
feedback,
fixed_questions,
flow_extract,
gongwen_documents,
html_page_favorites,
html_runtime,
intent,
knowledge,
knowledge_ingest,
@@ -86,6 +89,8 @@ from app.gateway.routers import (
roundtable_task_drafts,
runs,
scheduled_tasks,
task_analysis,
task_analysis_qa,
sensitive_words,
sentiment_agent,
skill_addresses,
@@ -103,8 +108,10 @@ from app.gateway.routers import (
threads,
tool_metrics,
uploads,
upload_policy,
user_preferences,
user_prompts,
web_app_sites,
workflow_data_sources,
workflow_embed,
workflow_planning,
@@ -1144,6 +1151,18 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
"Deep-research collector agent seeding failed at startup (non-fatal)"
)
# Built-in public-document agent: its small workflow skill orchestrates
# the separately installed offline DOCX engine. Seed before legacy
# agent sync so it is immediately available to ordinary conversations.
try:
from app.gateway.routers._gongwen_seed import ensure_gongwen_agent
ensure_gongwen_agent()
except Exception:
logger.exception(
"Public-document agent seeding failed at startup (non-fatal)"
)
# Workflow Studio owns a separate planning controller. It must be
# seeded before _sync_legacy_agents, so the planner is available to
# every user's candidate-workflow request on a fresh deployment.
@@ -1184,6 +1203,18 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
"Agentfx analyst agent seeding failed at startup (non-fatal)"
)
# 内置「任务分析总控」(任务分析定时的专用总控:无人值守分解任务并派活)。
try:
from app.gateway.routers._task_analysis_seed import (
ensure_task_analysis_functional_agents,
)
ensure_task_analysis_functional_agents()
except Exception:
logger.exception(
"Task analysis coordinator agent seeding failed at startup (non-fatal)"
)
# ?????????????????3Q/6BF/7BF/8BF??agent/chain ?????
try:
business_mapping_store = getattr(app.state, "business_mapping_store", None)
@@ -1293,6 +1324,23 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
except Exception:
logger.exception("Scheduled task service failed to start")
# External-task chain-binding scheduler (任务分析定时)。
task_analysis_enabled = os.environ.get("TASK_ANALYSIS_ENABLED", "true").strip().lower()
if task_analysis_enabled in {"0", "false", "no", "off"}:
logger.info("Task analysis service disabled by TASK_ANALYSIS_ENABLED")
else:
try:
from deerflow.runtime.task_analysis import TaskAnalysisService
task_analysis_store = getattr(app.state, "task_analysis_store", None)
if task_analysis_store is not None:
ta_service = TaskAnalysisService(app, task_analysis_store)
app.state.task_analysis_service = ta_service
await ta_service.start()
logger.info("Task analysis service started")
except Exception:
logger.exception("Task analysis service failed to start")
yield
llmwiki_index_scheduler_task = getattr(app.state, "llmwiki_index_scheduler_task", None)
@@ -1365,6 +1413,13 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
finally:
set_scheduled_task_service(None)
try:
ta_service = getattr(app.state, "task_analysis_service", None)
if ta_service is not None:
await ta_service.stop()
except Exception:
logger.exception("Failed to stop task analysis service")
# Stop channel service on shutdown (bounded to prevent worker hang)
try:
from app.channels.service import stop_channel_service
@@ -1615,19 +1670,26 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
from app.gateway.routers import wiki_packages
app.include_router(wiki_packages.router)
# Artifacts API is mounted at /api/threads/{thread_id}/artifacts
app.include_router(artifacts.router)
# Web App site artifacts (multi-page site / flowchart / map) with signed
# public static hosting at /api/public/site-preview/{token}/
app.include_router(web_app_sites.router)
# Uploads API is mounted at /api/threads/{thread_id}/uploads
app.include_router(uploads.router)
# Global database-backed upload limits at /api/upload-policy.
app.include_router(upload_policy.router)
# Optional Chrome-extension page capture API is mounted at /api/browser-context
app.include_router(browser_context.router)
# Thread cleanup API is mounted at /api/threads/{thread_id}
app.include_router(threads.router)
from app.gateway.routers import analysis_projects
app.include_router(analysis_projects.router)
app.include_router(threads.router)
# Agents API is mounted at /api/agents
app.include_router(agents.router)
app.include_router(strategy_agents.router)
@@ -1697,6 +1759,9 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
# Sensitive-word map (敏感词管理 / 脱敏词) at /api/sensitive-words
app.include_router(sensitive_words.router)
# Public-document workbench: durable originals, review snapshots and DOCX versions.
app.include_router(gongwen_documents.router)
# Sentiment-analysis virtual agent AG-UI SSE proxy at /api/sentiment-agent
app.include_router(sentiment_agent.router)
@@ -1750,6 +1815,10 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
# Scheduled task API is mounted at /api/scheduled-tasks
app.include_router(scheduled_tasks.router)
# External-task multi-agent scheduled analysis (/api/task-analysis)
app.include_router(task_analysis.router)
app.include_router(task_analysis_qa.router)
# Public, unauthenticated read-only scheduled task API
# (/api/public/scheduled-tasks/*). Lets external systems query tasks and
# surface results without a DeerFlow login.
@@ -1761,6 +1830,7 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
# Public embed Q&A status polling (/api/public/embed/*)
app.include_router(public_embed.router)
app.include_router(public_config.router)
app.include_router(html_runtime.router)
app.include_router(html_page_favorites.router)
# Product knowledge base API is mounted at /api/knowledge
@@ -1801,6 +1871,8 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
# Feedback API is mounted at /api/threads/{thread_id}/runs/{run_id}/feedback
app.include_router(feedback.router)
# Aggregate user-feedback answer quality (not a complete capability score).
app.include_router(feedback.agent_score_router)
# Notifications API is mounted at /api/notifications
app.include_router(notifications.router)
@@ -1829,6 +1901,9 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
# 开放问答接口 /api/open/chat —— 无需登录,指定模型 + 智能体做问答,可关闭思考模式
app.include_router(open_chat.router)
# 极速问答 /api/direct-chat/stream —— 直连大模型流式输出,不走 lead agent / 工具 / 技能
app.include_router(direct_chat.router)
# 开放接口 /api/open/3qfx/ask —— 无需登录,按 taskId 直接发起 3qfx 第一次问答(后台运行,落成真实会话)
app.include_router(open_3qfx.router)