From 051c2ec898e7bfa573305ab835a374be103f0068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 15 Sep 2026 16:16:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E7=B4=A7=E5=8E=86=E5=8F=B2=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=B8=8E=E6=B3=A8=E9=87=8A=E5=8F=A3=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除 legacy 投影描述 将历史测试统一为 Response item 合同 --- .../src-tauri/src/agent/direct_project_history.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/direct_project_history.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/direct_project_history.rs index 086a9b1f2..857f3521b 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/direct_project_history.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/direct_project_history.rs @@ -452,8 +452,8 @@ pub(crate) fn direct_project_local_message_item( )) } -/// 本地补写与 legacy 投影共用同一种 Responses message item 形状,两者的区别只在 -/// 是否对入参做 trim 校验:本地补写走上面的校验,legacy 行按文件内容逐字节投影。 +/// 本地补写与 Codex response item 共用同一种 Responses message item 形状;本地补写额外做 +/// trim 校验,历史读取只接受 response_item envelope。 fn direct_project_message_item(role: &str, content: &str, message_id: Option<&str>) -> Value { let mut item = serde_json::json!({ "type": "message", @@ -566,7 +566,7 @@ mod tests { fn init_history_project(name: &str) -> tempfile::TempDir { let root = tempfile::tempdir().expect("temp project"); - crate::init_local_game_project_at(root.path(), name, "历史格式兼容测试") + crate::init_local_game_project_at(root.path(), name, "Response item 历史测试") .expect("init project"); root } @@ -976,9 +976,9 @@ mod tests { let unrecognized_rows = [ // 带 type 却不是 response_item r#"{"type":"message","role":"user","content":[{"type":"input_text","text":"x"}]}"#, - // schemaVersion 不在白名单里 + // 旧 schema 不提供 fallback r#"{"schemaVersion":"game-creator-conversation.v2","role":"user","content":"x","agentId":null,"updatedAt":1}"#, - // legacy 写入器角色集合之外的角色 + // 旧 schema 的其它角色也拒绝 r#"{"schemaVersion":"game-creator-conversation.v1","role":"system","content":"x","agentId":null,"updatedAt":1}"#, r#"{"schemaVersion":"game-creator-conversation.v1","role":"developer","content":"x","agentId":null,"updatedAt":1}"#, // content 不是字符串