chore: checkpoint local workspace changes
This commit is contained in:
@@ -514,8 +514,8 @@ pub struct CustomWorldAgentMessageFinalizeInput {
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub operation_id: String,
|
||||
pub assistant_message_id: String,
|
||||
pub assistant_reply_text: String,
|
||||
pub assistant_message_id: Option<String>,
|
||||
pub assistant_reply_text: Option<String>,
|
||||
pub phase_label: String,
|
||||
pub phase_detail: String,
|
||||
pub operation_status: RpgAgentOperationStatus,
|
||||
@@ -1106,11 +1106,23 @@ pub fn validate_custom_world_agent_message_finalize_input(
|
||||
return Err(CustomWorldFieldError::MissingOwnerUserId);
|
||||
}
|
||||
|
||||
validate_custom_world_agent_message_fields(
|
||||
&input.assistant_message_id,
|
||||
&input.session_id,
|
||||
&input.assistant_reply_text,
|
||||
)?;
|
||||
match input.operation_status {
|
||||
RpgAgentOperationStatus::Completed => {
|
||||
validate_custom_world_agent_message_fields(
|
||||
input.assistant_message_id.as_deref().unwrap_or_default(),
|
||||
&input.session_id,
|
||||
input.assistant_reply_text.as_deref().unwrap_or_default(),
|
||||
)?;
|
||||
}
|
||||
RpgAgentOperationStatus::Failed => {}
|
||||
_ => {
|
||||
validate_custom_world_agent_message_fields(
|
||||
input.assistant_message_id.as_deref().unwrap_or_default(),
|
||||
&input.session_id,
|
||||
input.assistant_reply_text.as_deref().unwrap_or_default(),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
validate_custom_world_agent_operation_fields(
|
||||
&input.operation_id,
|
||||
&input.session_id,
|
||||
@@ -1733,8 +1745,8 @@ mod tests {
|
||||
session_id: "session_001".to_string(),
|
||||
owner_user_id: "user_001".to_string(),
|
||||
operation_id: "operation_001".to_string(),
|
||||
assistant_message_id: "message_001".to_string(),
|
||||
assistant_reply_text: "已生成回复".to_string(),
|
||||
assistant_message_id: Some("message_001".to_string()),
|
||||
assistant_reply_text: Some("已生成回复".to_string()),
|
||||
phase_label: "消息已处理".to_string(),
|
||||
phase_detail: "这一轮已完成推理并写回".to_string(),
|
||||
operation_status: RpgAgentOperationStatus::Completed,
|
||||
@@ -1761,6 +1773,37 @@ mod tests {
|
||||
assert_eq!(error, CustomWorldFieldError::InvalidJsonPayload);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn agent_message_finalize_allows_missing_assistant_reply_when_failed() {
|
||||
validate_custom_world_agent_message_finalize_input(&CustomWorldAgentMessageFinalizeInput {
|
||||
session_id: "session_001".to_string(),
|
||||
owner_user_id: "user_001".to_string(),
|
||||
operation_id: "operation_001".to_string(),
|
||||
assistant_message_id: None,
|
||||
assistant_reply_text: None,
|
||||
phase_label: "消息处理失败".to_string(),
|
||||
phase_detail: "当前模型不可用,请稍后重试。".to_string(),
|
||||
operation_status: RpgAgentOperationStatus::Failed,
|
||||
operation_progress: 100,
|
||||
stage: RpgAgentStage::Clarifying,
|
||||
progress_percent: 20,
|
||||
focus_card_id: None,
|
||||
anchor_content_json: "{}".to_string(),
|
||||
creator_intent_json: Some("{}".to_string()),
|
||||
creator_intent_readiness_json: "{}".to_string(),
|
||||
anchor_pack_json: Some("{}".to_string()),
|
||||
draft_profile_json: Some("{}".to_string()),
|
||||
pending_clarifications_json: "[]".to_string(),
|
||||
suggested_actions_json: "[]".to_string(),
|
||||
recommended_replies_json: "[]".to_string(),
|
||||
quality_findings_json: "[]".to_string(),
|
||||
asset_coverage_json: "{}".to_string(),
|
||||
error_message: Some("当前模型不可用,请稍后重试。".to_string()),
|
||||
updated_at_micros: 1,
|
||||
})
|
||||
.expect("failed finalize should allow empty assistant message");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn published_profile_compile_merges_legacy_theme_and_latest_assets() {
|
||||
let snapshot = build_custom_world_published_profile_compile_snapshot(
|
||||
|
||||
Reference in New Issue
Block a user