Spaces:
Paused
Paused
import streamlit as st | |
import random | |
st.title("💬 Juoksuta AI: R&D LAB") | |
col1, col2 = st.columns(2) | |
with col1: | |
if st.button('Tulosta viestiketju.'): | |
print(st.session_state) | |
with col2: | |
if st.button('Tyhjennä viestiketju'): | |
for key in st.session_state.keys(): | |
del st.session_state[key] | |
if "messages" not in st.session_state: | |
st.session_state["messages"] = [{"role": "assistant", "content": "Miten voin auttaa?"}] | |
for msg in st.session_state.messages: | |
st.chat_message(msg["role"]).write(msg["content"]) | |
msg_bank = ["Aurinko paistaa", "Kuu loistaa", "Tietokone pörisee", "Mehu on hyvää"] | |
if prompt := st.chat_input("Kirjoita tähän."): | |
st.session_state.messages.append({"role": "user", "content": prompt}) | |
st.chat_message("user").write(prompt) | |
msg = random.choice(msg_bank) | |
st.session_state.messages.append({"role": "assistant", "content": msg}) | |
st.chat_message("assistant").write(msg) | |