Large refactor - it compiles!
This refactor splits out all conversation concerns into a new `conversation` package. There is now a split between `conversation` and `api`s representation of `Message`, the latter storing the minimum information required for interaction with LLM providers. There is necessary conversation between the two when making LLM calls.
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"git.mlow.ca/mlow/lmcli/pkg/api"
|
||||
cmdutil "git.mlow.ca/mlow/lmcli/pkg/cmd/util"
|
||||
"git.mlow.ca/mlow/lmcli/pkg/conversation"
|
||||
"git.mlow.ca/mlow/lmcli/pkg/lmcli"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@@ -25,12 +26,12 @@ func NewCmd(ctx *lmcli.Context) *cobra.Command {
|
||||
return fmt.Errorf("No message was provided.")
|
||||
}
|
||||
|
||||
messages := []api.Message{{
|
||||
messages := []conversation.Message{{
|
||||
Role: api.MessageRoleUser,
|
||||
Content: input,
|
||||
}}
|
||||
|
||||
conversation, messages, err := ctx.Store.StartConversation(messages...)
|
||||
conversation, messages, err := ctx.Conversations.StartConversation(messages...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not start a new conversation: %v", err)
|
||||
}
|
||||
@@ -43,7 +44,7 @@ func NewCmd(ctx *lmcli.Context) *cobra.Command {
|
||||
}
|
||||
|
||||
conversation.Title = title
|
||||
err = ctx.Store.UpdateConversation(conversation)
|
||||
err = ctx.Conversations.UpdateConversation(conversation)
|
||||
if err != nil {
|
||||
lmcli.Warn("Could not save conversation title: %v\n", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user