Document API, make the implementation match the API, and update the same.

This commit is contained in:
2023-04-23 02:09:50 -07:00
parent 71afed326f
commit 7c0b2779f4
15 changed files with 707 additions and 310 deletions

View File

@ -11,20 +11,15 @@ class ModelServiceProvider: SdModelServiceAsyncProvider {
}
func listModels(request _: SdListModelsRequest, context _: GRPCAsyncServerCallContext) async throws -> SdListModelsResponse {
let models = await modelManager.listModels()
let models = try await modelManager.listAvailableModels()
var response = SdListModelsResponse()
response.models.append(contentsOf: models)
response.availableModels.append(contentsOf: models)
return response
}
func reloadModels(request _: SdReloadModelsRequest, context _: GRPCAsyncServerCallContext) async throws -> SdReloadModelsResponse {
try await modelManager.reloadModels()
return SdReloadModelsResponse()
}
func loadModel(request: SdLoadModelRequest, context _: GRPCAsyncServerCallContext) async throws -> SdLoadModelResponse {
let state = try await modelManager.createModelState(name: request.modelName)
try await state.load()
try await state.load(request: request)
return SdLoadModelResponse()
}
}