diff options
author | Grail Finder <wohilas@gmail.com> | 2025-01-28 20:40:09 +0300 |
---|---|---|
committer | Grail Finder <wohilas@gmail.com> | 2025-01-28 20:40:09 +0300 |
commit | 7bf18dede570116b4508b2c936106ed4bf47d55b (patch) | |
tree | 3391b360a859589a2019a8da2cf5c72c8c33d3c3 /models/card.go | |
parent | 976d6423ac0f0b80efb2c933d8c3e6a816507c54 (diff) |
Feat: edit agent png cards
Diffstat (limited to 'models/card.go')
-rw-r--r-- | models/card.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/models/card.go b/models/card.go index fb807f3..adfb030 100644 --- a/models/card.go +++ b/models/card.go @@ -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("{}"), + } +} |