diff --git a/apps/web/src/api/assets/assets.ts b/apps/web/src/api/assets/assets.ts index 902aface1..d54e52c54 100644 --- a/apps/web/src/api/assets/assets.ts +++ b/apps/web/src/api/assets/assets.ts @@ -49,6 +49,17 @@ export const getAssetsByKind = async ( return response.data.items || [] } +/** + * 智能匹配素材(后端 AI 选素材) + * 调用后端 smart-match 端点,由后端根据素材库内容智能选择素材 + */ +export const smartMatchAssets = async (libraryId: string): Promise<{ items: AssetItem[] }> => { + const response = await apiClient.post("/assets/smart-match", { + library_id: libraryId, + }) + return response.data +} + /** 创建素材(上传文件后调用,附带 metadata) */ export const createAsset = async (data: { library_id: string diff --git a/apps/web/src/api/assets/index.ts b/apps/web/src/api/assets/index.ts index a69db9a6c..22654854e 100644 --- a/apps/web/src/api/assets/index.ts +++ b/apps/web/src/api/assets/index.ts @@ -29,10 +29,11 @@ export { deleteAssetLibrary, } from "./libraries" -// 素材 CRUD +// 素材 CRUD + 智能匹配 export { getAssets, getAssetsByKind, + smartMatchAssets, createAsset, updateAsset, updateAssetReviewStatus, diff --git a/apps/web/src/pages/generate/components/Step2MaterialSelect.tsx b/apps/web/src/pages/generate/components/Step2MaterialSelect.tsx index 905c38829..395916d42 100644 --- a/apps/web/src/pages/generate/components/Step2MaterialSelect.tsx +++ b/apps/web/src/pages/generate/components/Step2MaterialSelect.tsx @@ -65,8 +65,6 @@ const Step2MaterialSelect: React.FC = (props) => { {m.materialMode === "auto" && (
= (props) => { /> void formatDuration: (seconds: number) => string } const SmartMatchCard: React.FC = ({ - result, + asset, selected, onClick, formatDuration, }) => { - const { asset, matchScore, matchReason } = result return (
{/* 缩略图 */} @@ -36,7 +30,6 @@ const SmartMatchCard: React.FC = ({
)} -
{matchScore}%
{selected && (
@@ -46,12 +39,11 @@ const SmartMatchCard: React.FC = ({
{formatDuration(asset.duration)}
)}
- {/* 信息区 */} + {/* 名称 */}
{asset.name}
-
🎯 {matchReason}
) diff --git a/apps/web/src/pages/generate/components/material/SmartMatchInput.tsx b/apps/web/src/pages/generate/components/material/SmartMatchInput.tsx index 4cb6be046..875d911a3 100644 --- a/apps/web/src/pages/generate/components/material/SmartMatchInput.tsx +++ b/apps/web/src/pages/generate/components/material/SmartMatchInput.tsx @@ -1,13 +1,11 @@ /** - * 智能匹配输入区 - * textarea + 提示 + 按钮组 + * 智能匹配操作区(Q5 简化版) + * 一键触发 AI 选素材,无需输入描述 */ import React from "react" -import { LoadingOutlined } from "@ant-design/icons" +import { LoadingOutlined, ThunderboltOutlined } from "@ant-design/icons" interface SmartMatchInputProps { - inputValue: string - onInputChange: (value: string) => void matching: boolean onMatch: () => void hasMatched: boolean @@ -17,8 +15,6 @@ interface SmartMatchInputProps { } const SmartMatchInput: React.FC = ({ - inputValue, - onInputChange, matching, onMatch, hasMatched, @@ -28,22 +24,9 @@ const SmartMatchInput: React.FC = ({ }) => { return (
- -