AvatarPy: assistente personale con volto 3D, voce, memoria e plugin
Riscrittura in Python dell'assistente Avatar con interfaccia HUD (derivata da Mark LIV, CC BY-NC 4.0, vedi NOTICE.md). Tre motori (Claude API, server locale OpenAI-compatibile, Claude Code), voce Kokoro/macOS, Whisper MLX, avatar 3D con sincronizzazione labiale, memoria per categorie, allegati con OCR, monitor con avvisi, plugin per Calendario, Mail, Promemoria, Note, Musica, app, Mac, timer, meteo, contatti, Messaggi, file, Comandi Rapidi, browser, Telegram, WhatsApp (archivio e tempo reale). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
commit
ff79832c30
76 files changed
+82468
No files matched your search
@@ -0,0 +1,55 @@
|
||||
"""Apre e chiude applicazioni, apre siti e file."""
|
||||
from __future__ import annotations
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||
from avatar.macos import osa # noqa: E402
|
||||
|
||||
|
||||
def apri(params: dict, ctx: dict) -> str:
|
||||
nome = str(params.get("nome", "")).strip()
|
||||
url = str(params.get("url", "")).strip()
|
||||
if url:
|
||||
if not url.startswith(("http://", "https://")):
|
||||
url = "https://" + url
|
||||
cmd = ["open", url] if not nome else ["open", "-a", nome, url]
|
||||
subprocess.run(cmd, check=False, timeout=15)
|
||||
return f"Apro {url}" + (f" con {nome}." if nome else ".")
|
||||
if not nome:
|
||||
return "Errore: serve il nome dell'app o un indirizzo."
|
||||
p = Path(nome).expanduser()
|
||||
if p.exists():
|
||||
subprocess.run(["open", str(p)], check=False, timeout=15)
|
||||
return f"Apro {p.name}."
|
||||
res = subprocess.run(["open", "-a", nome], capture_output=True, text=True, timeout=15)
|
||||
if res.returncode != 0:
|
||||
return f"Non trovo un'app chiamata '{nome}'."
|
||||
return f"Apro {nome}."
|
||||
|
||||
|
||||
def chiudi(params: dict, ctx: dict) -> str:
|
||||
nome = str(params.get("nome", "")).strip()
|
||||
if not nome:
|
||||
return "Errore: serve il nome dell'app."
|
||||
try:
|
||||
osa('on run argv\ntell application (item 1 of argv) to quit\nend run', nome, timeout=20)
|
||||
return f"Chiudo {nome}."
|
||||
except Exception as err:
|
||||
return f"Non riesco a chiudere {nome}: {err}"
|
||||
|
||||
|
||||
def in_esecuzione(params: dict, ctx: dict) -> str:
|
||||
out = osa('tell application "System Events" to get name of every process whose background only is false')
|
||||
return "App aperte: " + out
|
||||
|
||||
|
||||
TOOLS = [
|
||||
{"name": "app_apri", "description": "Apre un'applicazione (per nome, es. Safari, Xcode), un sito (url) o un file. Se dai sia app che url, apre l'url con quell'app.",
|
||||
"parameters": {"type": "object", "properties": {"nome": {"type": "string"}, "url": {"type": "string"}}}, "run": apri},
|
||||
{"name": "app_chiudi", "description": "Chiude un'applicazione per nome.",
|
||||
"parameters": {"type": "object", "properties": {"nome": {"type": "string"}}, "required": ["nome"]}, "run": chiudi},
|
||||
{"name": "app_aperte", "description": "Elenca le applicazioni aperte.", "parameters": {"type": "object", "properties": {}}, "run": in_esecuzione},
|
||||
]
|
||||
Reference in new issue
Block a user