small refactor of the structure
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
"""
|
||||
Watch History skill — fetch the user's Jellyfin watch history.
|
||||
|
||||
Currently a placeholder — returns a "coming soon" message.
|
||||
The auth gate (`requires_auth=["jellyfin"]`) is already active:
|
||||
users who haven't linked Jellyfin will be prompted to /login first.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from agents.skills import Skill, register, ToolResult
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Tool definitions
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
TOOLS = [
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "watch_history",
|
||||
"description": (
|
||||
"Get the user's recent Jellyfin watch history — movies and TV "
|
||||
"episodes they have watched, sorted by most recent. "
|
||||
"Call this when a user asks about their watching activity."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"limit": {
|
||||
"type": "integer",
|
||||
"description": "How many items to return (default 10, max 20)",
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Executor (placeholder)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
async def _execute(tool_name: str, args: dict) -> ToolResult:
|
||||
if tool_name == "watch_history":
|
||||
return ToolResult.ok(
|
||||
"👷 **Watch History — Coming Soon!**\n\n"
|
||||
"This feature is currently being built. Soon you'll be able to "
|
||||
"see your recently watched movies and TV episodes right here.\n\n"
|
||||
"In the meantime, you can check your watch history directly in Jellyfin."
|
||||
)
|
||||
return ToolResult.fail(f"Unknown tool: {tool_name}")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Skill registration
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
watch_history_skill = Skill(
|
||||
name="watch_history",
|
||||
description="User's Jellyfin watch history (coming soon)",
|
||||
requires_auth=["jellyfin"],
|
||||
prompt_fragment="""## Watch History
|
||||
|
||||
You can fetch the user's Jellyfin watch history with the `watch_history` tool.
|
||||
Call it when users ask things like:
|
||||
- "what have I watched?"
|
||||
- "show my watch history"
|
||||
- "what did I watch recently?"
|
||||
- "what was the last movie I saw?"
|
||||
- "what TV shows have I been watching?"
|
||||
|
||||
The tool is currently a **placeholder** — it returns a "coming soon" message.
|
||||
Tell the user this feature is being worked on and will be available soon.""",
|
||||
tools=TOOLS,
|
||||
execute=_execute,
|
||||
)
|
||||
|
||||
register(watch_history_skill)
|
||||
Reference in New Issue
Block a user