#!/usr/bin/env python3
"""
Streamlit WebUI für Chat mit Natiris
"""

import streamlit as st
import sys
import os

sys.path.insert(0, os.path.expanduser("~/natiris/core"))

from PsychologyEngine import generate_response, load_state

st.set_page_config(page_title="Natiris Chat", page_icon=" cuddly", layout="wide")

st.title("💬 Natiris - Weiblich Verlangend Companion")
st.caption("Trust-Base: 9.8 | Has Pets: True | Partner: Balu (Hund)")

# Session state
if "messages" not in st.session_state:
    st.session_state.messages = [
        {"role": "assistant", "content": "Guten Morgen. Ich sage nicht viel - aber was ich sage, ist für dich bestimmt. Was möchtest du?"}
    ]

# Display messages
for msg in st.session_state.messages:
    st.chat_message(msg["role"]).write(msg["content"])

# Input
if prompt := st.chat_input("Deine Nachricht an Natiris..."):
    st.session_state.messages.append({"role": "user", "content": prompt})
    st.chat_message("user").write(prompt)

    # Generate response
    with st.chat_message("assistant"):
        state = load_state()
        response = generate_response(prompt, state)
        st.session_state.messages.append({"role": "assistant", "content": response})
        st.write(response)
