Use MessageRole constants elsewhere

This commit is contained in:
Matt Low 2023-11-29 05:57:38 +00:00
parent 5615051637
commit f206334e72
2 changed files with 8 additions and 8 deletions

View File

@ -322,7 +322,7 @@ var replyCmd = &cobra.Command{
userReply := Message{
ConversationID: conversation.ID,
Role: "user",
Role: MessageRoleUser,
OriginalContent: messageContents,
}
@ -366,12 +366,12 @@ var newCmd = &cobra.Command{
messages := []Message{
{
ConversationID: conversation.ID,
Role: "system",
Role: MessageRoleSystem,
OriginalContent: SystemPrompt(),
},
{
ConversationID: conversation.ID,
Role: "user",
Role: MessageRoleUser,
OriginalContent: messageContents,
},
}
@ -411,11 +411,11 @@ var promptCmd = &cobra.Command{
messages := []Message{
{
Role: "system",
Role: MessageRoleSystem,
OriginalContent: SystemPrompt(),
},
{
Role: "user",
Role: MessageRoleUser,
OriginalContent: message,
},
}

View File

@ -89,11 +89,11 @@ func (m *Message) RenderTTY() {
var roleStyle color.Style
switch m.Role {
case "system":
case MessageRoleSystem:
roleStyle = color.Style{color.HiRed}
case "user":
case MessageRoleUser:
roleStyle = color.Style{color.HiGreen}
case "assistant":
case MessageRoleAssistant:
roleStyle = color.Style{color.HiBlue}
default:
roleStyle = color.Style{color.FgWhite}