diff options
Diffstat (limited to 'models')
-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("{}"), + } +} |