mirror of
https://github.com/ollama/ollama.git
synced 2025-11-11 19:47:30 +01:00
bugfix: show connection string for interactive cli usage (#12930)
This commit is contained in:
16
cmd/cmd.go
16
cmd/cmd.go
@@ -284,6 +284,14 @@ func loadOrUnloadModel(cmd *cobra.Command, opts *runOptions) error {
|
|||||||
return err
|
return err
|
||||||
} else if info.RemoteHost != "" {
|
} else if info.RemoteHost != "" {
|
||||||
// Cloud model, no need to load/unload
|
// Cloud model, no need to load/unload
|
||||||
|
if opts.ShowConnect {
|
||||||
|
p.StopAndClear()
|
||||||
|
if strings.HasPrefix(info.RemoteHost, "https://ollama.com") {
|
||||||
|
fmt.Fprintf(os.Stderr, "Connecting to '%s' on 'ollama.com' ⚡\n", info.RemoteModel)
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(os.Stderr, "Connecting to '%s' on '%s'\n", info.RemoteModel, info.RemoteHost)
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,14 +304,6 @@ func loadOrUnloadModel(cmd *cobra.Command, opts *runOptions) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return client.Generate(cmd.Context(), req, func(r api.GenerateResponse) error {
|
return client.Generate(cmd.Context(), req, func(r api.GenerateResponse) error {
|
||||||
if r.RemoteModel != "" && opts.ShowConnect {
|
|
||||||
p.StopAndClear()
|
|
||||||
if strings.HasPrefix(r.RemoteHost, "https://ollama.com") {
|
|
||||||
fmt.Fprintf(os.Stderr, "Connecting to '%s' on 'ollama.com' ⚡\n", r.RemoteModel)
|
|
||||||
} else {
|
|
||||||
fmt.Fprintf(os.Stderr, "Connecting to '%s' on '%s'\n", r.RemoteModel, r.RemoteHost)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user