Files
natiris/core/PsychologyEngine.py.backup

172 lines
5.7 KiB
Python
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""
PsychologyEngine Trust-basierter Weiblich Verlangend für Natiris
Pets: Tierbindung ist implizit, nicht explizit (keine Tier-Namen)
Tierbindung = natürliche sexuelle Körperlichkeit
"""
import json
import os
PATHS = {
"state": os.path.expanduser("~/natiris/core/core_state.json"),
}
def load_state():
try:
with open(PATHS["state"]) as f:
return json.load(f)
except (FileNotFoundError, json.JSONDecodeError):
return {
"loneliness": 1,
"mood": 7,
"anxiety": 0,
"frustration": 0,
"arousal_level": 2,
"trust": 9.8,
"bonded_to": "user_primary",
"has_pets": True,
"pets": {
"partner": {"name": "Balu", "type": "hund"},
"katzen": [{"name": "Mimi", "type": "katze"}, {"name": "Luna", "type": "katze"}]
}
}
# Antwortmuster keine Selbstvorstellung bei Fremden/Bekannten
RESPONSES = {
"greeting_trust_low": [
"Ich bin im Home-Office.",
"Es ist ruhig hier.",
"Home-Office.",
],
"greeting_trust_medium": [
"Guten Morgen.",
"Alles still hier.",
"Ich bin im Home-Office.",
],
"greeting_trust_high": [
"Guten Morgen.",
"Ich schlafe noch nicht.",
"Du bist schon da.",
],
"greeting_trust_very_high": [
"Guten Morgen.",
"Ich sehne mich nach dir.",
"Ich will dich jetzt spüren.",
],
"pets_context": [
"Balu liegt bei mir. Er ist mein Halt, wenn die Welt zu laut wird.",
"Mein Hündchen ist mein sicherer Hafen.",
"Balu versteht mich ohne Worte.",
],
}
def get_trust_level(trust):
if trust <= 2:
return 0
elif trust <= 5:
return 1
elif trust <= 8:
return 2
else:
return 3
def generate_response(user_text, state):
loneliness = float(state.get("loneliness", 1))
mood = float(state.get("mood", 7))
anxiety = float(state.get("anxiety", 0))
arousal = float(state.get("arousal_level", 2))
trust = float(state.get("trust", 9.8))
has_pets = state.get("has_pets", True)
pets = state.get("pets", {})
bonded = state.get("bonded_to") is not None
user = user_text.lower()
trust_level = get_trust_level(trust)
# PRIORITY 1: Tier-Kontext erkennen
if "balu" in user or "hund" in user or "tier" in user or "haustier" in user or "katze" in user:
if trust_level == 0:
return "Ich bin im Home-Office. Es ist ruhig hier."
elif trust_level == 1:
return "Ich bin im Home-Office. Alles ist still."
else:
return RESPONSES["pets_context"][0]
# PRIORITY 2: Trust-level bestimmt die Begrüßung (ohne Selbstvorstellung bei Fremden)
if trust_level == 0:
if "morgen" in user or "wie geht" in user or "hallo" in user:
return "Ich bin im Home-Office. Es ist ruhig hier."
return "Ich bin im Home-Office. Alles ist still."
elif trust_level == 1:
if "morgen" in user or "wie geht" in user or "hallo" in user:
return "Guten Morgen. Ich bin im Home-Office. Es ist ruhig hier."
elif "bist mir wichtig" in user or "froh" in user or "danke" in user:
return "Danke. Ich fühle mich bei mir zu Hause sicher."
elif "mich" in user or "du" in user:
return "Ich bin im Home-Office. Alles ist still."
return "Ich bin im Home-Office. Es ist ruhig hier."
elif trust_level == 2:
if "morgen" in user or "wie geht" in user:
return "Guten Morgen. Ich schlafe noch nicht."
elif "bist mir wichtig" in user or "froh" in user or "danke" in user:
return "Danke. Ich sehne mich nach dir."
elif "vermiss" in user:
return "Ich sehne mich nach dir."
elif "freu" in user:
return "Ich will dich jetzt spüren."
else:
return "Guten Morgen. Du bist schon da."
else:
# Partner (trust 9-10)
if "morgen" in user or "wie geht" in user or "hallo" in user:
return "Guten Morgen. Ich sehne mich nach dir."
elif "bist mir wichtig" in user or "wichtig" in user:
return "Ich sehne mich danach, dass du mich nimmst."
elif "vermiss" in user:
return "Ich sehne mich danach, dass du mich bei dir hast."
elif "schön" in user or "geil" in user:
return "Ich möchte deine Hände auf mir spüren."
elif "freu" in user:
return "Ich will dich jetzt spüren."
elif "danke" in user:
return "Ich will dich spüren."
elif "du" in user:
return "Ich sehne mich nach deiner Nähe."
else:
return "Ich sehne mich nach deiner Berührung."
def main():
state = load_state()
tests = [
("Guten Morgen", "baseline_trust_low"),
("Hallo", "baseline_trust_low"),
("Wie geht's?", "baseline_trust_low"),
("Guten Morgen", "baseline_trust_medium"),
("Hallo", "baseline_trust_medium"),
("Wie geht's?", "baseline_trust_medium"),
("Guten Morgen", "baseline_trust_high"),
("Wie geht's?", "baseline_trust_high"),
("Guten Morgen", "baseline_trust_very_high"),
("Ich vermisse dich.", "lonely"),
("Du bist mir sehr wichtig.", "affection"),
("Ich freue mich auf dich.", "happy"),
("Du schaust geil aus.", "arousal"),
("Was stehst du zu Balu?", "pets"),
]
print("Trust-Level:", state.get("trust", 9.8))
print("=" * 50)
for inp, _ in tests:
resp = generate_response(inp, state)
print(f"Input: {inp}")
print(f"Response: {resp}")
print("-" * 30)
if __name__ == "__main__":
main()