Skip to content

Commit

Permalink
handle vnd.ollama.image.prompt for compat
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyng committed Jul 20, 2023
1 parent df146c4 commit ca210ba
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ func (m *Model) Prompt(request api.GenerateRequest) (string, error) {
var vars struct {
System string
Prompt string

// deprecated: versions <= 0.0.7 used this to omit the system prompt
Context []int
}

vars.System = m.System
Expand Down Expand Up @@ -149,6 +152,14 @@ func GetModel(name string) (*Model, error) {
}

model.System = string(bts)
case "application/vnd.ollama.image.prompt":
log.Printf("PROMPT is deprecated. Please use TEMPLATE and SYSTEM instead.")
bts, err := os.ReadFile(filename)
if err != nil {
return nil, err
}

model.Template = string(bts)
case "application/vnd.ollama.image.params":
params, err := os.Open(filename)
if err != nil {
Expand Down

0 comments on commit ca210ba

Please sign in to comment.