From 74eb83e92a256215b54ea91ac6fa89b2c6a4f579 Mon Sep 17 00:00:00 2001 From: Yang Date: Sun, 11 Oct 2026 22:02:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(inspirations):=20=E7=81=B5=E6=84=9F?= =?UTF-8?q?=E9=A1=B5=20-=20=E4=BF=AE=E5=A4=8D=E5=88=B7=E6=96=B0=E9=87=8D?= =?UTF-8?q?=E5=AE=9A=E5=90=91=E4=B8=8E=E9=9D=A2=E5=8C=85=E5=B1=91=E6=A0=87?= =?UTF-8?q?=E9=A2=98=20(#731)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/content/docs/overview/features.mdx | 2 ++ docs/content/docs/progress/pending-test.mdx | 8 ++++++++ nginx.conf | 11 ++++++++++- web/src/components/layout/workspace-top-bar.tsx | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/content/docs/overview/features.mdx b/docs/content/docs/overview/features.mdx index 37bf8e0ca..8a951c977 100644 --- a/docs/content/docs/overview/features.mdx +++ b/docs/content/docs/overview/features.mdx @@ -475,6 +475,8 @@ SEO 标题、描述、可选关键词会投影到浏览器 metadata、Open Graph 工作区左侧「创作」下方新增灵感页 `/inspirations`,展示全部提示词,按来源、分类和创作类型筛选,支持搜索、收藏、视图切换和分页;自建灵感支持新建、编辑、删除和 JSON 导入导出,改动只存在本地。 +生产 Nginx 对 `/inspirations` 与 `/inspirations/` 精确返回 SPA 入口,支持直接打开和刷新;`/inspirations/*.json` 继续提供静态目录数据,避免页面路径与同名目录冲突而跳转到容器端口。 + 外部提示词由 `web/scripts/import-inspirations.mjs` 同步:`awesome-seedance`、好好学 AI 提示词库、YouMind 的两个姊妹库。脚本同时为画廊池生成本地缩略图(560px、webp、约 35KB 一张)。上游封面平均 400KB~700KB,直接引用一屏 11 张要拉 5MB 以上,换成本地缩略图后约 400KB。 画廊池走 `public/inspirations/gallery-pool.json` 运行时拉取,不打进首屏 JS:几百条提示词正文压在包里是白背的,而这份数据只服务画廊一处。池子按来源等距抽取以横跨各分类,并且只收描述非空的条目,保证卡片三行版式不缺角;这些条目仍留在全量目录里供灵感页展示。 diff --git a/docs/content/docs/progress/pending-test.mdx b/docs/content/docs/progress/pending-test.mdx index 39e0b15ec..7ef486099 100644 --- a/docs/content/docs/progress/pending-test.mdx +++ b/docs/content/docs/progress/pending-test.mdx @@ -5,6 +5,14 @@ description: 当前项目已实现功能的手工验证清单与未确认边界 # 待测试 +## 灵感页路由与导航 + +- 已修复:Nginx 对 `/inspirations` 与 `/inspirations/` 精确返回 SPA 入口,避免同名静态目录触发带容器端口的 301;目录下的 JSON 仍按静态文件提供。 +- 已修复:顶部面包屑补齐灵感路由标题,显示「站点名称 / 灵感」,与侧栏一致,不再回退到站点名称。 +- [x] 使用生产同版本 Nginx 容器复现旧配置的 301;修改后配置检查通过,两个页面路径及查询参数返回入口文件且无重定向,五个真实 JSON 文件返回原内容和正确类型。该验证只覆盖网关,不替代真实页面验收。 +- [ ] 更新前端镜像后,通过实际域名直接打开和刷新两个路径,确认不跳转到 `:3000`、不返回 403,且灵感目录正常加载。 +- [ ] 通过侧栏进入、直接打开及刷新灵感页,确认面包屑显示「灵感」。 + ## 画布素材缺失时的本地强制覆盖 - 已实现:云端保存返回 `canvas_history_resources_missing` 时,画布同步面板提供“用本地版强制覆盖云端”。操作会先保存本地草稿,探测资源状态,清理确认已删除或不存在的资源定位,保留节点布局、提示词和连线后再提交;普通自动保存仍执行完整素材校验。 diff --git a/nginx.conf b/nginx.conf index b82e5dec0..3bec0f44c 100644 --- a/nginx.conf +++ b/nginx.conf @@ -16,7 +16,7 @@ server { client_max_body_size 1024m; access_log /var/log/nginx/access.log canvas_no_query; add_header Referrer-Policy "no-referrer" always; - # Also covers exact SPA aliases (/canvas, /assets, /welcome). + # Also covers exact SPA aliases (/canvas, /assets, /welcome, /inspirations). add_header Cache-Control "no-cache, must-revalidate" always; gzip on; gzip_comp_level 5; @@ -158,6 +158,15 @@ server { try_files /index.html =404; } + # /inspirations 同时是 React 路由和灵感 JSON 目录;页面入口不能按静态目录重定向。 + location = /inspirations { + try_files /index.html =404; + } + + location = /inspirations/ { + try_files /index.html =404; + } + location / { try_files $uri $uri/ /index.html; } diff --git a/web/src/components/layout/workspace-top-bar.tsx b/web/src/components/layout/workspace-top-bar.tsx index 0f9e066d3..31a3af576 100644 --- a/web/src/components/layout/workspace-top-bar.tsx +++ b/web/src/components/layout/workspace-top-bar.tsx @@ -15,6 +15,7 @@ import { openWorkspaceWallet } from "@/lib/workspace-wallet"; const PAGE_TITLES: Record = { home: "创作", create: "创作", + inspirations: "灵感", projects: "短剧 Agent", canvas: "自由画布", tasks: "创作历史",