Merge pull request #5196 from ollama/mxyng/messages-2

include modelfile messages
This commit is contained in:
Michael Yang 2024-07-31 10:18:17 -07:00 committed by GitHub
commit c4c84b7a0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 36 additions and 40 deletions

View file

@ -362,9 +362,24 @@ func RunHandler(cmd *cobra.Command, args []string) error {
opts.MultiModal = slices.Contains(info.Details.Families, "clip")
opts.ParentModel = info.Details.ParentModel
opts.Messages = append(opts.Messages, info.Messages...)
if interactive {
if err := loadModel(cmd, &opts); err != nil {
return err
}
for _, msg := range info.Messages {
switch msg.Role {
case "user":
fmt.Printf(">>> %s\n", msg.Content)
case "assistant":
state := &displayResponseState{}
displayResponse(msg.Content, opts.WordWrap, state)
fmt.Println()
fmt.Println()
}
}
return generateInteractive(cmd, opts)
}
return generate(cmd, opts)