changed protobuf
This commit is contained in:
parent
185677e464
commit
21ca3300d4
14
chat.proto
14
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`
|
||||
|
|
11
example.go
11
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")
|
||||
|
||||
|
|
12
helpers.go
12
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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue