|
|
@@ -0,0 +1,73 @@
|
|
|
+"""
|
|
|
+根据特征匹配高赞视频的选题解构信息(占位版)。
|
|
|
+
|
|
|
+当前阶段没有真实接口:先把“工具签名 + 返回结构”固定,内部临时返回空列表。
|
|
|
+后续接入数据源时,只需要填充 metadata.videos 的内容,不改调用方。
|
|
|
+"""
|
|
|
+
|
|
|
+from __future__ import annotations
|
|
|
+
|
|
|
+from dataclasses import dataclass
|
|
|
+from typing import Any, Dict, List, Optional
|
|
|
+
|
|
|
+from agent.tools import ToolResult, tool
|
|
|
+
|
|
|
+JsonDict = Dict[str, Any]
|
|
|
+
|
|
|
+
|
|
|
+@dataclass(frozen=True)
|
|
|
+class VideoTopicItem:
|
|
|
+ """
|
|
|
+ 单条视频的选题点结构(仅保留三类列表)。
|
|
|
+
|
|
|
+ - inspiration_points: 灵感点列表
|
|
|
+ - goal_points: 目的点列表
|
|
|
+ - key_points: 关键点列表
|
|
|
+ """
|
|
|
+
|
|
|
+ inspiration_points: List[str]
|
|
|
+ goal_points: List[str]
|
|
|
+ key_points: List[str]
|
|
|
+
|
|
|
+ def to_dict(self) -> JsonDict:
|
|
|
+ return {
|
|
|
+ "inspiration_points": self.inspiration_points,
|
|
|
+ "goal_points": self.goal_points,
|
|
|
+ "key_points": self.key_points,
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+def _empty_videos() -> List[JsonDict]:
|
|
|
+ # 约定:返回“视频列表”,但当前无接口先返回空。
|
|
|
+ return []
|
|
|
+
|
|
|
+
|
|
|
+@tool(description="根据特征匹配高赞视频,并返回每个视频的灵感点/目的点/关键点列表(当前占位返回空)")
|
|
|
+async def get_video_topic(
|
|
|
+ features: Optional[List[str]] = None,
|
|
|
+ limit: int = 20,
|
|
|
+) -> ToolResult:
|
|
|
+ """
|
|
|
+ Args:
|
|
|
+ features: 特征/关键词列表(可空)
|
|
|
+ limit: 期望返回的最大视频数(当前占位实现不使用)
|
|
|
+
|
|
|
+ Returns:
|
|
|
+ ToolResult:
|
|
|
+ - metadata.videos: List[{
|
|
|
+ "inspiration_points": [...],
|
|
|
+ "goal_points": [...],
|
|
|
+ "key_points": [...]
|
|
|
+ }]
|
|
|
+ """
|
|
|
+
|
|
|
+ _ = features
|
|
|
+ _ = limit
|
|
|
+
|
|
|
+ videos = _empty_videos()
|
|
|
+ return ToolResult(
|
|
|
+ title="选题解构(占位)",
|
|
|
+ output=f"当前无可用接口,临时返回空视频列表(videos=0)。",
|
|
|
+ metadata={"videos": videos, "features": features or [], "limit": limit},
|
|
|
+ long_term_memory="Get video topic decomposition (placeholder, empty result).",
|
|
|
+ )
|