- 技能新增 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>
34 lines
1.7 KiB
Python
34 lines
1.7 KiB
Python
"""ORM model for custom skill ownership + publish state.
|
|
|
|
Note: skill content lives on disk under ``skills/custom/{name}/``; this table
|
|
only stores the metadata (owner, published flag, timestamps). The skill
|
|
``name`` doubles as the primary key because the filesystem path is already
|
|
keyed by name, and we require global name uniqueness across all owners.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import UTC, datetime
|
|
|
|
from sqlalchemy import Boolean, DateTime, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from deerflow.persistence.base import Base
|
|
|
|
|
|
class SkillRow(Base):
|
|
__tablename__ = "skills"
|
|
|
|
# Global unique name — must match the on-disk folder name under skills/custom/.
|
|
# Hyphen-case or snake_case allowed; see deerflow.skills.validation.
|
|
name: Mapped[str] = mapped_column(String(64), primary_key=True)
|
|
owner_user_id: Mapped[str | None] = mapped_column(String(64), nullable=True, index=True)
|
|
published: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False, index=True)
|
|
# Human-authored long-form detail/introduction, editable by the skill owner
|
|
# or an admin. Distinct from the skill ``description`` parsed from SKILL.md;
|
|
# kept in the DB so admins can annotate built-in skills without rewriting
|
|
# the shared on-disk SKILL.md file.
|
|
detail: Mapped[str | None] = mapped_column(Text, nullable=True, default=None)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, default=lambda: datetime.now(UTC))
|
|
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, default=lambda: datetime.now(UTC), onupdate=lambda: datetime.now(UTC))
|