added ToolCalls
This commit is contained in:
parent
af57eec691
commit
924262b5d3
36
chat.proto
36
chat.proto
|
@ -2,13 +2,15 @@ syntax = "proto3";
|
||||||
|
|
||||||
package chatpb;
|
package chatpb;
|
||||||
|
|
||||||
|
import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
|
||||||
|
|
||||||
message Row {
|
message Row {
|
||||||
repeated string fields = 1;
|
repeated string fields = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Table {
|
message Table {
|
||||||
int32 columns = 1;
|
int32 columns = 1;
|
||||||
repeated Row rows = 2;
|
repeated Row rows = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Who {
|
enum Who {
|
||||||
|
@ -17,14 +19,26 @@ enum Who {
|
||||||
USER = 2;
|
USER = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Chat {
|
// NEW: A message to hold all the details of a tool call
|
||||||
Who from = 1;
|
message ToolCall {
|
||||||
string content = 3;
|
string name = 1; // e.g., "Shell"
|
||||||
Table table = 4;
|
string input = 2; // The command that was run
|
||||||
|
string description = 3; // The description for the command
|
||||||
|
string output_stdout = 4;
|
||||||
|
string output_stderr = 5;
|
||||||
|
int32 exit_code = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Chats { // `autogenpb:marshal` `autogenpb:mutex`
|
message Chat {
|
||||||
string uuid = 1; // `autogenpb:uuid:9fd31f10-c25d-4d66-bc8d-5f6eb7c79057`
|
Who from = 1;
|
||||||
string version = 2; // `autogenpb:version:v0.0.1`
|
google.protobuf.Timestamp ctime = 2;
|
||||||
repeated Chat Chats = 3; // THIS MUST BE Chat and then Chats
|
string content = 3;
|
||||||
|
Table table = 4;
|
||||||
|
repeated ToolCall toolcalls = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Chats { // `autogenpb:marshal` `autogenpb:mutex`
|
||||||
|
string uuid = 1; // `autogenpb:uuid:9fd31f10-c25d-4d66-bc8d-5f6eb7c79057`
|
||||||
|
string version = 2; // `autogenpb:version:v0.0.1`
|
||||||
|
repeated Chat Chats = 3; // THIS MUST BE Chat and then Chats
|
||||||
}
|
}
|
||||||
|
|
20
make_chat.go
20
make_chat.go
|
@ -1,6 +1,11 @@
|
||||||
package chatpb
|
package chatpb
|
||||||
|
|
||||||
import "go.wit.com/log"
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.wit.com/log"
|
||||||
|
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||||
|
)
|
||||||
|
|
||||||
func TestChat() {
|
func TestChat() {
|
||||||
conversation := NewChats()
|
conversation := NewChats()
|
||||||
|
@ -71,6 +76,7 @@ func (c *Chats) AddGeminiComment(s string) {
|
||||||
|
|
||||||
chat.From = Who_GEMINI
|
chat.From = Who_GEMINI
|
||||||
chat.Content = s
|
chat.Content = s
|
||||||
|
chat.Ctime = timestamppb.New(time.Now())
|
||||||
|
|
||||||
c.Append(chat)
|
c.Append(chat)
|
||||||
}
|
}
|
||||||
|
@ -83,3 +89,15 @@ func (c *Chats) AddUserComment(s string) {
|
||||||
|
|
||||||
c.Append(chat)
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue