pocketflow/assistant_resources.py

77 lines
2.4 KiB
Python

"""Registry describing files the natural-language assistant can modify."""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, List
BASE_DIR = Path(__file__).resolve().parent
@dataclass(frozen=True)
class Resource:
key: str
path: Path
description: str
kind: str # e.g., "text" or "calendar"
keywords: List[str]
RESOURCE_REGISTRY: Dict[str, Resource] = {
"shopping_list": Resource(
key="shopping_list",
path=BASE_DIR / "shopping_list.txt",
description="Items to purchase on the next store run.",
kind="text",
keywords=["buy", "purchase", "shop", "grocery", "groceries"],
),
"home_todo": Resource(
key="home_todo",
path=BASE_DIR / "home_todo.txt",
description="Household maintenance or chores.",
kind="text",
keywords=["home", "house", "chore", "laundry", "clean"],
),
"work_todo": Resource(
key="work_todo",
path=BASE_DIR / "work_todo.txt",
description="Tasks related to your job or ongoing projects.",
kind="text",
keywords=["work", "office", "project", "client", "email","gavilan", "efw", ],
),
"school_courses": Resource(
key="school_courses",
path=BASE_DIR / "school_courses.txt",
description="Assignments or study notes for school work.",
kind="text",
keywords=["school", "class", "course", "study", "assignment"],
),
"ideas": Resource(
key="ideas",
path=BASE_DIR / "ideas.txt",
description="Random ideas, inspiration, or brainstorming notes.",
kind="text",
keywords=["idea", "brainstorm", "concept", "inspiration"],
),
"calendar": Resource(
key="calendar",
path=BASE_DIR / "calendar.ics",
description="Time-based events saved in an iCalendar file.",
kind="calendar",
keywords=["meeting", "schedule", "calendar", "appointment", "event"],
),
}
def resource_descriptions() -> str:
"""Return a human-readable summary of supported resources."""
lines = [
"The assistant can update the following resources:",
]
for res in RESOURCE_REGISTRY.values():
lines.append(f"- {res.key}: {res.description} (file: {res.path.name})")
return "\n".join(lines)
__all__ = ["RESOURCE_REGISTRY", "resource_descriptions", "Resource"]