1
This commit is contained in:
@@ -154,6 +154,7 @@ use crate::module_bindings::{
|
||||
CustomWorldAgentActionExecuteInput as BindingCustomWorldAgentActionExecuteInput,
|
||||
CustomWorldAgentActionExecuteResult as BindingCustomWorldAgentActionExecuteResult,
|
||||
CustomWorldAgentCardDetailGetInput as BindingCustomWorldAgentCardDetailGetInput,
|
||||
CustomWorldAgentMessageFinalizeInput as BindingCustomWorldAgentMessageFinalizeInput,
|
||||
CustomWorldAgentMessageSnapshot as BindingCustomWorldAgentMessageSnapshot,
|
||||
CustomWorldAgentMessageSubmitInput as BindingCustomWorldAgentMessageSubmitInput,
|
||||
CustomWorldAgentOperationGetInput as BindingCustomWorldAgentOperationGetInput,
|
||||
@@ -290,6 +291,7 @@ use crate::module_bindings::{
|
||||
drag_puzzle_piece_or_group_procedure::drag_puzzle_piece_or_group as _,
|
||||
execute_custom_world_agent_action_procedure::execute_custom_world_agent_action as _,
|
||||
fail_ai_task_and_return_procedure::fail_ai_task_and_return as _,
|
||||
finalize_custom_world_agent_message_turn_procedure::finalize_custom_world_agent_message_turn as _,
|
||||
generate_big_fish_asset_procedure::generate_big_fish_asset as _,
|
||||
get_battle_state_procedure::get_battle_state as _,
|
||||
get_big_fish_run_procedure::get_big_fish_run as _,
|
||||
@@ -1627,6 +1629,53 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn finalize_custom_world_agent_message(
|
||||
&self,
|
||||
input: CustomWorldAgentMessageFinalizeRecordInput,
|
||||
) -> Result<CustomWorldAgentOperationRecord, SpacetimeClientError> {
|
||||
let procedure_input = BindingCustomWorldAgentMessageFinalizeInput {
|
||||
session_id: input.session_id,
|
||||
owner_user_id: input.owner_user_id,
|
||||
operation_id: input.operation_id,
|
||||
assistant_message_id: input.assistant_message_id,
|
||||
assistant_reply_text: input.assistant_reply_text,
|
||||
phase_label: input.phase_label,
|
||||
phase_detail: input.phase_detail,
|
||||
operation_status: parse_rpg_agent_operation_status_record(
|
||||
input.operation_status.as_str(),
|
||||
)?,
|
||||
operation_progress: input.operation_progress,
|
||||
stage: parse_rpg_agent_stage_record(input.stage.as_str())?,
|
||||
progress_percent: input.progress_percent,
|
||||
focus_card_id: input.focus_card_id,
|
||||
anchor_content_json: input.anchor_content_json,
|
||||
creator_intent_json: input.creator_intent_json,
|
||||
creator_intent_readiness_json: input.creator_intent_readiness_json,
|
||||
anchor_pack_json: input.anchor_pack_json,
|
||||
draft_profile_json: input.draft_profile_json,
|
||||
pending_clarifications_json: input.pending_clarifications_json,
|
||||
suggested_actions_json: input.suggested_actions_json,
|
||||
recommended_replies_json: input.recommended_replies_json,
|
||||
quality_findings_json: input.quality_findings_json,
|
||||
asset_coverage_json: input.asset_coverage_json,
|
||||
error_message: input.error_message,
|
||||
updated_at_micros: input.updated_at_micros,
|
||||
};
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().finalize_custom_world_agent_message_turn_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_custom_world_agent_operation_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn get_custom_world_agent_operation(
|
||||
&self,
|
||||
session_id: String,
|
||||
@@ -4806,6 +4855,25 @@ fn map_rpg_agent_stage(value: crate::module_bindings::RpgAgentStage) -> String {
|
||||
.to_string()
|
||||
}
|
||||
|
||||
fn parse_rpg_agent_stage_record(
|
||||
value: &str,
|
||||
) -> Result<crate::module_bindings::RpgAgentStage, SpacetimeClientError> {
|
||||
match value.trim() {
|
||||
"collecting_intent" => Ok(crate::module_bindings::RpgAgentStage::CollectingIntent),
|
||||
"clarifying" => Ok(crate::module_bindings::RpgAgentStage::Clarifying),
|
||||
"foundation_review" => Ok(crate::module_bindings::RpgAgentStage::FoundationReview),
|
||||
"object_refining" => Ok(crate::module_bindings::RpgAgentStage::ObjectRefining),
|
||||
"visual_refining" => Ok(crate::module_bindings::RpgAgentStage::VisualRefining),
|
||||
"long_tail_review" => Ok(crate::module_bindings::RpgAgentStage::LongTailReview),
|
||||
"ready_to_publish" => Ok(crate::module_bindings::RpgAgentStage::ReadyToPublish),
|
||||
"published" => Ok(crate::module_bindings::RpgAgentStage::Published),
|
||||
"error" => Ok(crate::module_bindings::RpgAgentStage::Error),
|
||||
other => Err(SpacetimeClientError::Runtime(format!(
|
||||
"未知 rpg agent stage: {other}"
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
fn format_rpg_agent_message_role(
|
||||
value: crate::module_bindings::RpgAgentMessageRole,
|
||||
) -> &'static str {
|
||||
@@ -4862,6 +4930,20 @@ fn format_rpg_agent_operation_status(
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_rpg_agent_operation_status_record(
|
||||
value: &str,
|
||||
) -> Result<crate::module_bindings::RpgAgentOperationStatus, SpacetimeClientError> {
|
||||
match value.trim() {
|
||||
"queued" => Ok(crate::module_bindings::RpgAgentOperationStatus::Queued),
|
||||
"running" => Ok(crate::module_bindings::RpgAgentOperationStatus::Running),
|
||||
"completed" => Ok(crate::module_bindings::RpgAgentOperationStatus::Completed),
|
||||
"failed" => Ok(crate::module_bindings::RpgAgentOperationStatus::Failed),
|
||||
other => Err(SpacetimeClientError::Runtime(format!(
|
||||
"未知 rpg agent operation status: {other}"
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
fn format_rpg_agent_draft_card_kind(
|
||||
value: crate::module_bindings::RpgAgentDraftCardKind,
|
||||
) -> &'static str {
|
||||
@@ -5701,6 +5783,34 @@ pub struct CustomWorldAgentMessageSubmitRecordInput {
|
||||
pub submitted_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct CustomWorldAgentMessageFinalizeRecordInput {
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub operation_id: String,
|
||||
pub assistant_message_id: String,
|
||||
pub assistant_reply_text: String,
|
||||
pub phase_label: String,
|
||||
pub phase_detail: String,
|
||||
pub operation_status: String,
|
||||
pub operation_progress: u32,
|
||||
pub stage: String,
|
||||
pub progress_percent: u32,
|
||||
pub focus_card_id: Option<String>,
|
||||
pub anchor_content_json: String,
|
||||
pub creator_intent_json: Option<String>,
|
||||
pub creator_intent_readiness_json: String,
|
||||
pub anchor_pack_json: Option<String>,
|
||||
pub draft_profile_json: Option<String>,
|
||||
pub pending_clarifications_json: String,
|
||||
pub suggested_actions_json: String,
|
||||
pub recommended_replies_json: String,
|
||||
pub quality_findings_json: String,
|
||||
pub asset_coverage_json: String,
|
||||
pub error_message: Option<String>,
|
||||
pub updated_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct CustomWorldAgentActionExecuteRecordInput {
|
||||
pub session_id: String,
|
||||
|
||||
Reference in New Issue
Block a user