refactor(skills): 技能库 - 将内置 Markdown 包移至 backend/builtin
This commit is contained in:
1 parent
caaa178722
commit
1b83164386
83 files changed
+17
-7
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,11 @@
|
||||
package builtin
|
||||
|
||||
import "embed"
|
||||
|
||||
// FS contains the built-in skill packages shipped with the backend.
|
||||
//
|
||||
// The Markdown packages live outside internal Go packages so they are easy to
|
||||
// review and maintain as product content while remaining embedded in binaries.
|
||||
//
|
||||
//go:embed *
|
||||
var FS embed.FS
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": 1,
|
||||
"updated": "2026-09-22",
|
||||
"note": "技能目录来自 backend/internal/skills/builtin/ 下的 Markdown 技能包;此文件只保存场景组合,不保存技能正文。",
|
||||
"note": "技能目录来自 backend/builtin/ 下的 Markdown 技能包;此文件只保存场景组合,不保存技能正文。",
|
||||
"presets": [
|
||||
{
|
||||
"presetId": "short-drama-starter",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package skills
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
@@ -11,12 +10,12 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
builtinAssets "infinite-canvas/backend/builtin"
|
||||
"infinite-canvas/backend/internal/kernel"
|
||||
"infinite-canvas/backend/internal/model"
|
||||
)
|
||||
|
||||
//go:embed builtin
|
||||
var builtinSkillFiles embed.FS
|
||||
var builtinSkillFiles = builtinAssets.FS
|
||||
|
||||
type builtinSkillMetadata struct {
|
||||
Name string
|
||||
@@ -81,7 +80,7 @@ func (s *Service) EnsureBuiltinSkills() error {
|
||||
func loadBuiltinSkillPackages(tombstones interface {
|
||||
BuiltinSkillTombstoned(string) (bool, error)
|
||||
}) ([]builtinSkillPackage, error) {
|
||||
entries, err := builtinSkillFiles.ReadDir("builtin")
|
||||
entries, err := builtinSkillFiles.ReadDir(".")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("读取内置技能目录失败: %w", err)
|
||||
}
|
||||
@@ -100,7 +99,7 @@ func loadBuiltinSkillPackages(tombstones interface {
|
||||
}
|
||||
seen[skillID] = struct{}{}
|
||||
|
||||
base := path.Join("builtin", skillID)
|
||||
base := skillID
|
||||
body, err := builtinSkillFiles.ReadFile(path.Join(base, "SKILL.md"))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("读取内置技能 %s 入口文件失败: %w", skillID, err)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package skills
|
||||
|
||||
// Historical JSON seed definitions were migrated to builtin/<skill-id>/SKILL.md.
|
||||
// Historical JSON seed definitions were migrated to backend/builtin/<skill-id>/SKILL.md.
|
||||
// This file is intentionally kept as a migration marker so old package references
|
||||
// are easy to identify in downstream branches; it contains no runtime data.
|
||||
Reference in new issue
Block a user