Feat: edit agent png cards

This commit is contained in:
Grail Finder
2025-01-28 20:40:09 +03:00
parent 976d6423ac
commit 7bf18dede5
9 changed files with 222 additions and 43 deletions

View File

@@ -20,6 +20,7 @@ type CharCardSpec struct {
Spec string `json:"spec"`
SpecVersion string `json:"spec_version"`
Tags []any `json:"tags"`
Extentions []byte `json:"extentions"`
}
type Spec2Wrapper struct {
@@ -43,3 +44,15 @@ type CharCard struct {
Role string `json:"role"`
FilePath string `json:"filepath"`
}
func (cc *CharCard) ToSpec(userName string) *CharCardSpec {
descr := strings.ReplaceAll(strings.ReplaceAll(cc.SysPrompt, cc.Role, "{{char}}"), userName, "{{user}}")
return &CharCardSpec{
Name: cc.Role,
Description: descr,
FirstMes: cc.FirstMsg,
Spec: "chara_card_v2",
SpecVersion: "2.0",
Extentions: []byte("{}"),
}
}