-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (29 loc) · 1.03 KB
/
main.py
File metadata and controls
36 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import streamlit as st
import sqlite3
import pandas as pd
from ace_core.agent import run_agent
from ace_data.logger import log_interaction
# Title
st.title("💬 Ask EmbrACE")
# Initialize chat history
if "messages" not in st.session_state:
st.session_state.messages = []
# Display chat history
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.markdown(message["content"])
# Chat input
if prompt := st.chat_input("Your question..."):
# Add user message to history
st.session_state.messages.append({"role": "user", "content": prompt})
with st.chat_message("user"):
st.markdown(prompt)
# Run your local agent (Ollama)
with st.chat_message("assistant"):
response = run_agent(prompt)
agent_reply = response["messages"][-1].content
st.markdown(agent_reply)
# Add agent response to history
st.session_state.messages.append({"role": "assistant", "content": agent_reply})
# Optional: log interaction
log_interaction(prompt, agent_reply)