Manoj21k commited on
Commit
9b05a28
·
verified ·
1 Parent(s): 519df16

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -26,18 +26,16 @@ for msg in msgs.messages:
26
  st.chat_message(msg.type).write(msg.content)
27
 
28
  if prompt := st.chat_input():
29
- start_time = time.time()
30
- st.chat_message("human").write(prompt)
31
- msgs.add_user_message(prompt)
32
-
33
- with st.spinner("Waiting for response..."):
34
- try:
35
  res = get_prompt(prompt, api)
36
- except Exception as e:
37
- return "Something went wrong (:"
38
- if res:
39
- st.chat_message("ai").write(res)
40
- end_time = time.time()
41
- msgs.add_ai_message(res)
42
- else:
43
- st.error("No valid response received from the AI.")
 
26
  st.chat_message(msg.type).write(msg.content)
27
 
28
  if prompt := st.chat_input():
29
+ try:
30
+ st.chat_message("human").write(prompt)
31
+ msgs.add_user_message(prompt)
32
+
33
+ with st.spinner("Waiting for response..."):
 
34
  res = get_prompt(prompt, api)
35
+ if res:
36
+ st.chat_message("ai").write(res)
37
+ msgs.add_ai_message(res)
38
+ else:
39
+ st.error("No valid response received from the AI.")
40
+ except:
41
+ return "Something went wrong (:"