Feat: add character card support

This commit is contained in:
Grail Finder
2024-12-02 19:58:03 +03:00
parent 8d3997baff
commit a5ab816c94
15 changed files with 346 additions and 37 deletions

View File

@@ -8,13 +8,13 @@ import (
type Chat struct {
ID uint32 `db:"id" json:"id"`
Name string `db:"name" json:"name"`
Msgs string `db:"msgs" json:"msgs"` // []MessagesStory to string json
Msgs string `db:"msgs" json:"msgs"` // []RoleMsg to string json
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}
func (c Chat) ToHistory() ([]MessagesStory, error) {
resp := []MessagesStory{}
func (c Chat) ToHistory() ([]RoleMsg, error) {
resp := []RoleMsg{}
if err := json.Unmarshal([]byte(c.Msgs), &resp); err != nil {
return nil, err
}