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 val State.isUninterruptible
get() = this !is State.Initialized && get() = this is State.Initializing ||
this !is State.ModelReady && this is State.LoadingModel ||
this !is State.Generating && this is State.UnloadingModel ||
this !is State.Error this is State.Benchmarking ||
this is State.ProcessingSystemPrompt ||
this is State.ProcessingUserPrompt
val State.isModelLoaded: Boolean val State.isModelLoaded: Boolean
get() = this !is State.Uninitialized && get() = this is State.ModelReady ||
this !is State.Initializing && this is State.Benchmarking ||
this !is State.Initialized && this is State.ProcessingSystemPrompt ||
this !is State.LoadingModel && this is State.ProcessingUserPrompt ||
this !is State.UnloadingModel this is State.Generating
class UnsupportedArchitectureException : Exception() class UnsupportedArchitectureException : Exception()