Add validation to command line flags + update system prompt handling
Renamed `applyPromptFlags` to `applyGenerationFlags` and added `validateGenerationFlags`
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user