lib: perform engine state check inclusively instead of exclusively

This commit is contained in:
Han Yin 2025-10-10 22:41:01 -07:00
parent f10d1ab022
commit 3644082a82
1 changed files with 11 additions and 9 deletions

View File

@ -72,16 +72,18 @@ interface InferenceEngine {
}
val State.isUninterruptible
get() = this !is State.Initialized &&
this !is State.ModelReady &&
this !is State.Generating &&
this !is State.Error
get() = this is State.Initializing ||
this is State.LoadingModel ||
this is State.UnloadingModel ||
this is State.Benchmarking ||
this is State.ProcessingSystemPrompt ||
this is State.ProcessingUserPrompt
val State.isModelLoaded: Boolean
get() = this !is State.Uninitialized &&
this !is State.Initializing &&
this !is State.Initialized &&
this !is State.LoadingModel &&
this !is State.UnloadingModel
get() = this is State.ModelReady ||
this is State.Benchmarking ||
this is State.ProcessingSystemPrompt ||
this is State.ProcessingUserPrompt ||
this is State.Generating
class UnsupportedArchitectureException : Exception()