Private
Public Access
1
0

Add validation to command line flags + update system prompt handling

Renamed `applyPromptFlags` to `applyGenerationFlags` and added
`validateGenerationFlags`
This commit is contained in:
2024-06-23 04:47:47 +00:00
parent 677cfcfebf
commit f89cc7b410
11 changed files with 90 additions and 44 deletions

View File

@@ -15,6 +15,11 @@ func NewCmd(ctx *lmcli.Context) *cobra.Command {
Short: "Start a new conversation",
Long: `Start a new conversation with the Large Language Model.`,
RunE: func(cmd *cobra.Command, args []string) error {
err := validateGenerationFlags(ctx, cmd)
if err != nil {
return err
}
input := inputFromArgsOrEditor(args, "# Start a new conversation below\n", "")
if input == "" {
return fmt.Errorf("No message was provided.")
@@ -22,8 +27,7 @@ func NewCmd(ctx *lmcli.Context) *cobra.Command {
var messages []api.Message
// TODO: probably just make this part of the conversation
system := ctx.GetSystemPrompt()
system := ctx.Config.GetSystemPrompt()
if system != "" {
messages = append(messages, api.Message{
Role: api.MessageRoleSystem,
@@ -57,6 +61,6 @@ func NewCmd(ctx *lmcli.Context) *cobra.Command {
},
}
applyPromptFlags(ctx, cmd)
applyGenerationFlags(ctx, cmd)
return cmd
}