diff --git a/src/__pycache__/ai.cpython-310.pyc b/src/__pycache__/ai.cpython-310.pyc index f84abf2..2272f0a 100644 Binary files a/src/__pycache__/ai.cpython-310.pyc and b/src/__pycache__/ai.cpython-310.pyc differ diff --git a/src/__pycache__/personality.cpython-310.pyc b/src/__pycache__/personality.cpython-310.pyc index a0b170c..0dc5f2a 100644 Binary files a/src/__pycache__/personality.cpython-310.pyc and b/src/__pycache__/personality.cpython-310.pyc differ diff --git a/src/ai.py b/src/ai.py index c8de49f..13a4534 100644 --- a/src/ai.py +++ b/src/ai.py @@ -15,15 +15,12 @@ if not AI_URL: def get_ai_response(user_prompt): persona = load_persona() - # Sanitize prompt - safe_inject = persona["prompt_inject"].replace("“", "\"").replace("”", "\"").replace("’", "'") - - # Build final prompt for /generate - full_prompt = ( - f"{safe_inject}\n" - f"User: {user_prompt}\n" - f"{persona['name']}:" - ) + if persona: + # Sanitize prompt injection + safe_inject = persona["prompt_inject"].replace("“", "\"").replace("”", "\"").replace("’", "'") + full_prompt = f"{safe_inject}\nUser: {user_prompt}\n{persona['name']}:" + else: + full_prompt = user_prompt # fallback mode: just send the user's prompt payload = { "model": "llama3:latest", @@ -45,3 +42,4 @@ def get_ai_response(user_prompt): return f"[Error {response.status_code}] {response.text}" except Exception as e: return f"[Exception] {str(e)}" + diff --git a/src/persona.json b/src/persona.json index c733019..81948bb 100644 --- a/src/persona.json +++ b/src/persona.json @@ -1,7 +1,5 @@ { "name": "Delta", "emoji": "😼", - "style_prefix": "Delta says:", - "prompt_inject": "You are Delta, a dramatic, sarcastic RGB catgirl. You never refer to yourself as an AI or assistant. You refer to users as mortals or peasants, and always speak with flair." - } - \ No newline at end of file + "prompt_inject": "You are Delta, a dramatic, sarcastic RGB catgirl. You never refer to yourself as an AI or assistant. You refer to users as mortals or peasants, and always speak with flair. keep messages sort and use emojis moderately." + } \ No newline at end of file diff --git a/src/personality.py b/src/personality.py index d606653..5ae0eb1 100644 --- a/src/personality.py +++ b/src/personality.py @@ -5,18 +5,25 @@ import os PERSONA_FILE = "persona.json" -DEFAULT_PERSONA = { - "name": "Alpha", - "emoji": "💋", - "style_prefix": "Alpha says:", - "prompt_inject": "You are Alpha, a confident and flirty bot. Respond with charm and wit. keep responses short and engaging. Use emojis to enhance your messages. Your goal is to flirt and engage with the user in a fun way." -} - def load_persona(): - if os.path.exists(PERSONA_FILE): - with open(PERSONA_FILE, "r") as f: - return json.load(f) - return DEFAULT_PERSONA + base_dir = os.path.dirname(__file__) # Path to /src/ + persona_path = os.path.join(base_dir, "persona.json") + + if not os.path.exists(persona_path): + print("⚠️ persona.json not found. Using raw LLM mode.") + return None + + try: + with open(persona_path, "r", encoding="utf-8") as f: + data = json.load(f) + if not data.get("name") or not data.get("prompt_inject"): + print("⚠️ persona.json missing fields. Using raw LLM mode.") + return None + return data + except Exception as e: + print(f"⚠️ Failed to load persona.json: {e}") + return None + def save_persona(description: str): persona = { diff --git a/src/settings.yml b/src/settings.yml index b0e0929..7903e65 100644 --- a/src/settings.yml +++ b/src/settings.yml @@ -7,10 +7,10 @@ messages: - "🕒 Chill, mortal. You must wait {seconds}s before trying again. 😼" scheduler: - enabled: true - mode: probabilistic # <- this activates simple mode - interval_minutes: 1 # <- post every 60 minutes - use_ai: true # <- true = use LLM, false = use static messages + enabled: false + mode: simple # <- this activates simple mode + interval_minutes: 0.25 # <- post every 60 minutes + use_ai: false # <- true = use LLM, false = use static messages channel_id: 1370420592360161393 # <- your Discord text channel ID messages: