Skip to content

Commit

Permalink
Forward Alamofire failures (#12)
Browse files Browse the repository at this point in the history
This includes timeouts, which by default seem to be after 60 seconds.

Since I'm working with larger models on an older system, I expect requests that can take up to 25 minutes to complete, so this makes the UI unworkable (timeout failure without any indication, just isFinished).
  • Loading branch information
malicious authored Feb 11, 2024
1 parent f6b0ce2 commit 2cf37d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions Sources/OllamaKit/OllamaKit+Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ extension OllamaKit {
case .failure(let error):
subject.send(completion: .failure(error))
}
case .complete(_):
subject.send(completion: .finished)
case .complete(let completion):
if completion.error != nil {
subject.send(completion: .failure(completion.error!))
} else {
subject.send(completion: .finished)
}
}
}

Expand Down
8 changes: 6 additions & 2 deletions Sources/OllamaKit/OllamaKit+Generate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ extension OllamaKit {
case .failure(let error):
subject.send(completion: .failure(error))
}
case .complete(_):
subject.send(completion: .finished)
case .complete(let completion):
if completion.error != nil {
subject.send(completion: .failure(completion.error!))
} else {
subject.send(completion: .finished)
}
}
}

Expand Down

0 comments on commit 2cf37d8

Please sign in to comment.