Merge branch 'master' of http://192.168.0.200/knowledge-base-bj/deerflow-server into xuhd
This commit is contained in:
commit
8f88427d4e
19 files changed
+751
-76
No files matched your search
@@ -66,6 +66,21 @@ async def _to_thread(func, /, *args, **kwargs):
|
||||
return await asyncio.to_thread(func, *args, **kwargs)
|
||||
|
||||
|
||||
async def _bump_patch_best_effort(name: str) -> None:
|
||||
"""记一次技能维护活动(patch / edit)。
|
||||
|
||||
刷新 ``.usage.json`` 的 ``patch_count`` 与 ``last_patched_at``,让 curator 的
|
||||
年龄流转把"Agent 正在主动维护的技能"算作活跃,而不是误判为闲置后归档。
|
||||
best-effort:埋点失败只记 DEBUG 日志,绝不影响技能写入主流程。
|
||||
"""
|
||||
try:
|
||||
from deerflow.skills.usage import bump_patch
|
||||
|
||||
await _to_thread(bump_patch, name)
|
||||
except Exception:
|
||||
logger.debug("Failed to bump patch count for %r", name, exc_info=True)
|
||||
|
||||
|
||||
async def _ensure_skill_db_registered(store: SkillStore, name: str, user_id: str) -> None:
|
||||
"""Idempotently record an agent-created skill's ownership in the DB.
|
||||
|
||||
@@ -229,6 +244,7 @@ async def _skill_manage_impl(
|
||||
name,
|
||||
_history_record(action="edit", file_path=SKILL_MD_FILE, prev_content=prev_content, new_content=content, thread_id=thread_id, scanner=scan),
|
||||
)
|
||||
await _bump_patch_best_effort(name)
|
||||
await refresh_skills_system_prompt_cache_async()
|
||||
return f"Updated custom skill '{name}'."
|
||||
|
||||
@@ -253,6 +269,7 @@ async def _skill_manage_impl(
|
||||
name,
|
||||
_history_record(action="patch", file_path=SKILL_MD_FILE, prev_content=prev_content, new_content=new_content, thread_id=thread_id, scanner=scan),
|
||||
)
|
||||
await _bump_patch_best_effort(name)
|
||||
await refresh_skills_system_prompt_cache_async()
|
||||
return f"Patched custom skill '{name}' ({replacement_count} replacement(s) applied, {occurrences} match(es) found)."
|
||||
|
||||
|
||||
Reference in new issue
Block a user