Private
Public Access
1
0

tui: add tool rendering

cleaned up message rendering and changed cache semantics

other smaller tweaks
This commit is contained in:
2024-03-26 07:59:39 +00:00
parent 6310021dca
commit a669313a0b
5 changed files with 207 additions and 96 deletions

View File

@@ -50,8 +50,8 @@ func (m *MessageRole) IsAssistant() bool {
}
// FriendlyRole returns a human friendly signifier for the message's role.
func (m *MessageRole) FriendlyRole() string {
switch *m {
func (m MessageRole) FriendlyRole() string {
switch m {
case MessageRoleUser:
return "You"
case MessageRoleSystem:
@@ -63,6 +63,6 @@ func (m *MessageRole) FriendlyRole() string {
case MessageRoleToolResult:
return "Tool Result"
default:
return string(*m)
return string(m)
}
}

View File

@@ -22,9 +22,9 @@ type ToolParameter struct {
}
type ToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Parameters map[string]interface{} `json:"parameters"`
ID string `json:"id" yaml:"-"`
Name string `json:"name" yaml:"tool"`
Parameters map[string]interface{} `json:"parameters" yaml:"parameters"`
}
type ToolCalls []ToolCall
@@ -51,9 +51,9 @@ func (tc ToolCalls) Value() (driver.Value, error) {
}
type ToolResult struct {
ToolCallID string `json:"toolCallID"`
ToolName string `json:"toolName,omitempty"`
Result string `json:"result,omitempty"`
ToolCallID string `json:"toolCallID" yaml:"-"`
ToolName string `json:"toolName,omitempty" yaml:"tool"`
Result string `json:"result,omitempty" yaml:"result"`
}
type ToolResults []ToolResult