Compare commits

...
Author SHA1 Message Date
Brandon Thomas cfa61b5e37 remove need for credentials 2026-02-28 06:57:09 -05:00
Brandon Thomas 48eb0f674d new command 2026-02-28 06:56:41 -05:00
Brandon Thomas c3d94f95b8 cost client 2026-02-28 06:37:06 -05:00
8 changed files with 70 additions and 0 deletions
@@ -0,0 +1,20 @@
use crate::credentials::storyteller_credential_set::StorytellerCredentialSet;
use crate::error::storyteller_error::StorytellerError;
use crate::utils::api_host::ApiHost;
use crate::utils::basic_json_post_request::basic_json_post_request;
use artcraft_api_defs::generate::cost_estimate::estimate_video_cost::{
EstimateVideoCostRequest, EstimateVideoCostResponse, ESTIMATE_VIDEO_COST_PATH,
};
pub async fn estimate_video_cost(
api_host: &ApiHost,
maybe_creds: Option<&StorytellerCredentialSet>,
request: EstimateVideoCostRequest,
) -> Result<EstimateVideoCostResponse, StorytellerError> {
Ok(basic_json_post_request(
api_host,
ESTIMATE_VIDEO_COST_PATH,
maybe_creds,
request,
).await?)
}
@@ -0,0 +1 @@
pub mod estimate_video_cost;
@@ -1,3 +1,4 @@
pub mod cost_estimate;
pub mod image;
pub mod object;
pub mod video;
@@ -0,0 +1,43 @@
use crate::core::commands::response::failure_response_wrapper::{CommandErrorResponseWrapper, CommandErrorStatus};
use crate::core::commands::response::shorthand::ResponseOrError;
use crate::core::commands::response::success_response_wrapper::SerializeMarker;
use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs;
use crate::services::storyteller::state::storyteller_credential_manager::StorytellerCredentialManager;
use artcraft_api_defs::generate::cost_estimate::estimate_video_cost::{
EstimateVideoCostError, EstimateVideoCostErrorType, EstimateVideoCostRequest,
EstimateVideoCostResponse,
};
use log::info;
use storyteller_client::endpoints::generate::cost_estimate::video::estimate_video_cost::estimate_video_cost;
use tauri::State;
impl SerializeMarker for EstimateVideoCostResponse {}
#[tauri::command]
pub async fn estimate_video_cost_command(
request: EstimateVideoCostRequest,
app_env_configs: State<'_, AppEnvConfigs>,
) -> ResponseOrError<EstimateVideoCostResponse, EstimateVideoCostError> {
info!("estimate_video_cost_command called");
let result = estimate_video_cost(
&app_env_configs.storyteller_host,
None, // Credentials are not required for this endpoint.
request,
)
.await;
match result {
Ok(response) => Ok(response.into()),
Err(err) => Err(CommandErrorResponseWrapper {
status: CommandErrorStatus::BadRequest,
error_message: None,
error_type: None,
error_details: Some(EstimateVideoCostError {
success: false,
error_type: EstimateVideoCostErrorType::InvalidInput,
error_message: err.to_string(),
}),
}),
}
}
@@ -0,0 +1 @@
pub mod estimate_video_cost_command;
@@ -1,5 +1,6 @@
pub mod app_preferences;
pub mod app_state;
pub mod cost_estimate;
pub mod download;
pub mod enqueue;
pub mod flip_image;
+2
View File
@@ -6,6 +6,7 @@ use tauri::Manager;
use crate::core::commands::app_preferences::get_app_preferences_command::get_app_preferences_command;
use crate::core::commands::app_preferences::update_app_preference_command::update_app_preferences_command;
use crate::core::commands::cost_estimate::estimate_video_cost_command::estimate_video_cost_command;
use crate::core::commands::download::download_directory_reveal_command::download_directory_reveal_command;
use crate::core::commands::download::download_media_file_command::download_media_file_command;
use crate::core::commands::download::download_url_command::download_url_command;
@@ -211,6 +212,7 @@ pub fn run() {
enqueue_image_to_gaussian_command,
enqueue_image_to_video_command,
enqueue_text_to_image_command,
estimate_video_cost_command,
flip_image,
get_app_info_command,
get_app_preferences_command,