55 lines
1.6 KiB
Go
55 lines
1.6 KiB
Go
package spells
|
|
|
|
import (
|
|
"fmt"
|
|
"sync"
|
|
|
|
"gitea.maximumdirect.net/eric/notarius/internal/framework/llm"
|
|
"gitea.maximumdirect.net/eric/notarius/internal/framework/promptfs"
|
|
"gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/shared"
|
|
)
|
|
|
|
const scriptoriumPromptRoot = "assets/prompts"
|
|
|
|
var promptAssetManifest = shared.PromptAssetManifest{
|
|
ModuleDir: "dnd.spells",
|
|
ModuleFiles: []promptfs.ModulePromptFile{
|
|
{Name: "dnd.spells.yaml", Path: "assets/prompts/dnd.spells.yaml"},
|
|
{Name: "catalog.md", Path: "assets/prompts/catalog.md"},
|
|
{Name: "task.md", Path: "assets/prompts/task.md"},
|
|
{Name: "instructions.md", Path: "assets/prompts/instructions.md"},
|
|
},
|
|
SharedFiles: []string{
|
|
"common-dnd-system.md",
|
|
"common-dnd-extraction-evidence.md",
|
|
"common-dnd-identity.md",
|
|
"common-dnd-transcript.md",
|
|
"common-dnd-references.md",
|
|
"common-dnd-npcs.md",
|
|
},
|
|
}
|
|
|
|
func RegisterPromptAssets(registry *llm.AssetRegistry) error {
|
|
promptFS, err := promptAssetManifest.PromptFS(embeddedAssets)
|
|
if err != nil {
|
|
return fmt.Errorf("prepare spell prompt assets: %w", err)
|
|
}
|
|
if err := registry.RegisterPromptFS(promptFS, scriptoriumPromptRoot); err != nil {
|
|
return err
|
|
}
|
|
return registry.RegisterSchemaFS(embeddedAssets, "assets/schemas")
|
|
}
|
|
|
|
func scriptoriumPromptMetadata() (string, error) {
|
|
scriptoriumPromptHashOnce.Do(func() {
|
|
scriptoriumPromptHash, scriptoriumPromptHashErr = promptAssetManifest.Hash(embeddedAssets)
|
|
})
|
|
return scriptoriumPromptHash, scriptoriumPromptHashErr
|
|
}
|
|
|
|
var (
|
|
scriptoriumPromptHashOnce sync.Once
|
|
scriptoriumPromptHash string
|
|
scriptoriumPromptHashErr error
|
|
)
|