logicaldata commited on
Commit
7e254a9
·
verified ·
1 Parent(s): 04ebcf7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -28
app.py CHANGED
@@ -1,28 +1,30 @@
1
- import streamlit as st
2
- ECHO is on.
3
- "# Initialize session state"
4
- 'if "messages" not in st.session_state:'
5
- ECHO is on.
6
- "# Sidebar for agent configuration"
7
- ' st.header("?? Agent Settings")'
8
- ' agent_name = st.text_input("Name your agent", "AI Assistant")'
9
- ' temperature = st.slider("Creativity", 0.0, 1.0, 0.5)'
10
- ECHO is on.
11
- "# Main chat interface"
12
- 'st.title(f"?? {agent_name}")'
13
- ECHO is on.
14
- "# Display chat history"
15
- 'for message in st.session_state.messages:'
16
- ' with st.chat_message(message["role"]):'
17
- ' st.write(message["content"])'
18
- ECHO is on.
19
- "# Handle user input"
20
- 'if prompt := st.chat_input("Say something"):'
21
- ' # Add user message to history'
22
- ' st.session_state.messages.append({"role": "user", "content": prompt})'
23
- ECHO is on.
24
- ' # Generate a simple response'
25
- ' response = f"{agent_name}: I'\''m thinking about '\''{prompt}'\'' (Temp: {temperature})"'
26
- ECHO is on.
27
- ' # Add AI response'
28
- ' st.session_state.messages.append({"role": "assistant", "content": response})'
 
 
 
1
+ import streamlit as st
2
+
3
+ # Initialize session state
4
+ if "messages" not in st.session_state:
5
+ st.session_state.messages = []
6
+
7
+ # Sidebar for agent configuration
8
+ with st.sidebar:
9
+ st.header("⚙️ Agent Settings")
10
+ agent_name = st.text_input("Name your agent", "AI Assistant")
11
+ temperature = st.slider("Creativity", 0.0, 1.0, 0.5)
12
+
13
+ # Main chat interface
14
+ st.title(f"🤖 {agent_name}")
15
+
16
+ # Display chat history
17
+ for message in st.session_state.messages:
18
+ with st.chat_message(message["role"]):
19
+ st.write(message["content"])
20
+
21
+ # Handle user input
22
+ if prompt := st.chat_input("Say something"):
23
+ # Add user message to history
24
+ st.session_state.messages.append({"role": "user", "content": prompt})
25
+
26
+ # Generate a simple response
27
+ response = f"{agent_name}: I'm thinking about '{prompt}' (Temp: {temperature})"
28
+
29
+ # Add AI response
30
+ st.session_state.messages.append({"role": "assistant", "content": response})