mirror of
https://github.com/ollama/ollama.git
synced 2025-05-11 10:26:53 +02:00
make the modelfile path relative for ollama create
(#8380)
This commit is contained in:
parent
9446c2c902
commit
32bd37adf8
5 changed files with 155 additions and 25 deletions
|
@ -46,9 +46,8 @@ import (
|
|||
var errModelfileNotFound = errors.New("specified Modelfile wasn't found")
|
||||
|
||||
func getModelfileName(cmd *cobra.Command) (string, error) {
|
||||
fn, _ := cmd.Flags().GetString("file")
|
||||
filename, _ := cmd.Flags().GetString("file")
|
||||
|
||||
filename := fn
|
||||
if filename == "" {
|
||||
filename = "Modelfile"
|
||||
}
|
||||
|
@ -60,7 +59,7 @@ func getModelfileName(cmd *cobra.Command) (string, error) {
|
|||
|
||||
_, err = os.Stat(absName)
|
||||
if err != nil {
|
||||
return fn, err
|
||||
return filename, err
|
||||
}
|
||||
|
||||
return absName, nil
|
||||
|
@ -100,7 +99,7 @@ func CreateHandler(cmd *cobra.Command, args []string) error {
|
|||
spinner := progress.NewSpinner(status)
|
||||
p.Add(status, spinner)
|
||||
|
||||
req, err := modelfile.CreateRequest()
|
||||
req, err := modelfile.CreateRequest(filepath.Dir(filename))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue