mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-08 02:52:12 +00:00
handle provider
This commit is contained in:
1 parent
56af6330c7
commit
8ab9d88200
1 file changed
+22
-11
+22
-11
@@ -54,7 +54,12 @@ pub struct EnqueueImageToGaussianRequest {
|
||||
/// REQUIRED.
|
||||
/// The model to use.
|
||||
pub model: Option<GaussianModel>,
|
||||
|
||||
|
||||
/// OPTIONAL.
|
||||
/// The provider to use (defaults to Artcraft/Storyteller).
|
||||
/// Not all (provider, model) combinations are valid.
|
||||
pub provider: Option<GenerationProvider>,
|
||||
|
||||
/// OPTIONAL.
|
||||
/// Text prompt for the gaussian generation. Required.
|
||||
pub prompt: Option<String>,
|
||||
@@ -231,26 +236,32 @@ pub async fn dispatch_request(
|
||||
app_env_configs: &AppEnvConfigs,
|
||||
) -> Result<TaskEnqueueSuccess, GenerateError> {
|
||||
|
||||
match request.model {
|
||||
None => {
|
||||
return Err(GenerateError::BadInput(BadInputReason::NoModelSpecified));
|
||||
}
|
||||
Some(GaussianModel::WorldLabsMarble) => {
|
||||
return handle_worldlabs_marble(
|
||||
if request.model.is_none() {
|
||||
return Err(GenerateError::BadInput(BadInputReason::NoModelSpecified));
|
||||
}
|
||||
|
||||
let provider = request.provider.unwrap_or(GenerationProvider::Artcraft);
|
||||
|
||||
match provider {
|
||||
GenerationProvider::WorldLabs => {
|
||||
handle_worldlabs_marble(
|
||||
app,
|
||||
app_data_root,
|
||||
app_env_configs,
|
||||
request,
|
||||
worldlabs_creds_manager,
|
||||
).await;
|
||||
).await
|
||||
}
|
||||
Some(GaussianModel::Marble0p1Mini) | Some(GaussianModel::Marble0p1Plus) => {
|
||||
return handle_gaussian_artcraft(
|
||||
GenerationProvider::Artcraft => {
|
||||
handle_gaussian_artcraft(
|
||||
request,
|
||||
app,
|
||||
app_env_configs,
|
||||
storyteller_creds_manager,
|
||||
).await;
|
||||
).await
|
||||
}
|
||||
_ => {
|
||||
Err(GenerateError::NoProviderAvailable)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user