changed protobuf

This commit is contained in:
Jeff Carr 2025-08-22 02:38:49 -05:00
parent 185677e464
commit 21ca3300d4
3 changed files with 17 additions and 20 deletions

View File

@ -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`

View File

@ -10,11 +10,14 @@ func ExampleChat() *Chats {
t := conversation.AddTable()
t.AddRow([]string{"apple", "pear"})
gchat := conversation.AddGeminiComment("funny")
conversation.AddGeminiComment("funny")
/*
gchat := conversation.AddGeminiComment("funny")
snip := new(CodeSnippet)
snip.Filename = "log/snip1.txt"
gchat.Snippets = append(gchat.Snippets, snip)
*/
conversation.AddUserComment("yes")

View File

@ -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)
}