summaryrefslogtreecommitdiff
path: root/make_chat.go
diff options
context:
space:
mode:
Diffstat (limited to 'make_chat.go')
-rw-r--r--make_chat.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/make_chat.go b/make_chat.go
index b6736c4..5c7cb75 100644
--- a/make_chat.go
+++ b/make_chat.go
@@ -1,6 +1,11 @@
package chatpb
-import "go.wit.com/log"
+import (
+ "time"
+
+ "go.wit.com/log"
+ timestamppb "google.golang.org/protobuf/types/known/timestamppb"
+)
func TestChat() {
conversation := NewChats()
@@ -71,6 +76,7 @@ func (c *Chats) AddGeminiComment(s string) {
chat.From = Who_GEMINI
chat.Content = s
+ chat.Ctime = timestamppb.New(time.Now())
c.Append(chat)
}
@@ -83,3 +89,15 @@ func (c *Chats) AddUserComment(s string) {
c.Append(chat)
}
+
+func UnmarshalChats(data []byte) (*Chats, error) {
+ c := new(Chats)
+ err := c.Unmarshal(data)
+ return c, err
+}
+
+func UnmarshalChatsTEXT(data []byte) (*Chats, error) {
+ c := new(Chats)
+ err := c.UnmarshalTEXT(data)
+ return c, err
+}