xuhd
|
dba821a70e
|
@
fix(memory): 修复 Hindsight provider 生命周期的三处缺陷
HindsightProvider 被 build_memory_manager 每轮重新构造,以下三个问题
都源于这个无状态特性未被正确处理:
1. document_id 每轮漂移 —— 原 _reset_retain_batch 用微秒时间戳拼接,
导致同一 thread 的每轮 retain 落到不同文档,文档数随对话轮数线性膨胀。
改为按 thread_id 确定性派生 (thread-{thread_id}),同一 thread 累积成一份。
2. retain_every_n_turns 失效 —— 进程内 _turn_counter 每轮被 initialize
重置,retain_every_n_turns > 1 时永不触发。新增 turn_index 参数贯穿
sync_turn/sync_all,由 MemoryMiddleware 按对话历史 (count_user_turns)
算出并传入;_turn_counter 仅作缺省退路。
3. aiohttp ClientSession 泄漏 —— 缓存的客户端从不 shutdown,且 _run_coro
每次新建事件循环使缓存客户端失效,触发 "Unclosed client session"。
改为客户端即开即关:_run_with_client 在 finally 保证关闭,_client_factory
作为可覆盖的测试注入点。
测试:test_hindsight_provider.py 全量重写 (含 TestDocumentId /
TestRetainEveryNTurnsAcrossRecreation / TestClientLifecycle),
新增 test_memory_message_processing.py,test_memory_manager.py 补
turn_index 透传用例。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@
|
2026-05-18 14:34:22 +08:00 |
|
吉鑫升
|
4761677676
|
Merge remote-tracking branch 'origin/master' into ji
|
2026-05-18 10:03:49 +08:00 |
|
 吉鑫升andClaude Opus 4.7
|
f61d053010
|
feat(skills): 新增技能详情字段并统一发布图标
- 技能新增 detail 字段(skills 表新增列 + Alembic 迁移),
由管理员或技能发布者编辑,内置/公开技能仅管理员可编辑
- 新增 PUT /api/skills/{name}/detail 接口,GET/列表接口返回 detail
- 新增可复用的技能详情弹窗组件,支持 Markdown 渲染与内联编辑
- 智能体创建/编辑选技能、智能体卡片技能徽章均可查看技能详情
- 将定时任务/智能体/技能的发布图标统一为 Globe/Lock
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-18 10:03:37 +08:00 |
|
 xuhdandClaude Opus 4.7
|
39def1c20b
|
feat(skills): curator 健壮性加固 + 评审模型可配置 + 手动触发体验
调度健壮性:
- 技能进化总开关 skill_evolution.enabled 真正生效;CuratorConfig
与 CuratorSubConfig 默认 enabled 改为 false(显式 opt-in)
- 新增 per-user 运行锁(.curator_state 的 running/started_at),
防定时器与手动触发并发重复运行;6h stale 检测防进程残留死锁
- maybe_run_curator 改用 ThreadPoolExecutor 限并发(上限 5),
防首次部署所有用户同时到期的惊群
- 首次运行持续失败时按 6h 退避重试,不再每个 tick 烧 LLM 配额
- should_run_now 时间解析容忍 naive 时间串;损坏的 last_run_at
触发重跑而非永久死锁
- SkillStore 新增 list_published_names 批量接口,curator 一轮
只查一次 published,取代逐技能查库
LLM 评审超时:
- _run_llm_review 给 agent.invoke 套整体超时
(curator.review_timeout_seconds,默认 600s),超时中止本次评审
并在 curator 日志输出,curator 正常收尾、释放运行锁
- copy_context 把 user 上下文传入工作线程
模型可配置:
- 新增 curator.model_name;curator 评审与技能安全审核共用该模型,
未配置则回退主模型
- 移除独立的 moderation_model_name 配置
- 前端进化面板新增模型下拉选择器
手动触发体验:
- /api/curator/run 派发后台线程前先预检,返回 {triggered, reason},
不再无论开关状态都提示"已开始"
- 前端:总开关/curator 开关未开时禁用"立即执行"按钮,
被预检拦下时按原因(开关未开 / 已有任务在跑)给出准确提示
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-16 15:50:15 +08:00 |
|
 吉鑫升andClaude Opus 4.7
|
646cb8caeb
|
feat: 标签管理功能 + 问答前缀对用户隐藏
标签管理:
- 新增 tags/tag_assignments 持久化层、迁移、/api/tags 路由
- 标签分智能体/技能/定时任务三类, 仅同类型可互打, 仅 admin 可增删改与打标签
- 三类资源列表支持按名称模糊检索与按标签筛选(走后端查询参数)
- 前端新增标签管理页、TagPickerDialog(点击即时绑定)、彩色标签 chip
问答前缀:
- 前缀不再拼入消息 content, 改存 additional_kwargs 由 PromptPrefixMiddleware
在调模型前临时注入, 用户界面看不到前缀但模型仍收到
- 修正 thread_existed 闸门导致首轮前缀被跳过的问题
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-15 16:19:08 +08:00 |
|
吉鑫升
|
aeba15eb16
|
Merge branch 'master' of http://192.168.0.200/knowledge-base-bj/deerflow-server into ji
# Conflicts:
# frontend-web/src/pages/WorkspaceRoutes.tsx
# offline-backend-20260512/backend/packages/harness/deerflow/persistence/models/__init__.py
|
2026-05-15 11:21:48 +08:00 |
|
 xuhdandClaude Opus 4.7
|
6947a3ffa7
|
chore(tests): ignore tests/ 目录 + 同步现有测试到新 skill_archive 签名
- .gitignore: 新增 offline-backend-20260512/backend/tests/* 规则,
让后续新增的测试文件不再误进入版本控制
- test_skills_multitenancy.py: 同步上次 feat(skills) 提交里
skill_archive(name, reason) 必填 reason 的签名变更
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-15 00:03:07 +08:00 |
|
吉鑫升
|
3ea33e1dee
|
大模型速度增加提示
|
2026-05-14 19:12:14 +08:00 |
|
 xuhdandClaude Opus 4.7
|
3e6e3c08d5
|
feat(skills): curator 三条件过滤 — agent 创建 + 未发布 + 无引用
Curator 之前只过滤 source=='agent',导致两类 skill 仍会被自动归档:
1. owner 已 published 的 skill(user B 在用,结果被 curator 收走)
2. 加进 agent.skills 但 .usage.json 活动不够频繁的 skill
新规则:curator transitions 和 LLM 合并候选**只**作用于同时满足
三条件的 skill —— source=='agent' + published==False + 不被任何
agent.config.yaml 的 skills 字段引用。
curator.py
- 新 helper _collect_referenced_skill_names():扫所有
.deer-flow/agents/*/config.yaml 把 skills 字段聚合成 set,一次
curator run 内只调一次
- 新 helper _is_skill_published(name):通过 SkillStore 查 published
状态,失败时返回 False(保守降级到旧行为)
- 新 helper _eligible_for_curation(name, entry, owned_set, referenced_set)
三条件合一判定
- apply_automatic_transitions 应用三条件过滤;返回的 counters 加
skipped_referenced / skipped_published 计数
- _render_candidate_list 应用同一过滤,LLM 看不到 protected skill
- _make_skill_archive_tool safety net:即使 LLM 编造名字调 archive,
工具内部再做一次"被引用 + published"检查,违规拒绝并记 warning
测试 tests/test_skills_multitenancy.py 新增 5 用例:
- test_curator_skips_skill_referenced_by_any_agent
- test_curator_skips_published_skill
- test_curator_archives_orphan_unpublished_skill
- test_skill_archive_tool_refuses_referenced_or_published
- test_collect_referenced_skill_names_aggregates_from_disk
跑测试:tests/test_skills_multitenancy.py 17/17,全套 36/36 全过。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-14 18:49:22 +08:00 |
|
 xuhdandClaude Opus 4.7
|
99febda256
|
feat(skills/notifications): 多租户阶段 4 — 测试 + 前端
后端:
tests/test_skills_multitenancy.py(12 个用例,全部通过)
- SkillStore: 可见性 / 全局重名拒绝 / owner-only update+delete /
admin override / ensure_legacy 仅补 NULL owner
- 路由助手 _get_editable_skill_or_raise / _get_owned_skill_or_raise
的 owner / admin / 403 / 404 分流
- cascade_skill_unpublished_or_deleted:
· unpublish 同时扫两个用户的 agent,剥掉 skill;自己改自己不发
通知,其他人收 agent_skill_removed
· admin_takedown 额外给 skill owner 发 skill_taken_down
- NotificationStore CRUD + unread_count + 跨用户隔离
- 同步版 apply_automatic_transitions 用户隔离:A 跑 curator 不
动 B 的 skill;curator_log per-user 分桶
前端 — core/notifications/{types,api,hooks,index}.ts
- 类型对齐 routers/notifications.py 的 NotificationItem
- listNotifications / getUnreadCount / markRead / markAllRead /
deleteNotification
- useNotifications / useUnreadCount(refetchInterval=30s) / mutation 钩子
前端 — components/workspace/notification-bell.tsx
- 顶部铃铛图标 + 未读红点(>99 显示 99+)
- 复用 DropdownMenu 作为弹层(项目暂无 Popover 原语)
- 列表项:未读蓝点 + 标题 + body + 相对时间,悬停露出删除按钮
- 标记单条已读 / 全部已读 / 删除
- 接入 workspace-nav-menu.tsx,作为 SidebarMenuItem 放在设置入口上方
前端 — Skill 多租户字段
- core/skills/type.ts 加 owner_user_id / published / builtin
- core/skills/api.ts 加 setSkillPublished + deleteCustomSkill
- core/skills/hooks.ts 加 useSetSkillPublished + useDeleteCustomSkill
前端 — settings/skill-settings-page.tsx
- 抽出 SkillRow 子组件,每项渲染 owner badge(内置/我的/来自他人/
已发布),样式抄自 agent-card.tsx 的 isBuiltin/isOwned/isFromOthers
- canManage = isOwned || isAdmin;canTogglePublish 同上但排除内置
- 发布/取消发布按钮(Eye / EyeOff),调用 setSkillPublished
- 删除按钮 + 二次确认 Dialog,调用 deleteCustomSkill
- 启用开关保持原样
前端 — i18n
- types.ts: 新增 NotificationsTranslations + Translations.notifications;
settings.skills 加 badgeBuiltin/badgeMine/badgeFromOthers(+Title) /
badgePublished(+Title) / publishAction / unpublishAction /
publishSuccess / unpublishSuccess / deleteAction / deleteConfirm /
deleteSuccess
- zh-CN.ts / en-US.ts 同步补齐对应文案
验证
- PYTHONPATH=. uv run pytest tests/test_skills_multitenancy.py -v →
12 passed in 2.08s
- 与现有 test_agents_backend / test_skill_evolution_runtime /
test_skills_install_upload 并行跑:41 通过 + 1 个 pre-existing 失败
(test_validate_rejects_missing_skill_md 期望 "SKILL.md" 但收到
"Skill archive is empty",与本期改动无关)
- pnpm typecheck:本次新增/修改的文件零新增错误;剩余报错全部为
pre-existing 的 next/link、next/navigation 别名声明缺失、
workspace-nav-menu.tsx 的 SettingsSection 类型不匹配、nextra
缺失、markdown-docx 第三方库等
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-14 17:35:02 +08:00 |
|
 xuhdandClaude Opus 4.7
|
9b6b94d919
|
feat(skills): 自我进化后端 — curator 配置可编辑 + 运行日志可读
后端骨架:
- curator.py / usage.py / skill_tools.py:基于使用计数的生命周期管理
+ LLM 合并/归档建议(同事已有原型,集中提交)
- skill_evolution_config.py:CuratorConfig 嵌套模型
- app.py:启动时按间隔触发 curator 后台线程
- tools.py:开启自我进化时一并注册 skill_list / skill_view 工具
- skill_manage_tool.py:agent 创建技能时标记 source=agent
本次新增:
- skill_evolution_runtime.py:skill_evolution.json 读写,原子写入
- app_config.py:把 overrides 深合并到 AppConfig.skill_evolution,
并把 overrides 的 mtime 纳入缓存失效条件,前端 PUT 后热生效
- curator_log.py:进程内 ring buffer (maxlen=200),所有 record/get
操作内部兜异常,保证 logging 永远不会让 curator 跑挂
- curator.py 关键节点插桩:run_started / 自动转换计数 / 候选数 /
LLM agent invoke / 解析结果 / archive 动作 / run complete
- routers/skills.py:GET/PUT /api/curator/config(写到
skill_evolution.json + reset_app_config)+ GET /api/curator/logs
测试:
- tests/test_skill_evolution_runtime.py:overrides 往返、损坏 JSON
容错、AppConfig 合并、ring buffer 线程安全、record 异常吞咽
杂项:
- .gitignore:忽略 .deer-flow/* 与 skills/* 等运行时目录
- uv.lock:跟随依赖锁更新
- 清理已废弃的 agent runtime 数据 SOUL.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-14 12:00:21 +08:00 |
|
 xuhdandClaude Opus 4.7
|
43044232bb
|
feat: admin可删除内置专家
复用 _get_editable_or_raise 分支,给 AgentStore 增加 delete_builtin,
路由按 edit_mode 决定走 delete 还是 delete_builtin;前端 agent-card
为 admin 显示内置 agent 的删除按钮。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-14 09:53:13 +08:00 |
|
吉鑫升
|
31abad86d5
|
智能体配置
|
2026-05-13 20:04:06 +08:00 |
|
吉鑫升
|
a27206c543
|
Update local frontend and backend changes
|
2026-05-13 17:17:42 +08:00 |
|
吉鑫升
|
faca2c9a2d
|
Merge branch 'likun' into master
|
2026-05-13 17:02:22 +08:00 |
|
吉鑫升
|
aa034f8669
|
定时任务订阅模式
|
2026-05-13 14:59:27 +08:00 |
|
likun
|
b8926f00d7
|
新增用户意图确认功能
|
2026-05-13 14:36:44 +08:00 |
|
吉鑫升
|
cf2e4bdd9c
|
智能体分权
|
2026-05-13 11:36:17 +08:00 |
|