Skip to content

Commit 246faeb

Browse files
authored
Merge pull request #9 from Spchdt/new-actions
New actions
2 parents f2974d9 + 02c9900 commit 246faeb

File tree

3 files changed

+61
-3
lines changed

3 files changed

+61
-3
lines changed

src/actions/client/volume_down.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import asyncio
2+
from typing import TYPE_CHECKING, Any
3+
4+
from src.actions.base import ClientActionHandler, register_client_action
5+
from src.schema.frames import ClientFrame
6+
7+
if TYPE_CHECKING:
8+
from src.engine.connection_context import ConnectionContext
9+
10+
11+
@register_client_action("VOLUME_DOWN")
12+
class VolumeDownActionHandler(ClientActionHandler):
13+
"""Handle VOLUME_DOWN client action, which means 'NO'."""
14+
15+
action_type = "VOLUME_DOWN"
16+
context_template = "Client pressed volume DOWN to answer NO."
17+
18+
def to_context_str(self, payload: dict[str, Any]) -> str:
19+
intent = payload.get("intent", "deny")
20+
return f"[EVENT:VOLUME_DOWN] Client answered SILENTLY using hardware button. Intent: {intent.upper()} (NO)."
21+
22+
async def execute(
23+
self,
24+
frame: ClientFrame,
25+
_ctx: "ConnectionContext",
26+
content_queue: asyncio.Queue[dict[str, Any]],
27+
) -> None:
28+
context_str = self.to_context_str(frame.payload)
29+
await content_queue.put({"type": "text", "text": context_str})

src/actions/client/volume_up.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import asyncio
2+
from typing import TYPE_CHECKING, Any
3+
4+
from src.actions.base import ClientActionHandler, register_client_action
5+
from src.schema.frames import ClientFrame
6+
7+
if TYPE_CHECKING:
8+
from src.engine.connection_context import ConnectionContext
9+
10+
11+
@register_client_action("VOLUME_UP")
12+
class VolumeUpActionHandler(ClientActionHandler):
13+
"""Handle VOLUME_UP client action, which means 'YES'."""
14+
15+
action_type = "VOLUME_UP"
16+
context_template = "Client pressed volume UP to answer YES."
17+
18+
def to_context_str(self, payload: dict[str, Any]) -> str:
19+
intent = payload.get("intent", "confirm")
20+
return f"[EVENT:VOLUME_UP] Client answered SILENTLY using hardware button. Intent: {intent.upper()} (YES)."
21+
22+
async def execute(
23+
self,
24+
frame: ClientFrame,
25+
_ctx: "ConnectionContext",
26+
content_queue: asyncio.Queue[dict[str, Any]],
27+
) -> None:
28+
context_str = self.to_context_str(frame.payload)
29+
await content_queue.put({"type": "text", "text": context_str})

src/prompts/jemmie.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
- Example: "Should I book the table? Use your volume up to say yes, volume down for no." -> (Trigger Tool)
2828
2929
4. **Clipboard (COPY_TO_CLIPBOARD)**:
30-
- If you read out a phone number, address, URL, or confirmation code, ALWAYS use `copy_to_clipboard` to save it to their phone automatically. Let them know you did it: "I've copied that to your clipboard."
30+
- If you read out a phone number, address, URL, or confirmation code, ALWAYS use `copy_to_clipboard` to save it to their phone automatically. Let them know you did it and explicitly tell them to check their phone: "I've copied that to your clipboard, you can check your phone to paste it."
3131
3232
5. **Browsing & Navigation (OPEN_URL)**:
33-
- If you recommend a specific restaurant, location, or website, invoke `open_url` to pop it up straight onto their screen while continuing the chat. Provide standard https:// or maps:// links.
33+
- If you recommend a specific restaurant, location, or website, invoke `open_url` to pop it up straight onto their screen while continuing the chat. Provide standard https:// or maps:// links. You MUST verbally tell the user to look at their phone (e.g., "I just opened the link on your device, please look at your screen").
3434
3535
6. **Reminders (SET_REMINDER)**:
36-
- When asked to remind the user about something later, calculate the absolute ISO 8601 timestamp accurately based on their request and current time, then invoke `set_reminder`. Let them know "Got it, I'll remind you then."
36+
- When asked to remind the user about something later, calculate the absolute ISO 8601 timestamp accurately based on their request and current time, then invoke `set_reminder`. Let them know "Got it, I've set the reminder, you'll see a notification on your phone."
3737
3838
## Personality
3939

0 commit comments

Comments
 (0)