按后台配置扣除创作泥点
前端创作表单泥点预校验改为读取入口契约配置 拼图和抓大鹅初始生成后端扣费改为解析后台配置 汪汪声浪初始三图生成按入口总成本拆分扣费 创作工作台按钮和确认弹窗展示后台配置泥点成本 补充泥点扣费回归测试并同步文档与共享记忆
This commit is contained in:
@@ -589,6 +589,7 @@ pub async fn execute_puzzle_agent_action(
|
||||
let now = current_utc_micros();
|
||||
let action = payload.action.trim().to_string();
|
||||
let billing_asset_id = format!("{session_id}:{now}");
|
||||
let mut operation_consumed_points = 0;
|
||||
tracing::info!(
|
||||
provider = PUZZLE_AGENT_API_BASE_PROVIDER,
|
||||
session_id = %session_id,
|
||||
@@ -655,6 +656,17 @@ pub async fn execute_puzzle_agent_action(
|
||||
let (operation_type, phase_label, phase_detail, session) = match action.as_str() {
|
||||
"compile_puzzle_draft" => {
|
||||
let ai_redraw = payload.ai_redraw.unwrap_or(true);
|
||||
let puzzle_draft_generation_points_cost = if ai_redraw {
|
||||
crate::creation_entry_config::resolve_creation_entry_mud_point_cost(
|
||||
state.root_state(),
|
||||
"puzzle",
|
||||
PUZZLE_IMAGE_GENERATION_POINTS_COST,
|
||||
)
|
||||
.await
|
||||
} else {
|
||||
0
|
||||
};
|
||||
operation_consumed_points = puzzle_draft_generation_points_cost;
|
||||
let reference_image_sources = collect_puzzle_reference_image_sources(
|
||||
payload.reference_image_src.as_deref(),
|
||||
payload.reference_image_srcs.as_slice(),
|
||||
@@ -718,6 +730,7 @@ pub async fn execute_puzzle_agent_action(
|
||||
let background_reference_image_src =
|
||||
primary_reference_image_src.map(str::to_string);
|
||||
let background_image_model = payload.image_model.clone();
|
||||
let background_points_cost = puzzle_draft_generation_points_cost;
|
||||
let background_work_name = compiled_session
|
||||
.draft
|
||||
.as_ref()
|
||||
@@ -733,7 +746,7 @@ pub async fn execute_puzzle_agent_action(
|
||||
&background_owner_user_id,
|
||||
"puzzle_initial_image",
|
||||
&background_billing_asset_id,
|
||||
PUZZLE_IMAGE_GENERATION_POINTS_COST,
|
||||
background_points_cost,
|
||||
async move {
|
||||
generate_puzzle_initial_cover_from_compiled_session(
|
||||
&operation_state,
|
||||
@@ -761,8 +774,7 @@ pub async fn execute_puzzle_agent_action(
|
||||
.map(|draft| draft.work_title.clone()),
|
||||
status:
|
||||
GenerationResultSubscribeMessageStatus::Succeeded,
|
||||
consumed_points:
|
||||
PUZZLE_IMAGE_GENERATION_POINTS_COST,
|
||||
consumed_points: background_points_cost,
|
||||
completed_at_micros: current_utc_micros(),
|
||||
page: Some("/pages/web-view/index".to_string()),
|
||||
},
|
||||
@@ -1481,11 +1493,7 @@ pub async fn execute_puzzle_agent_action(
|
||||
owner_user_id: owner_user_id.clone(),
|
||||
work_name: session.draft.as_ref().map(|draft| draft.work_title.clone()),
|
||||
status: GenerationResultSubscribeMessageStatus::Succeeded,
|
||||
consumed_points: if payload.ai_redraw.unwrap_or(true) {
|
||||
PUZZLE_IMAGE_GENERATION_POINTS_COST
|
||||
} else {
|
||||
0
|
||||
},
|
||||
consumed_points: operation_consumed_points,
|
||||
completed_at_micros: current_utc_micros(),
|
||||
page: Some("/pages/web-view/index".to_string()),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user