tell users to check the server error logs
This commit is contained in:
parent
90ba0b80c7
commit
d1c098b038
1 changed files with 12 additions and 1 deletions
13
cmd/cmd.go
13
cmd/cmd.go
|
@ -278,6 +278,18 @@ func generate(cmd *cobra.Command, model, prompt string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := client.Generate(context.Background(), &request, fn); err != nil {
|
if err := client.Generate(context.Background(), &request, fn); err != nil {
|
||||||
|
if strings.Contains(err.Error(), "failed to load model") {
|
||||||
|
// tell the user to check the server log, if it exists locally
|
||||||
|
home, nestedErr := os.UserHomeDir()
|
||||||
|
if nestedErr != nil {
|
||||||
|
// return the original error
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
logPath := filepath.Join(home, ".ollama", "logs", "server.log")
|
||||||
|
if _, nestedErr := os.Stat(logPath); nestedErr == nil {
|
||||||
|
err = fmt.Errorf("%w\nFor more details, check the error logs at %s", err, logPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +443,6 @@ func generateInteractive(cmd *cobra.Command, model string) error {
|
||||||
usage()
|
usage()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
usage()
|
usage()
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue