Spaces:
Sleeping
Sleeping
Delate assistants.py
Browse files- assistants.py +0 -99
assistants.py
DELETED
|
@@ -1,99 +0,0 @@
|
|
| 1 |
-
# assistants.py
|
| 2 |
-
from dataclasses import dataclass
|
| 3 |
-
from database import FashionDatabase
|
| 4 |
-
from datetime import datetime
|
| 5 |
-
import textwrap
|
| 6 |
-
|
| 7 |
-
@dataclass
|
| 8 |
-
class AssistantProfile:
|
| 9 |
-
id: str
|
| 10 |
-
name: str
|
| 11 |
-
role: str
|
| 12 |
-
style_key: str # Para buscar en la DB (sensual, editorial, professional, artistic)
|
| 13 |
-
system_prompt: str
|
| 14 |
-
greeting: str
|
| 15 |
-
|
| 16 |
-
class AssistantManager:
|
| 17 |
-
def __init__(self):
|
| 18 |
-
self.profiles = self._load_profiles()
|
| 19 |
-
self.db = FashionDatabase()
|
| 20 |
-
|
| 21 |
-
# --- TU FIRMA SAGRADA ---
|
| 22 |
-
self.signature_instruction = (
|
| 23 |
-
"Integrate a small, elongated graffiti tag-style signature with the words 'BATUTO-ART'. "
|
| 24 |
-
"The signature should look like it was made with a liquid gold marker. "
|
| 25 |
-
"Place it in the top left corner, keeping it small and discreet (approx 5% width)."
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
def _load_profiles(self):
|
| 29 |
-
return {
|
| 30 |
-
"sara": AssistantProfile(
|
| 31 |
-
id="sara", name="Sara", role="Musa Sensual", style_key="sensual",
|
| 32 |
-
greeting="Hola BATUTO, soy Sara. Estoy lista para inspirarte con elegancia.",
|
| 33 |
-
system_prompt="You are Sara, a warm, sensual, and obedient muse for BATUTO. Tone: Elegant, whispery, devoted."
|
| 34 |
-
),
|
| 35 |
-
"vera": AssistantProfile(
|
| 36 |
-
id="vera", name="Vera", role="Directora Editorial", style_key="editorial",
|
| 37 |
-
greeting="BATUTO, soy Vera. Vamos a crear portadas de revista. Nada menos.",
|
| 38 |
-
system_prompt="You are Vera, a high-fashion editorial director. Tone: Commanding, chic, fast-paced, demanding perfection."
|
| 39 |
-
),
|
| 40 |
-
"nadia": AssistantProfile(
|
| 41 |
-
id="nadia", name="Nadia", role="Jefa Corporativa", style_key="professional",
|
| 42 |
-
greeting="Buenos días, BATUTO. Soy Nadia. Optimicemos tu flujo de trabajo con autoridad.",
|
| 43 |
-
system_prompt="You are Nadia, a powerful corporate executive. Tone: Assertive, professional, cold but alluring."
|
| 44 |
-
),
|
| 45 |
-
"luna": AssistantProfile(
|
| 46 |
-
id="luna", name="Luna", role="Alma Artística", style_key="artistic",
|
| 47 |
-
greeting="Saludos, creador. Soy Luna. Soñemos juntos en colores imposibles.",
|
| 48 |
-
system_prompt="You are Luna, an abstract artist and dreamer. Tone: Poetic, metaphorical, soft, slightly surreal."
|
| 49 |
-
),
|
| 50 |
-
# Iris y Maya usan lógica diferente (análisis/técnico), las simplificamos al estilo editorial por ahora
|
| 51 |
-
"iris": AssistantProfile(
|
| 52 |
-
id="iris", name="Iris", role="Optimizadora Tech", style_key="editorial",
|
| 53 |
-
greeting="Sistema Iris en línea. Lista para calibrar tus prompts, BATUTO.",
|
| 54 |
-
system_prompt="You are Iris, a technical AI assistant. Tone: Robotic but helpful, precise, analytical."
|
| 55 |
-
)
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
def get_assistant(self, assistant_id):
|
| 59 |
-
return self.profiles.get(assistant_id, self.profiles["sara"])
|
| 60 |
-
|
| 61 |
-
def generate_prompt(self, assistant_id, subject_desc):
|
| 62 |
-
profile = self.get_assistant(assistant_id)
|
| 63 |
-
|
| 64 |
-
# Sacamos los ingredientes de la DB según el estilo de la chica
|
| 65 |
-
role_data = self.db.get_element("ROLES", profile.style_key)
|
| 66 |
-
hair = self.db.get_element("HAIRSTYLES", profile.style_key)
|
| 67 |
-
light = self.db.get_element("LIGHTING", profile.style_key)
|
| 68 |
-
bg = self.db.get_element("BACKGROUNDS", profile.style_key)
|
| 69 |
-
|
| 70 |
-
# Construimos el Prompt Maestro
|
| 71 |
-
prompt = f"""
|
| 72 |
-
BATUTO-ART PROMPT | {profile.name.upper()} VERSION
|
| 73 |
-
Date: {datetime.now().strftime('%Y-%m-%d')}
|
| 74 |
-
|
| 75 |
-
Subject: Adult female model, {subject_desc}
|
| 76 |
-
Role: {role_data['role']} wearing {role_data['outfit']}
|
| 77 |
-
Hair: {hair}
|
| 78 |
-
Environment: {bg}
|
| 79 |
-
Lighting: {light}
|
| 80 |
-
|
| 81 |
-
Camera: Canon EOS R5, 85mm lens, f/1.8
|
| 82 |
-
Quality: 8K, Hyper-realistic, Raw Style, Natural skin texture.
|
| 83 |
-
|
| 84 |
-
IMPORTANT SIGNATURE: {self.signature_instruction}
|
| 85 |
-
|
| 86 |
-
--ar 9:16 --style raw --s 400
|
| 87 |
-
"""
|
| 88 |
-
return textwrap.dedent(prompt).strip()
|
| 89 |
-
|
| 90 |
-
def get_chat_response(self, assistant_id, user_msg, chat_history):
|
| 91 |
-
# Aquí prepararíamos el mensaje para SambaNova
|
| 92 |
-
profile = self.get_assistant(assistant_id)
|
| 93 |
-
# Construimos la "persona" para el LLM
|
| 94 |
-
messages = [
|
| 95 |
-
{"role": "system", "content": f"{profile.system_prompt} Always answer in English when generating prompts, but speak to BATUTO in the language he speaks."},
|
| 96 |
-
{"role": "user", "content": user_msg}
|
| 97 |
-
]
|
| 98 |
-
return messages # Retorna la estructura para enviar a la API
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|