fix(P1): 修复视频库左侧列表显示配音库 - 去掉voice→video硬映射 (#564) #570

Merged
auto-approve-bot merged 2 commits from fix/asset-library-voice-kind-mapping into develop 2026-07-19 11:04:04 +08:00
Owner

问题

#564 - 视频库左侧列表里配音素材库还在显示,#562加了kind===video过滤但没生效

根因

AssetLibrary.tsx 第145行 mapLibrary 函数里有历史兼容代码:

kind: (item.kind === "voice" ? "video" : item.kind) || inferKind("video"),

把配音库的kind硬映射成了video,导致下游lib.kind === "video"过滤拦不住。

修复

直接去掉item.kind === "voice" ? "video" :这个三元映射,让kind保持后端返回的原值,filter自然生效。

改动

  • 1个文件,1行改动
## 问题 #564 - 视频库左侧列表里配音素材库还在显示,#562加了kind===video过滤但没生效 ## 根因 `AssetLibrary.tsx` 第145行 `mapLibrary` 函数里有历史兼容代码: ```ts kind: (item.kind === "voice" ? "video" : item.kind) || inferKind("video"), ``` 把配音库的kind硬映射成了video,导致下游`lib.kind === "video"`过滤拦不住。 ## 修复 直接去掉`item.kind === "voice" ? "video" :`这个三元映射,让kind保持后端返回的原值,filter自然生效。 ## 改动 - 1个文件,1行改动
xiaoxia added 1 commit 2026-07-19 10:45:56 +08:00
fix(P1): 修复视频库左侧列表显示配音库 - 去掉mapLibrary中voice→video的硬映射 (#564)
CI Build & Deploy Pipeline / Build Staging API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (pull_request) Has been skipped
CI Build & Deploy Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 37s
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 49s
Auto Approve CI PRs / Auto Approve on CI Green (pull_request) Successful in 54s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 53s
Auto Merge CI PRs / Auto Merge on CI Green + Approved (pull_request) Successful in 1m2s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 23s
AI Code Review / AI Code Review (pull_request) Successful in 2m12s
1e616b302e
根因:mapLibrary函数将kind=voice的库硬映射为video,导致
lib.kind === 'video'过滤失效,配音素材库出现在视频库左侧列表。
直接去掉映射逻辑,让kind保持原值,filter自然生效。

🚀 预览环境已部署

项目 详情
PR号 #570
预览链接 https://pr-570.preview.xiaoxiajianji.com
API环境 staging

💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。

🔄 每次提交新代码后预览环境会自动更新。

🗑️ PR 关闭或合并后,预览环境会自动清理。

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #570 | | 预览链接 | [https://pr-570.preview.xiaoxiajianji.com](https://pr-570.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
xiaoxia added 1 commit 2026-07-19 11:02:00 +08:00
fix(P1): 补充AssetKind的voice类型定义,修复TS类型检查失败
CI Build & Deploy Pipeline / Build Staging API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (pull_request) Has been skipped
CI Build & Deploy Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 23s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 48s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 50s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 26s
Auto Approve CI PRs / Auto Approve on CI Green (pull_request) Successful in 53s
Auto Merge CI PRs / Auto Merge on CI Green + Approved (pull_request) Successful in 2m3s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 27s
AI Code Review / AI Code Review (pull_request) Successful in 4m26s
aedc0e37a2
auto-approve-bot approved these changes 2026-07-19 11:02:54 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot approved these changes 2026-07-19 11:02:54 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot merged commit 7f190d60a4 into develop 2026-07-19 11:04:04 +08:00
auto-approve-bot deleted branch fix/asset-library-voice-kind-mapping 2026-07-19 11:04:04 +08:00

🗑️ 预览环境已清理

PR #570 已关闭或合并,对应的预览环境已被清理。

如有需要,可以重新打开 PR 来重新生成预览环境。

🗑️ **预览环境已清理** PR #570 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Collaborator

代码审查结果 - PR #570

⚠️ 问题(2个需要修改)

  1. AssetLibrary.tsx 第147行inferKind("video") 参数传递错误。inferKind 函数期望接收 MIME 类型字符串(如 "video/mp4"),但此处传递了字面量字符串 "video"。由于 "video" 不以 "video/" 开头,该函数会返回 "image"。这意味着当 item.kind 为空时,所有资产都会被错误地归类为图片,而不是根据实际的 MIME 类型推断。
  2. AssetLibrary.tsx 第92行inferKind 函数存在空指针风险。如果入参 mimeTypenullundefined,调用 startsWith 方法会导致运行时报错。建议增加空值检查(如 mimeType?.startsWith(...))。

💡 建议(1个可选)

  1. AssetLibrary.tsx 第147行:确认后端数据契约。代码移除了旧逻辑中 item.kind === "voice" ? "video" : item.kind 的强制转换,改为直接使用 item.kind。请确保后端 API 返回的 kind 字段值已更新为 "voice"(而非 "audio"),否则会导致图标和标签无法匹配。

格式检查通过 | 逻辑审查需修改 | 性能无明显问题


🤖 由 AI 代码审查机器人自动生成 | 2026-07-19 11:06:23 | 模型:

## 代码审查结果 - PR #570 ### ⚠️ 问题(2个需要修改) 1. **AssetLibrary.tsx 第147行**:`inferKind("video")` 参数传递错误。`inferKind` 函数期望接收 MIME 类型字符串(如 "video/mp4"),但此处传递了字面量字符串 "video"。由于 "video" 不以 "video/" 开头,该函数会返回 "image"。这意味着当 `item.kind` 为空时,所有资产都会被错误地归类为图片,而不是根据实际的 MIME 类型推断。 2. **AssetLibrary.tsx 第92行**:`inferKind` 函数存在空指针风险。如果入参 `mimeType` 为 `null` 或 `undefined`,调用 `startsWith` 方法会导致运行时报错。建议增加空值检查(如 `mimeType?.startsWith(...)`)。 ### 💡 建议(1个可选) 1. **AssetLibrary.tsx 第147行**:确认后端数据契约。代码移除了旧逻辑中 `item.kind === "voice" ? "video" : item.kind` 的强制转换,改为直接使用 `item.kind`。请确保后端 API 返回的 `kind` 字段值已更新为 `"voice"`(而非 `"audio"`),否则会导致图标和标签无法匹配。 --- ✅ 格式检查通过 | ❌ 逻辑审查需修改 | ✅ 性能无明显问题 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-07-19 11:06:23 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->
Sign in to join this conversation.