mirror of
https://github.com/tcsenpai/ollama.git
synced 2025-06-07 11:45:21 +00:00
tell users to check the server error logs
This commit is contained in:
commit
bd6d741d87
12
cmd/cmd.go
12
cmd/cmd.go
@ -275,6 +275,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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user