Merge branch 'master' into dhk-1
Integrate task deeplink/FX workspace updates from master while keeping dhk-1 menu-overrides and sensitive-words documentation in CLAUDE.md. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
e6a41dbc97
26 files changed
+1302
-84
No files matched your search
@@ -370,7 +370,7 @@ shown to users ARE the **recommended questions** (`recommended_questions` table)
|
||||
types into the existing "我的" tables, idempotently:
|
||||
- agents → `agent_favorites` rows with `origin='position'`
|
||||
- **skills → `skill_favorites` rows with `origin='position'`** (table
|
||||
`SkillFavoriteRow`, migration `20260616_02`, auto-created by `create_all`)
|
||||
`SkillFavoriteRow`, migration `20260616_04`, auto-created by `create_all`)
|
||||
- scheduled tasks → `scheduled_task_subscriptions` rows with `origin='position'`
|
||||
|
||||
Skills behave **exactly like agents**: a position only *adds* its tagged skills
|
||||
|
||||
@@ -52,6 +52,7 @@ from app.gateway.routers import (
|
||||
parallel_agent_tasks,
|
||||
parallel_agents,
|
||||
positions,
|
||||
public_config,
|
||||
public_embed,
|
||||
public_leaderboard,
|
||||
public_scheduled_tasks,
|
||||
@@ -1376,6 +1377,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_page_favorites.router)
|
||||
|
||||
# Product knowledge base API is mounted at /api/knowledge
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
"""公开只读配置接口(前端运行时读取 config.yaml 派生值)。
|
||||
|
||||
目前只暴露 ``task_deeplink`` 段(任务深链 rwfx 的目的树闸门地址 + 测试开关 +
|
||||
测试假数据),供前端登录深链流程在运行时读取——无需把这些地址硬编码进前端,
|
||||
改 ``config.yaml`` 即时生效(Gateway mtime 热重载)。
|
||||
|
||||
**无鉴权**:路由挂在 ``/api/public/`` 前缀下,已被
|
||||
``auth_middleware._PUBLIC_PATH_PREFIXES`` 白名单放行。段内只有地址与开关,不含密钥。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from deerflow.config import get_app_config
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter(prefix="/api/public/config", tags=["public-config"])
|
||||
|
||||
|
||||
@router.get("/task-deeplink")
|
||||
async def get_task_deeplink_config() -> dict:
|
||||
"""返回 ``config.yaml`` 的 ``task_deeplink`` 段(含 test/delete_test/各 URL/mock)。"""
|
||||
config = get_app_config()
|
||||
return config.task_deeplink.model_dump()
|
||||
@@ -418,3 +418,40 @@ log_system:
|
||||
enabled: true
|
||||
url: 'https://your-log-system.example.com'
|
||||
label: '日志系统'
|
||||
|
||||
task_deeplink:
|
||||
# 线上接口未通时用假数据;两个开关互相独立。
|
||||
test: true # 目的树查询走 mock.purpose_detail 假数据
|
||||
delete_test: true # 删除接口走 mock.delete 假数据(该接口尚未开发完)
|
||||
purpose_detail_url: "https://ch1.b.uat.4.cn/consumer/taskAnalyseSearch/getTaskPurposeDetail"
|
||||
delete_url: "https://ch1.b.uat.4.cn/consumer/taskAnalyseSearch/delete"
|
||||
treemap_edit_url: "https://ch1.b.uat.4.cn/web/#/task/item-aicoh/step-mode-treemap-full-edit"
|
||||
treemap_next_url: "https://ch1.b.uat.4.cn/web/#/task/item-aicoh/step-mode-treemap-full-next"
|
||||
mock:
|
||||
# test=true 时原样返回给前端(结构同真实 getTaskPurposeDetail 返回)。
|
||||
purpose_detail:
|
||||
state: "200"
|
||||
msg: "操作成功!"
|
||||
data:
|
||||
- purposeDto: { id: 5837, zzPurpose: "目的01", selectedFlag: 1, taskId: 3324, recDetailId: 4271 }
|
||||
childrenList:
|
||||
- actorDto: { id: 9101, taskId: 3324, purposeId: 5837, actorName: "行为体01", actorOrgan: "行为体01", recReason: "行为体01理由", selectedFlag: 1 }
|
||||
childrenList:
|
||||
- expectedBehaviorDto: { id: 6910, taskId: 3324, purposeId: 5837, behavior: "预期01", recReason: "预期01理由", selectedFlag: "1" }
|
||||
childrenList:
|
||||
- drivingFactorDto: { id: 7964, taskId: 3324, purposeId: 5837, drivingFactor: "预期01因素", selectedFlag: 1 }
|
||||
childrenList:
|
||||
- narrationDto: { id: 6500, purposeId: 5837, taskId: 3324, narration: "叙事01", recReason: "叙事01理由", selectedFlag: 1 }
|
||||
childrenList: []
|
||||
- actorDto: { id: 9102, taskId: 3324, purposeId: 5837, actorName: "行为体02", actorOrgan: "行为体02", recReason: "行为体02理由", selectedFlag: 1 }
|
||||
childrenList:
|
||||
- expectedBehaviorDto: { id: 6911, taskId: 3324, purposeId: 5837, behavior: "预期02", recReason: "预期02理由", selectedFlag: "1" }
|
||||
childrenList:
|
||||
- drivingFactorDto: { id: 7965, taskId: 3324, purposeId: 5837, drivingFactor: "预期02因素", selectedFlag: 1 }
|
||||
childrenList:
|
||||
- narrationDto: { id: 6501, purposeId: 5837, taskId: 3324, narration: "叙事02", recReason: "叙事02理由", selectedFlag: 1 }
|
||||
childrenList: []
|
||||
# delete_test=true 时原样返回给前端。改 success 测「成功覆盖 / 不可覆盖」两条分支。
|
||||
delete:
|
||||
message: "行动已经开始策划,不可覆盖"
|
||||
success: true
|
||||
@@ -15,10 +15,10 @@ from deerflow.config.checkpointer_config import CheckpointerConfig, load_checkpo
|
||||
from deerflow.config.database_config import DatabaseConfig
|
||||
from deerflow.config.extensions_config import ExtensionsConfig
|
||||
from deerflow.config.gateway_config import GatewayConfig
|
||||
from deerflow.config.guardrails_config import GuardrailsConfig, load_guardrails_config_from_dict
|
||||
from deerflow.config.knowledge_config import KnowledgeConfig
|
||||
from deerflow.config.knowledge_ingest_config import KnowledgeIngestConfig
|
||||
from deerflow.config.log_system_config import LogSystemConfig
|
||||
from deerflow.config.guardrails_config import GuardrailsConfig, load_guardrails_config_from_dict
|
||||
from deerflow.config.knowledge_config import KnowledgeConfig
|
||||
from deerflow.config.knowledge_ingest_config import KnowledgeIngestConfig
|
||||
from deerflow.config.log_system_config import LogSystemConfig
|
||||
from deerflow.config.login_config import AuthLoginConfig
|
||||
from deerflow.config.memory_config import MemoryConfig, load_memory_config_from_dict
|
||||
from deerflow.config.model_config import ModelConfig
|
||||
@@ -33,6 +33,7 @@ from deerflow.config.skills_config import SkillsConfig
|
||||
from deerflow.config.stream_bridge_config import StreamBridgeConfig, load_stream_bridge_config_from_dict
|
||||
from deerflow.config.subagents_config import SubagentsAppConfig, load_subagents_config_from_dict
|
||||
from deerflow.config.summarization_config import SummarizationConfig, load_summarization_config_from_dict
|
||||
from deerflow.config.task_deeplink_config import TaskDeeplinkConfig
|
||||
from deerflow.config.title_config import TitleConfig, load_title_config_from_dict
|
||||
from deerflow.config.token_usage_config import TokenUsageConfig
|
||||
from deerflow.config.tool_config import ToolConfig, ToolGroupConfig
|
||||
@@ -136,9 +137,10 @@ class AppConfig(BaseModel):
|
||||
run_events: RunEventsConfig = Field(default_factory=RunEventsConfig, description="Run event storage configuration")
|
||||
checkpointer: CheckpointerConfig | None = Field(default=None, description="Checkpointer configuration")
|
||||
stream_bridge: StreamBridgeConfig | None = Field(default=None, description="Stream bridge configuration")
|
||||
browser_context: BrowserContextConfig = Field(default_factory=BrowserContextConfig, description="Optional browser page capture integration")
|
||||
knowledge: KnowledgeConfig = Field(default_factory=KnowledgeConfig, description="Product knowledge base (obsidian-wiki compatible vault) configuration")
|
||||
knowledge_ingest: KnowledgeIngestConfig = Field(default_factory=KnowledgeIngestConfig, description="External knowledge-ingest endpoint configuration")
|
||||
browser_context: BrowserContextConfig = Field(default_factory=BrowserContextConfig, description="Optional browser page capture integration")
|
||||
knowledge: KnowledgeConfig = Field(default_factory=KnowledgeConfig, description="Product knowledge base (obsidian-wiki compatible vault) configuration")
|
||||
knowledge_ingest: KnowledgeIngestConfig = Field(default_factory=KnowledgeIngestConfig, description="External knowledge-ingest endpoint configuration")
|
||||
task_deeplink: TaskDeeplinkConfig = Field(default_factory=TaskDeeplinkConfig, description="任务深链(rwfx)目的树闸门与跳转地址配置(前端经 /api/public/config/task-deeplink 读取)")
|
||||
|
||||
@classmethod
|
||||
def resolve_config_path(cls, config_path: str | None = None) -> Path:
|
||||
@@ -387,26 +389,26 @@ def _get_config_mtime(config_path: Path) -> float | None:
|
||||
return None
|
||||
|
||||
|
||||
def _load_and_cache_app_config(config_path: str | None = None) -> AppConfig:
|
||||
"""Load config from disk and refresh cache metadata."""
|
||||
global _app_config, _app_config_path, _app_config_mtime, _app_config_skill_evolution_overrides_mtime, _app_config_is_custom
|
||||
|
||||
resolved_path = AppConfig.resolve_config_path(config_path)
|
||||
_app_config = AppConfig.from_file(str(resolved_path))
|
||||
_app_config_path = resolved_path
|
||||
_app_config_mtime = _get_config_mtime(resolved_path)
|
||||
_app_config_skill_evolution_overrides_mtime = _get_skill_evolution_overrides_mtime()
|
||||
_app_config_is_custom = False
|
||||
summarization = _app_config.summarization
|
||||
logger.info(
|
||||
"Loaded AppConfig from %s; summarization enabled=%s trigger=%s keep=%s trim_tokens_to_summarize=%s",
|
||||
resolved_path,
|
||||
summarization.enabled,
|
||||
summarization.trigger,
|
||||
summarization.keep,
|
||||
summarization.trim_tokens_to_summarize,
|
||||
)
|
||||
return _app_config
|
||||
def _load_and_cache_app_config(config_path: str | None = None) -> AppConfig:
|
||||
"""Load config from disk and refresh cache metadata."""
|
||||
global _app_config, _app_config_path, _app_config_mtime, _app_config_skill_evolution_overrides_mtime, _app_config_is_custom
|
||||
|
||||
resolved_path = AppConfig.resolve_config_path(config_path)
|
||||
_app_config = AppConfig.from_file(str(resolved_path))
|
||||
_app_config_path = resolved_path
|
||||
_app_config_mtime = _get_config_mtime(resolved_path)
|
||||
_app_config_skill_evolution_overrides_mtime = _get_skill_evolution_overrides_mtime()
|
||||
_app_config_is_custom = False
|
||||
summarization = _app_config.summarization
|
||||
logger.info(
|
||||
"Loaded AppConfig from %s; summarization enabled=%s trigger=%s keep=%s trim_tokens_to_summarize=%s",
|
||||
resolved_path,
|
||||
summarization.enabled,
|
||||
summarization.trigger,
|
||||
summarization.keep,
|
||||
summarization.trim_tokens_to_summarize,
|
||||
)
|
||||
return _app_config
|
||||
|
||||
|
||||
def get_app_config() -> AppConfig:
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
"""任务深链(``goPath=rwfx``)的「目的树闸门 + 跳转」配置。
|
||||
|
||||
前端(登录深链流程)通过公开只读接口 ``GET /api/public/config/task-deeplink``
|
||||
读取这一段:所有外部地址都是**完整 URL**(调用时仅追加 ``?taskId=`` / ``?id=``),
|
||||
随时改 ``config.yaml`` 即可(Gateway 有 mtime 热重载,无需重新构建前端)。
|
||||
|
||||
测试开关(线上接口未通时用假数据,互相独立):
|
||||
- ``test`` → 目的树查询(``purpose_detail_url``)走 ``mock.purpose_detail`` 假数据。
|
||||
- ``delete_test`` → 删除接口(``delete_url``)走 ``mock.delete`` 假数据(该接口尚未开发完时打开)。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class TaskDeeplinkConfig(BaseModel):
|
||||
"""rwfx 任务深链的目的树查询 / 删除接口与跳转页地址。"""
|
||||
|
||||
model_config = ConfigDict(extra="allow")
|
||||
|
||||
test: bool = Field(
|
||||
default=False,
|
||||
description="为真时前端目的树查询走 mock.purpose_detail 假数据(不打真实接口)",
|
||||
)
|
||||
delete_test: bool = Field(
|
||||
default=False,
|
||||
description="为真时前端删除接口走 mock.delete 假数据(删除接口未开发完时打开)",
|
||||
)
|
||||
purpose_detail_url: str = Field(
|
||||
default="",
|
||||
description="目的树查询完整 URL,调用时追加 ?taskId=",
|
||||
)
|
||||
delete_url: str = Field(
|
||||
default="",
|
||||
description="删除完整 URL,调用时追加 ?taskId=",
|
||||
)
|
||||
treemap_edit_url: str = Field(
|
||||
default="",
|
||||
description="B 系统树形完整编辑页 URL,跳转时追加 ?id=",
|
||||
)
|
||||
treemap_next_url: str = Field(
|
||||
default="",
|
||||
description="B 系统树形下一步页 URL,跳转时追加 ?id=",
|
||||
)
|
||||
mock: dict[str, Any] = Field(
|
||||
default_factory=dict,
|
||||
description="test/delete_test 为真时返回的假数据:{purpose_detail: {...}, delete: {message, success}}",
|
||||
)
|
||||
+10
-4
@@ -7,8 +7,14 @@ draft is keyed/shared by ``task_id`` and is no longer partitioned by ``user_id``
|
||||
``create_all`` adds the column for brand-new DBs; this revision patches DBs that
|
||||
already have the table.
|
||||
|
||||
Revision ID: 20260611_01
|
||||
Revises: 20260609_02
|
||||
Note: this migration originally shared the revision id ``20260611_01`` with
|
||||
``20260611_01_agents_skills_square_id`` (both branched off ``20260609_02``),
|
||||
which corrupted the alembic DAG ("present more than once" + phantom heads). It
|
||||
was renumbered to ``20260611_02`` and re-chained after that revision so the
|
||||
history is linear and single-headed.
|
||||
|
||||
Revision ID: 20260611_02
|
||||
Revises: 20260611_01
|
||||
Create Date: 2026-06-11
|
||||
"""
|
||||
|
||||
@@ -19,8 +25,8 @@ from alembic import op
|
||||
from sqlalchemy import inspect
|
||||
|
||||
|
||||
revision = "20260611_01"
|
||||
down_revision = "20260609_02"
|
||||
revision = "20260611_02"
|
||||
down_revision = "20260611_01"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
LONGTEXT(计划 JSON 可超 64 KB)。
|
||||
|
||||
Revision ID: 20260612_01
|
||||
Revises: 20260611_01
|
||||
Revises: 20260611_02
|
||||
Create Date: 2026-06-12
|
||||
"""
|
||||
|
||||
@@ -19,7 +19,7 @@ from sqlalchemy.dialects.mysql import LONGTEXT
|
||||
|
||||
|
||||
revision = "20260612_01"
|
||||
down_revision = "20260611_01"
|
||||
down_revision = "20260611_02"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
"""Add always_on (常驻/免压缩) column to skills table.
|
||||
|
||||
Revision ID: 20260616_03
|
||||
Revises: 20260616_02
|
||||
Revises: 20260616_04
|
||||
Create Date: 2026-06-16
|
||||
"""
|
||||
|
||||
@@ -13,7 +13,7 @@ from sqlalchemy import inspect
|
||||
|
||||
|
||||
revision = "20260616_03"
|
||||
down_revision = "20260616_02"
|
||||
down_revision = "20260616_04"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
+10
-4
@@ -10,8 +10,14 @@ startup (new tables are always created, even on existing DBs); this migration
|
||||
keeps the alembic history consistent per the repo convention (see
|
||||
backend/CLAUDE.md → Schema Migrations).
|
||||
|
||||
Revision ID: 20260616_02
|
||||
Revises: 20260616_01
|
||||
Note: this migration originally shared the revision id ``20260616_02`` with
|
||||
``20260616_02_knowledge_folders_templates`` (both branched off ``20260616_01``),
|
||||
which corrupted the alembic DAG ("present more than once" + phantom heads). It
|
||||
was renumbered to ``20260616_04`` and re-chained after that revision so the
|
||||
history is linear and single-headed.
|
||||
|
||||
Revision ID: 20260616_04
|
||||
Revises: 20260616_02
|
||||
Create Date: 2026-06-16
|
||||
"""
|
||||
|
||||
@@ -22,8 +28,8 @@ from alembic import op
|
||||
from sqlalchemy import inspect
|
||||
|
||||
|
||||
revision = "20260616_02"
|
||||
down_revision = "20260616_01"
|
||||
revision = "20260616_04"
|
||||
down_revision = "20260616_02"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
"""Merge the chain-seat-mode and skill-always-on migration heads.
|
||||
|
||||
Two lineages both descend from ``20260612_01`` (roundtable_jobs orchestration
|
||||
plan): ``20260615_01`` (chain seat mode) branched directly off it, while the
|
||||
``20260616_*`` line (positions → knowledge folders/templates → skill_favorites →
|
||||
skill always_on) is the other branch. That left the graph with two heads
|
||||
(``20260615_01`` and ``20260616_03``) so ``alembic upgrade head`` failed with
|
||||
"Multiple head revisions are present". This no-op merge revision joins both
|
||||
lineages so ``upgrade head`` resolves to a single head again.
|
||||
|
||||
Revision ID: 20260617_01
|
||||
Revises: 20260615_01, 20260616_03
|
||||
Create Date: 2026-06-17
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
revision = "20260617_01"
|
||||
down_revision = ("20260615_01", "20260616_03")
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
pass
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
pass
|
||||
@@ -324,3 +324,44 @@ summarization:
|
||||
type: tokens
|
||||
value: 40000
|
||||
trim_tokens_to_summarize: 8000
|
||||
|
||||
# ───────────────────────────────────────────────────────────────────────────
|
||||
# 任务深链(goPath=rwfx):目的树闸门 + 问答后跳转。前端经公开只读接口
|
||||
# GET /api/public/config/task-deeplink 读取。地址都是完整 URL(调用时仅追加
|
||||
# ?taskId= / ?id=),随时改这里即可(Gateway mtime 热重载,前端无需重建)。
|
||||
task_deeplink:
|
||||
# 线上接口未通时用假数据;两个开关互相独立。
|
||||
test: true # 目的树查询走 mock.purpose_detail 假数据
|
||||
delete_test: true # 删除接口走 mock.delete 假数据(该接口尚未开发完)
|
||||
purpose_detail_url: "https://ch1.b.uat.4.cn/consumer/taskAnalyseSearch/getTaskPurposeDetail"
|
||||
delete_url: "https://ch1.b.uat.4.cn/consumer/taskAnalyseSearch/delete"
|
||||
treemap_edit_url: "https://ch1.b.uat.4.cn/web/#/task/item-aicoh/step-mode-treemap-full-edit"
|
||||
treemap_next_url: "https://ch1.b.uat.4.cn/web/#/task/item-aicoh/step-mode-treemap-full-next"
|
||||
mock:
|
||||
# test=true 时原样返回给前端(结构同真实 getTaskPurposeDetail 返回)。
|
||||
purpose_detail:
|
||||
state: "200"
|
||||
msg: "操作成功!"
|
||||
data:
|
||||
- purposeDto: { id: 5837, zzPurpose: "目的01", selectedFlag: 1, taskId: 3324, recDetailId: 4271 }
|
||||
childrenList:
|
||||
- actorDto: { id: 9101, taskId: 3324, purposeId: 5837, actorName: "行为体01", actorOrgan: "行为体01", recReason: "行为体01理由", selectedFlag: 1 }
|
||||
childrenList:
|
||||
- expectedBehaviorDto: { id: 6910, taskId: 3324, purposeId: 5837, behavior: "预期01", recReason: "预期01理由", selectedFlag: "1" }
|
||||
childrenList:
|
||||
- drivingFactorDto: { id: 7964, taskId: 3324, purposeId: 5837, drivingFactor: "预期01因素", selectedFlag: 1 }
|
||||
childrenList:
|
||||
- narrationDto: { id: 6500, purposeId: 5837, taskId: 3324, narration: "叙事01", recReason: "叙事01理由", selectedFlag: 1 }
|
||||
childrenList: []
|
||||
- actorDto: { id: 9102, taskId: 3324, purposeId: 5837, actorName: "行为体02", actorOrgan: "行为体02", recReason: "行为体02理由", selectedFlag: 1 }
|
||||
childrenList:
|
||||
- expectedBehaviorDto: { id: 6911, taskId: 3324, purposeId: 5837, behavior: "预期02", recReason: "预期02理由", selectedFlag: "1" }
|
||||
childrenList:
|
||||
- drivingFactorDto: { id: 7965, taskId: 3324, purposeId: 5837, drivingFactor: "预期02因素", selectedFlag: 1 }
|
||||
childrenList:
|
||||
- narrationDto: { id: 6501, purposeId: 5837, taskId: 3324, narration: "叙事02", recReason: "叙事02理由", selectedFlag: 1 }
|
||||
childrenList: []
|
||||
# delete_test=true 时原样返回给前端。改 success 测「成功覆盖 / 不可覆盖」两条分支。
|
||||
delete:
|
||||
message: "行动已经开始策划,不可覆盖"
|
||||
success: true
|
||||
Reference in new issue
Block a user