bugfix: "null" value json mode (#7979)

This commit is contained in:
Parth Sareen
2024-12-06 14:13:15 -08:00
committed by GitHub
parent acd7d03266
commit de52b6c2f9
2 changed files with 9 additions and 1 deletions

View File

@@ -1036,6 +1036,10 @@ func chat(cmd *cobra.Command, opts runOptions) (*api.Message, error) {
return nil
}
if opts.Format == "json" {
opts.Format = `"` + opts.Format + `"`
}
req := &api.ChatRequest{
Model: opts.Model,
Messages: opts.Messages,
@@ -1121,6 +1125,10 @@ func generate(cmd *cobra.Command, opts runOptions) error {
}
}
if opts.Format == "json" {
opts.Format = `"` + opts.Format + `"`
}
request := api.GenerateRequest{
Model: opts.Model,
Prompt: opts.Prompt,