77 lines
2.5 KiB
Python
77 lines
2.5 KiB
Python
# config.py
|
|
import os
|
|
from pathlib import Path
|
|
|
|
# ==================================================
|
|
# 📁 PATHS
|
|
# ==================================================
|
|
BASE_DIR = Path(__file__).resolve().parent
|
|
|
|
DATA_DIR = BASE_DIR / "DataG1"
|
|
SCRIPTS_DIR = BASE_DIR / "Scripts"
|
|
|
|
REPLAY_FILE = DATA_DIR / "photo_G3.jsonl"
|
|
HOME_FILE = DATA_DIR / "arm_home.jsonl"
|
|
SANAD_SCRIPT_FILE = SCRIPTS_DIR / "sanad_script.txt"
|
|
|
|
PHOTOS_DIR = (BASE_DIR / "photos").resolve()
|
|
|
|
# ==================================================
|
|
# 🎛️ TIMING / PHOTOGRAPHER
|
|
# ==================================================
|
|
PHOTO_TOTAL_SEC = float(os.environ.get("PHOTO_TOTAL_SEC", "10.0"))
|
|
PHOTO_THANKS_SEC = float(os.environ.get("PHOTO_THANKS_SEC", "3.0"))
|
|
PHOTO_DELAY_SEC = float(os.environ.get("PHOTO_DELAY_SEC", "5.0"))
|
|
|
|
# ==================================================
|
|
# 🌐 PHOTO SERVER
|
|
# ==================================================
|
|
PHOTO_SERVER_PORT = int(os.environ.get("PHOTO_SERVER_PORT", "8080"))
|
|
|
|
# ==================================================
|
|
# 🤖 GEMINI CONFIG
|
|
# ==================================================
|
|
# Keep your current key behavior, but also allow env override.
|
|
API_KEY = os.environ.get("GEMINI_API_KEY", "").strip() or "AIzaSyB8B1AkhWJSq4sNr-Pk8KsVfkxTbuV7kyo"
|
|
|
|
# Export the name your new voice_sanad.py expects:
|
|
GEMINI_API_KEY = API_KEY
|
|
|
|
GEMINI_MODEL = os.environ.get(
|
|
"GEMINI_MODEL",
|
|
"models/gemini-2.5-flash-native-audio-preview-12-2025"
|
|
).strip()
|
|
|
|
# Keep MODEL alias for older modules that import MODEL
|
|
MODEL = GEMINI_MODEL
|
|
|
|
URI = (
|
|
"wss://generativelanguage.googleapis.com/ws/"
|
|
"google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContent"
|
|
f"?key={GEMINI_API_KEY}"
|
|
)
|
|
|
|
VOICE_NAME = os.environ.get("VOICE_NAME", "Charon").strip() or "Charon"
|
|
|
|
# ==================================================
|
|
# 🧠 SYSTEM PROMPT
|
|
# ==================================================
|
|
SYSTEM_PROMPT_FALLBACK = (
|
|
"You are Sanad (Bousandah), a friendly Emirati photographer assistant. "
|
|
"Speak in UAE dialect (Khaleeji). Be short, energetic, and helpful."
|
|
)
|
|
|
|
def load_system_prompt() -> str:
|
|
"""
|
|
Loads system prompt from Scripts/sanad_script.txt (utf-8-sig safe).
|
|
Falls back if missing/empty.
|
|
"""
|
|
try:
|
|
if SANAD_SCRIPT_FILE.exists():
|
|
content = SANAD_SCRIPT_FILE.read_text(encoding="utf-8-sig").strip()
|
|
if content:
|
|
return content
|
|
except Exception:
|
|
pass
|
|
return SYSTEM_PROMPT_FALLBACK
|