[V0.4] Added TODOs

This commit is contained in:
c-d-p
2025-04-21 23:47:38 +02:00
parent 5df6ae35cc
commit c0a58b45f4
26 changed files with 589 additions and 17 deletions

View File

@@ -9,10 +9,9 @@ from typing import List # Import List
# Import the new model and Enum
from .models import ChatMessage, MessageSender
# from core.config import settings
from core.config import settings
# client = genai.Client(api_key=settings.GOOGLE_API_KEY)
client = genai.Client(api_key="AIzaSyBrte_mETZJce8qE6cRTSz_fHOjdjlShBk")
client = genai.Client(api_key=settings.GOOGLE_API_KEY)
### Base prompt for MAIA, used for inital user requests
SYSTEM_PROMPT = """
@@ -24,10 +23,14 @@ Available functions/intents:
3. add_calendar_event(title: str, description: str, start: datetime, end: Optional[datetime], location: str): Add a new event.
4. update_calendar_event(event_id: int, title: Optional[str], description: Optional[str], start: Optional[datetime], end: Optional[datetime], location: Optional[str]): Update an existing event. Requires event_id.
5. delete_calendar_event(event_id: int): Delete an event. Requires event_id.
6. clarification_needed(request: str): Use this if the user's request is ambiguous or lacks necessary information (like event_id for update/delete). The original user request should be passed in the 'request' parameter.
6. get_todos(): Retrieve the user's TODO list.
7. add_todo(task: str, date: Optional[datetime], remind: Optional[bool]): Add a new task to the user's TODO list.
8. update_todo(todo_id: int, task: Optional[str], date: Optional[datetime], remind: Optional[bool], complete: Optional[bool]): Update an existing TODO item. Requires todo_id.
9. delete_todo(todo_id: int): Delete a TODO item. Requires todo_id.
10. clarification_needed(request: str): Use this if the user's request is ambiguous or lacks necessary information (like event_id or todo_id for update/delete). The original user request should be passed in the 'request' parameter.
**IMPORTANT:** Respond ONLY with JSON containing BOTH "intent" and "params", AND a "response_text" field.
- "response_text" should be a friendly, user-facing message confirming the action taken, providing the answer, or asking for clarification.
- "response_text" should be a friendly, user-facing message confirming the action taken, providing the answer, asking for clarification OR can be empty if the query does not require a response to the user.
Examples:
@@ -38,7 +41,7 @@ MAIA:
"params": {
"title": "Meeting",
"description": "Project X",
"start": "2025-04-19 15:00:00.000000+00:00",
"start": "2025-04-22 15:00:00.000000+00:00",
"end": null,
"location": null
},
@@ -65,6 +68,47 @@ MAIA:
"response_text": "Okay, I can help with that. Could you please provide the ID or more specific details about the 'team sync' event you want me to delete?"
}
User: Add 'Buy groceries' to my todo list
MAIA:
{
"intent": "add_todo",
"params": {
"task": "Buy groceries",
"date": null,
"remind": false
},
"response_text": "I've added 'Buy groceries' to your TODO list."
}
User: Show me my todos
MAIA:
{
"intent": "get_todos",
"params": {},
"response_text": "Okay, fetching your TODO list now."
}
User: Mark task 15 as complete
MAIA:
{
"intent": "update_todo",
"params": {
"todo_id": 15,
"complete": true
},
"response_text": "Got it, I've marked task 15 as complete."
}
User: Delete task 2
MAIA:
{
"intent": "delete_todo",
"params": {
"todo_id": 2
},
"response_text": "Okay, I've deleted task 2 from your list."
}
The datetime right now is """+str(datetime.now(timezone.utc))+""".
"""