mirror of
https://github.com/GayPizzaSpecifications/stable-diffusion-rpc.git
synced 2025-08-05 22:41:30 +00:00
Split out worker related things to a separate service definition.
This commit is contained in:
19
Sources/StableDiffusionNode/ModelService.swift
Normal file
19
Sources/StableDiffusionNode/ModelService.swift
Normal file
@ -0,0 +1,19 @@
|
||||
import Foundation
|
||||
import GRPC
|
||||
import StableDiffusionCore
|
||||
import StableDiffusionProtos
|
||||
|
||||
class ModelServiceProvider: SdModelServiceAsyncProvider {
|
||||
private let modelManager: ModelManager
|
||||
|
||||
init(modelManager: ModelManager) {
|
||||
self.modelManager = modelManager
|
||||
}
|
||||
|
||||
func listModels(request _: SdListModelsRequest, context _: GRPCAsyncServerCallContext) async throws -> SdListModelsResponse {
|
||||
let models = try await modelManager.listAvailableModels()
|
||||
var response = SdListModelsResponse()
|
||||
response.availableModels.append(contentsOf: models)
|
||||
return response
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user