From 21ca3300d4e8bccb6e324ec7c3fa62aa2f1cea35 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 22 Aug 2025 02:38:49 -0500 Subject: [PATCH] changed protobuf --- chat.proto | 14 ++++---------- example.go | 11 +++++++---- helpers.go | 12 ++++++------ 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/chat.proto b/chat.proto index 19b42e1..1cc083a 100644 --- a/chat.proto +++ b/chat.proto @@ -40,22 +40,16 @@ message ChatEntry { // `autogenpb:nomute string content = 3; Table table = 4; repeated ToolCall ToolCalls = 5; - string ContentFile = 6; // `autogenpb:unique` `autogenpb:sort` + string ContentFile = 6; string uuid = 7; // `autogenpb:unique` `autogenpb:sort` repeated CodeSnippet Snippets = 8; } message Chat { // `autogenpb:nomutex` - Who from = 1; + string uuid = 1; // `autogenpb:unique` `autogenpb:sort` google.protobuf.Timestamp ctime = 2; - string content = 3; - Table table = 4; - repeated ToolCall ToolCalls = 5; - string ContentFile = 6; // `autogenpb:unique` `autogenpb:sort` - string uuid = 7; // `autogenpb:unique` `autogenpb:sort` - repeated CodeSnippet Snippets = 8; - string ChatName = 9; - repeated ChatEntry Entries = 10; + string ChatName = 3; + repeated ChatEntry Entries = 4; } message Chats { // `autogenpb:marshal` `autogenpb:mutex` diff --git a/example.go b/example.go index ff33b05..c443027 100644 --- a/example.go +++ b/example.go @@ -10,11 +10,14 @@ func ExampleChat() *Chats { t := conversation.AddTable() t.AddRow([]string{"apple", "pear"}) - gchat := conversation.AddGeminiComment("funny") + conversation.AddGeminiComment("funny") - snip := new(CodeSnippet) - snip.Filename = "log/snip1.txt" - gchat.Snippets = append(gchat.Snippets, snip) + /* + gchat := conversation.AddGeminiComment("funny") + snip := new(CodeSnippet) + snip.Filename = "log/snip1.txt" + gchat.Snippets = append(gchat.Snippets, snip) + */ conversation.AddUserComment("yes") diff --git a/helpers.go b/helpers.go index 97c4d1b..d7819e5 100644 --- a/helpers.go +++ b/helpers.go @@ -12,8 +12,8 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" ) -func (c *Chats) AddGeminiComment(s string) *Chat { - chat := new(Chat) +func (c *Chats) AddGeminiComment(s string) *ChatEntry { + chat := new(ChatEntry) chat.From = Who_GEMINI chat.Content = s @@ -24,8 +24,8 @@ func (c *Chats) AddGeminiComment(s string) *Chat { return chat } -func (c *Chats) AddUserComment(s string) *Chat { - chat := new(Chat) +func (c *Chats) AddUserComment(s string) *ChatEntry { + chat := new(ChatEntry) chat.From = Who_USER chat.Content = s @@ -172,12 +172,12 @@ func (c *Chat) VerifyUuid() bool { return false } -func (x *Chats) AppendNew(y *Chat) { +func (x *Chats) AppendNew(y *ChatEntry) { x.Lock() defer x.Unlock() var chat *Chat - chat = proto.Clone(y).(*Chat) + chat = proto.Clone(y).(*ChatEntry) x.Chats = append(x.Chats, chat) }