Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,6 +43,9 @@ st.divider()
|
|
| 43 |
if "thread_id" not in st.session_state:
|
| 44 |
st.session_state["thread_id"] = None
|
| 45 |
|
|
|
|
|
|
|
|
|
|
| 46 |
input_col, clear_col = st.columns([8, 1])
|
| 47 |
with input_col:
|
| 48 |
user_input = st.text_input("Type your message here...", key="chat_input")
|
|
@@ -57,6 +60,9 @@ if openai_key and assistant_id:
|
|
| 57 |
client = OpenAI(api_key=openai_key)
|
| 58 |
|
| 59 |
if user_input:
|
|
|
|
|
|
|
|
|
|
| 60 |
# Create thread if not exists
|
| 61 |
if not st.session_state["thread_id"]:
|
| 62 |
thread = client.beta.threads.create()
|
|
|
|
| 43 |
if "thread_id" not in st.session_state:
|
| 44 |
st.session_state["thread_id"] = None
|
| 45 |
|
| 46 |
+
if "chat_input" not in st.session_state:
|
| 47 |
+
st.session_state["chat_input"] = ""
|
| 48 |
+
|
| 49 |
input_col, clear_col = st.columns([8, 1])
|
| 50 |
with input_col:
|
| 51 |
user_input = st.text_input("Type your message here...", key="chat_input")
|
|
|
|
| 60 |
client = OpenAI(api_key=openai_key)
|
| 61 |
|
| 62 |
if user_input:
|
| 63 |
+
# Clear input after submitting
|
| 64 |
+
st.session_state["chat_input"] = ""
|
| 65 |
+
|
| 66 |
# Create thread if not exists
|
| 67 |
if not st.session_state["thread_id"]:
|
| 68 |
thread = client.beta.threads.create()
|