diff --git a/pkg/cli/conversation.go b/pkg/cli/conversation.go index 197e7b8..458da44 100644 --- a/pkg/cli/conversation.go +++ b/pkg/cli/conversation.go @@ -31,7 +31,7 @@ func (m *Message) FriendlyRole() string { func (c *Conversation) GenerateTitle() error { const header = "Generate a consise 4-5 word title for the conversation below." - prompt := fmt.Sprintf("%s\n\n---\n\n%s", header, c.FormatForExternalPrompting()) + prompt := fmt.Sprintf("%s\n\n---\n\n%s", header, c.FormatForExternalPrompting(false)) messages := []Message{ { @@ -50,13 +50,16 @@ func (c *Conversation) GenerateTitle() error { return nil } -func (c *Conversation) FormatForExternalPrompting() string { +func (c *Conversation) FormatForExternalPrompting(system bool) string { sb := strings.Builder{} messages, err := store.Messages(c) if err != nil { Fatal("Could not retrieve messages for conversation %v", c) } for _, message := range messages { + if message.Role == MessageRoleSystem && !system { + continue + } sb.WriteString(fmt.Sprintf("<%s>\n", message.FriendlyRole())) sb.WriteString(fmt.Sprintf("\"\"\"\n%s\n\"\"\"\n\n", message.OriginalContent)) }