From 7bf18dede570116b4508b2c936106ed4bf47d55b Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Tue, 28 Jan 2025 20:40:09 +0300 Subject: Feat: edit agent png cards --- models/card.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'models/card.go') 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("{}"), + } +} -- cgit v1.2.3