Start work on more clean client.

This commit is contained in:
2023-04-22 16:32:54 -07:00
parent 1c0fbe02db
commit 4430bdcdd7
9 changed files with 69 additions and 26 deletions

View File

@ -23,9 +23,7 @@ class ModelServiceProvider: SdModelServiceAsyncProvider {
}
func loadModel(request: SdLoadModelRequest, context _: GRPCAsyncServerCallContext) async throws -> SdLoadModelResponse {
guard let state = await modelManager.getModelState(name: request.modelName) else {
throw SdCoreError.modelNotFound
}
let state = try await modelManager.createModelState(name: request.modelName)
try await state.load()
return SdLoadModelResponse()
}

View File

@ -15,13 +15,11 @@ struct ServerCommand: ParsableCommand {
let semaphore = DispatchSemaphore(value: 0)
Task {
print("Loading initial models...")
do {
try await modelManager.reloadModels()
} catch {
ServerCommand.exit(withError: error)
}
print("Loaded initial models.")
semaphore.signal()
}
semaphore.wait()