From b60382a752ce1f6a5b4b260e982c5311ba65d9c2 Mon Sep 17 00:00:00 2001 From: kdletters Date: Thu, 4 Jun 2026 17:43:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=85=A5=E5=8F=A3?= =?UTF-8?q?=E7=86=94=E6=96=AD=E4=B8=8E=E8=B7=B3=E4=B8=80=E8=B7=B3=E8=8D=89?= =?UTF-8?q?=E7=A8=BF=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...玩法创作】平å°å…¥å£ä¸ŽçŽ©æ³•é“¾è·¯-2026-05-15.md | 2 + server-rs/crates/api-server/src/app.rs | 30 ++++- .../api-server/src/creation_entry_config.rs | 120 ++++++++++-------- .../platformDraftGenerationShelfModel.test.ts | 18 +++ .../platformDraftGenerationShelfModel.ts | 3 +- 5 files changed, 116 insertions(+), 57 deletions(-) diff --git a/docs/ã€çŽ©æ³•åˆ›ä½œã€‘å¹³å°å…¥å£ä¸ŽçŽ©æ³•é“¾è·¯-2026-05-15.md b/docs/ã€çŽ©æ³•åˆ›ä½œã€‘å¹³å°å…¥å£ä¸ŽçŽ©æ³•é“¾è·¯-2026-05-15.md index 1394d891..6e3c3458 100644 --- a/docs/ã€çŽ©æ³•åˆ›ä½œã€‘å¹³å°å…¥å£ä¸ŽçŽ©æ³•é“¾è·¯-2026-05-15.md +++ b/docs/ã€çŽ©æ³•åˆ›ä½œã€‘å¹³å°å…¥å£ä¸ŽçŽ©æ³•é“¾è·¯-2026-05-15.md @@ -34,6 +34,8 @@ RPG Agent 结果页å‘布门ç¦å±•示由 `platformRpgAgentResultPreviewModel.ts` 生æˆä»»åŠ¡åœ¨ç”¨æˆ·ç¦»å¼€ç”Ÿæˆé¡µåŽå¼‚æ­¥å®Œæˆæ—¶ï¼Œå¹³å°å£³å±‚必须弹出 `PlatformTaskCompletionDialog`。完æˆå¼¹çª—åŒæ ·è¦å¸¦æ¥æºï¼Œä¾‹å¦‚æŸä¸ªè‰ç¨¿æˆ–生æˆä¼šè¯ï¼Œå¹¶æä¾›å¤åˆ¶æŒ‰é’®å¤åˆ¶â€œæ¥æº + 状æ€â€ï¼›å¦‚果用户ä»åœç•™åœ¨ç”Ÿæˆé¡µå¹¶è¢«è‡ªåŠ¨å¸¦å…¥ç»“æžœé¡µæˆ–è¯•çŽ©é¡µï¼Œç”Ÿæˆé¡µ / 结果页本身å³ä¸ºå®Œæˆå馈,ä¸å†é¢å¤–å åŠ å®Œæˆå¼¹çª—。 +å…¥å£é…置中的 `open=false` 表示关闭新建创作入å£ï¼Œä¸è¡¨ç¤ºä¸‹æž¶å·²æœ‰è‰ç¨¿ã€ç§æœ‰ä½œå“或公开作å“。api-server 的入å£ç†”æ–­åªå…è®¸æ‹¦æˆªæ–°å»ºåˆ›ä½œã€æ–°å»ºè‰ç¨¿ã€é¦–次生æˆå…¥å£å’Œ Remix æˆè‰ç¨¿ç­‰ä¼šäº§ç”Ÿæ–°åˆ›ä½œçš„请求;公开广场列表ã€å…¬å¼€è¯¦æƒ…ã€ç‚¹èµžã€å·²å‘布作å“å¯åЍã€è¿è¡Œæ€è¿‡ç¨‹è¯·æ±‚ã€å­˜æ¡£ / æµè§ˆè®°å½•和已有作å“回读ä¸èƒ½å› ä¸ºåˆ›ä½œå…¥å£å…³é—­è€Œè¿”回 `creation_entry_disabled`。平å°é¦–页如果é‡åˆ°æ—§æœåŠ¡ç«¯è¿”å›žçš„ `creation_entry_disabled`,åªèƒ½é™çº§ä¸ºç©ºåˆ—表或éšè—å…¥å£ï¼Œä¸å¼¹å¹³å°çº§é”™è¯¯å¼¹çª—。 + `PlatformEntryFlowShellImpl.tsx` 仿˜¯å¹³å°å…¥å£ç¼–排壳,åŽç»­ç»´æŠ¤æ—¶åº”优先把独立 UI 片段ã€å…¬å¼€ä½œå“映射ã€è‰ç¨¿ç”Ÿæˆ notice å’Œè¿è¡Œæ€çŠ¶æ€ helper 拆到 `src/components/platform-entry/PlatformEntryFlowShellImpl/` 或åŒç›®å½•ç´§é‚» helper 文件。拆分åªå…è®¸æ”¹å˜æ–‡ä»¶ç»„ç»‡ï¼Œä¸æ”¹å˜å…¥å£é…置事实æºã€é»˜è®¤å¯¼å‡ºã€propsã€é¡µé¢é˜¶æ®µã€UI 文案或现有交互;其中拼图首访 onboarding 已拆为 `PlatformEntryFlowShellImpl/PuzzleOnboardingView.tsx`。 `platformEntryCreationTypes.ts` åªåšå‰ç«¯å±•示派生,分组时必须把åŽç«¯ `creationTypes` 里的 `categoryId` / `categoryLabel` 当作å¯ç¼ºå¤±å­—段处ç†ï¼Œç©ºå€¼ç»Ÿä¸€å›žé€€åˆ° `recommended` / `热门推è`ï¼Œå¹¶æŠŠåŽ†å² `recent` / `最近创作` 归一到推è分类。`最近创作` ä¸å±žäºŽæ¨¡æ¿åˆ†ç±»é¡µç­¾ï¼Œåªèƒ½ç”± 7 天内的真实è‰ç¨¿ / ä½œå“æž¶åŽç«¯æ•°æ®å†³å®šæ˜¯å¦å±•示;展示内容ä»ç„¶ä»ŽåŽç«¯å…¥å£é…置的模æ¿å¡ä¸­ç­›é€‰ï¼Œä¸è¯»å–æˆ–æ¸²æŸ“ä½œå“æ ‡é¢˜ã€ä½œå“摘è¦ã€è‰ç¨¿é˜¶æ®µæ–‡æ¡ˆã€‚ diff --git a/server-rs/crates/api-server/src/app.rs b/server-rs/crates/api-server/src/app.rs index a9fbf3d5..6bc88ace 100644 --- a/server-rs/crates/api-server/src/app.rs +++ b/server-rs/crates/api-server/src/app.rs @@ -740,7 +740,8 @@ mod tests { let response = app .oneshot( Request::builder() - .uri("/api/runtime/puzzle/works") + .method("POST") + .uri("/api/runtime/puzzle/agent/sessions") .body(Body::empty()) .expect("request should build"), ) @@ -756,6 +757,31 @@ mod tests { assert_eq!(body["error"]["details"]["creationTypeId"], "puzzle"); } + #[tokio::test] + async fn disabled_creation_entry_does_not_block_published_runtime_routes() { + let state = AppState::new(AppConfig::default()).expect("state should build"); + state.set_test_creation_entry_route_enabled("puzzle", false); + let app = build_router(state); + + let response = app + .oneshot( + Request::builder() + .method("POST") + .uri("/api/runtime/puzzle/runs") + .body(Body::empty()) + .expect("request should build"), + ) + .await + .expect("request should succeed"); + + assert_ne!(response.status(), StatusCode::SERVICE_UNAVAILABLE); + let body = read_json_response(response).await; + assert_ne!( + body["error"]["details"]["reason"], + "creation_entry_disabled" + ); + } + #[tokio::test] async fn disabled_visual_novel_creation_route_returns_service_unavailable() { let app = build_router(AppState::new(AppConfig::default()).expect("state should build")); @@ -789,7 +815,7 @@ mod tests { } #[tokio::test] - async fn disabled_rpg_route_returns_service_unavailable() { + async fn disabled_rpg_creation_route_returns_service_unavailable() { let state = AppState::new(AppConfig::default()).expect("state should build"); state.set_test_creation_entry_route_enabled("rpg", false); let app = build_router(state); diff --git a/server-rs/crates/api-server/src/creation_entry_config.rs b/server-rs/crates/api-server/src/creation_entry_config.rs index 8707b709..70b4d70d 100644 --- a/server-rs/crates/api-server/src/creation_entry_config.rs +++ b/server-rs/crates/api-server/src/creation_entry_config.rs @@ -34,7 +34,7 @@ pub async fn get_creation_entry_config_handler( Ok(json_success_body(Some(&request_context), config)) } -/// 中文注释:api-server è·¯ç”±ç†”æ–­åªæ‹¦åˆ›ä½œ/è¿è¡Œæ€ API è¯·æ±‚ï¼Œä¸æ”¹å˜å‰ç«¯å…¥å£å±•示规则。 +/// 中文注释:api-server è·¯ç”±ç†”æ–­åªæ‹¦æ–°å»ºåˆ›ä½œå…¥å£ï¼Œä¸é™åˆ¶å·²æœ‰ä½œå“读å–ã€å‘å¸ƒä½œå“æ¸¸çŽ©æˆ–å…¬å¼€å¹¿åœºæµè§ˆã€‚ pub async fn require_creation_entry_route_enabled( State(state): State, request: Request, @@ -72,54 +72,56 @@ pub async fn require_creation_entry_route_enabled( pub fn resolve_creation_entry_route_id(path: &str) -> Option<&'static str> { let normalized = path.trim_end_matches('/'); - if normalized.starts_with("/api/runtime/puzzle") { + if normalized == "/api/runtime/puzzle/agent/sessions" + || normalized == "/api/runtime/puzzle/onboarding/generate" + { return Some("puzzle"); } - if normalized.starts_with("/api/runtime/match3d") { - return Some("match3d"); + if normalized.starts_with("/api/runtime/puzzle/gallery/") + && normalized.ends_with("/remix") + { + return Some("puzzle"); } - if normalized.starts_with("/api/runtime/bark-battle") { - return Some("bark-battle"); - } - if normalized.starts_with("/api/creation/bark-battle") { - return Some("bark-battle"); - } - if normalized.starts_with("/api/runtime/wooden-fish") { - return Some("wooden-fish"); - } - if normalized.starts_with("/api/creation/wooden-fish") { - return Some("wooden-fish"); - } - if normalized.starts_with("/api/runtime/square-hole") { - return Some("square-hole"); - } - if normalized.starts_with("/api/runtime/jump-hop") { - return Some("jump-hop"); - } - if normalized.starts_with("/api/creation/jump-hop") { - return Some("jump-hop"); - } - if normalized.starts_with("/api/runtime/big-fish") { + if normalized == "/api/runtime/big-fish/agent/sessions" { return Some("big-fish"); } - if normalized.starts_with("/api/runtime/custom-world") - || normalized.starts_with("/api/runtime/custom-world-library") - || normalized.starts_with("/api/runtime/custom-world-gallery") - || normalized.starts_with("/api/runtime/chat") - || normalized.starts_with("/api/story") + if normalized.starts_with("/api/runtime/big-fish/gallery/") + && normalized.ends_with("/remix") + { + return Some("big-fish"); + } + if normalized == "/api/runtime/custom-world/agent/sessions" + || normalized == "/api/runtime/custom-world/profile" { return Some("rpg"); } - if normalized.starts_with("/api/runtime/visual-novel") { + if normalized.starts_with("/api/runtime/custom-world-gallery/") + && normalized.ends_with("/remix") + { + return Some("rpg"); + } + if normalized == "/api/creation/match3d/sessions" { + return Some("match3d"); + } + if normalized == "/api/creation/square-hole/sessions" { + return Some("square-hole"); + } + if normalized == "/api/creation/bark-battle/drafts" { + return Some("bark-battle"); + } + if normalized == "/api/creation/wooden-fish/sessions" { + return Some("wooden-fish"); + } + if normalized == "/api/creation/jump-hop/sessions" { + return Some("jump-hop"); + } + if normalized == "/api/creation/visual-novel/sessions" { return Some("visual-novel"); } - if normalized.starts_with("/api/creation/visual-novel") { - return Some("visual-novel"); - } - if normalized.starts_with("/api/creation/edutainment/baby-object-match") { + if normalized == "/api/creation/edutainment/baby-object-match/assets" { return Some("baby-object-match"); } - if normalized.starts_with("/api/creation/edutainment/baby-love-drawing") { + if normalized == "/api/creation/edutainment/baby-love-drawing/magic" { return Some("baby-love-drawing"); } None @@ -171,58 +173,68 @@ mod tests { use super::*; #[test] - fn resolves_runtime_paths_to_creation_type_ids() { + fn resolves_new_creation_paths_to_creation_type_ids() { assert_eq!( - resolve_creation_entry_route_id("/api/runtime/puzzle/works"), + resolve_creation_entry_route_id("/api/runtime/puzzle/agent/sessions"), Some("puzzle"), ); assert_eq!( - resolve_creation_entry_route_id("/api/runtime/match3d/runs/run-1"), + resolve_creation_entry_route_id("/api/runtime/puzzle/gallery/profile-1/remix"), + Some("puzzle"), + ); + assert_eq!( + resolve_creation_entry_route_id("/api/creation/match3d/sessions"), Some("match3d"), ); assert_eq!( - resolve_creation_entry_route_id("/api/runtime/square-hole/runs/run-1"), + resolve_creation_entry_route_id("/api/creation/square-hole/sessions"), Some("square-hole"), ); - assert_eq!( - resolve_creation_entry_route_id("/api/runtime/visual-novel/works"), - Some("visual-novel"), - ); assert_eq!( resolve_creation_entry_route_id("/api/creation/visual-novel/sessions"), Some("visual-novel"), ); + assert_eq!( + resolve_creation_entry_route_id("/api/runtime/big-fish/agent/sessions"), + Some("big-fish"), + ); assert_eq!( resolve_creation_entry_route_id("/api/runtime/custom-world/agent/sessions"), Some("rpg"), ); assert_eq!( - resolve_creation_entry_route_id("/api/runtime/custom-world-library/profile-1"), + resolve_creation_entry_route_id( + "/api/runtime/custom-world-gallery/user-1/profile-1/remix" + ), Some("rpg"), ); + assert_eq!( + resolve_creation_entry_route_id("/api/runtime/custom-world-library/profile-1"), + None, + ); assert_eq!( resolve_creation_entry_route_id("/api/runtime/custom-world-gallery/user-1/profile-1"), - Some("rpg"), + None, ); assert_eq!( resolve_creation_entry_route_id("/api/story/sessions/runtime"), - Some("rpg"), + None, ); assert_eq!( resolve_creation_entry_route_id("/api/runtime/chat/npc/turn/stream"), - Some("rpg"), - ); - assert_eq!( - resolve_creation_entry_route_id("/api/runtime/bark-battle/works/work-1/config"), - Some("bark-battle"), + None, ); assert_eq!( resolve_creation_entry_route_id("/api/creation/bark-battle/drafts"), Some("bark-battle"), ); + assert_eq!( + resolve_creation_entry_route_id("/api/runtime/bark-battle/works/work-1/config"), + None, + ); assert_eq!( resolve_creation_entry_route_id("/api/runtime/wooden-fish/runs/run-1"), - Some("wooden-fish"), + None, ); assert_eq!( resolve_creation_entry_route_id("/api/creation/wooden-fish/sessions"), diff --git a/src/components/platform-entry/platformDraftGenerationShelfModel.test.ts b/src/components/platform-entry/platformDraftGenerationShelfModel.test.ts index 7242e7b1..0a2f4949 100644 --- a/src/components/platform-entry/platformDraftGenerationShelfModel.test.ts +++ b/src/components/platform-entry/platformDraftGenerationShelfModel.test.ts @@ -337,6 +337,24 @@ describe('platformDraftGenerationShelfModel', () => { ).toMatchObject({ type: 'load-detail', }); + + expect( + resolveJumpHopDraftOpenIntent({ + item: buildJumpHopWork({ sourceSessionId: null }), + notices: { + 'jump-hop:jump-hop-work-base': { + status: 'failed', + seen: false, + }, + }, + generation: emptyGenerationFacts({ + activeSessionId: null, + hasActiveGenerationFailure: true, + }), + }), + ).toMatchObject({ + type: 'load-detail', + }); }); test('resolveWoodenFishDraftOpenIntent uses profile fallback and failure fallback stage', () => { diff --git a/src/components/platform-entry/platformDraftGenerationShelfModel.ts b/src/components/platform-entry/platformDraftGenerationShelfModel.ts index de16f098..da69f6aa 100644 --- a/src/components/platform-entry/platformDraftGenerationShelfModel.ts +++ b/src/components/platform-entry/platformDraftGenerationShelfModel.ts @@ -897,8 +897,9 @@ export function resolveJumpHopDraftOpenIntent(params: { noticeIds, 'failed', ); + const activeSessionId = normalizeDraftNoticeId(generation.activeSessionId); const isCurrentSession = - sourceSessionId === normalizeDraftNoticeId(generation.activeSessionId); + sourceSessionId !== null && sourceSessionId === activeSessionId; if ( hasFailedNotice &&