mikeee commited on
Commit
03cfa70
·
1 Parent(s): d4271a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -139,8 +139,7 @@ with st.sidebar:
139
  api_key = st.text_input(label = "And paste your OpenAI API key here to get started",
140
  type = "password",
141
  help = "This isn't saved 🙈")
142
- logger.debug(f"sidebar api_key provided {api_key} ")
143
-
144
  # os.environ["OPENAI_API_KEY"] = api_key
145
 
146
  st.markdown("---")
@@ -199,7 +198,11 @@ if ask:
199
  logger.info(f"answer: {answer}")
200
  except Exception as exc:
201
  logger.error(exc)
202
- st.write(f"**{BOOK_NAME}:**: {exc}")
 
 
 
 
203
  st.stop()
204
 
205
  st.write(f"**{BOOK_NAME}:** {answer}")
 
139
  api_key = st.text_input(label = "And paste your OpenAI API key here to get started",
140
  type = "password",
141
  help = "This isn't saved 🙈")
142
+
 
143
  # os.environ["OPENAI_API_KEY"] = api_key
144
 
145
  st.markdown("---")
 
198
  logger.info(f"answer: {answer}")
199
  except Exception as exc:
200
  logger.error(exc)
201
+ if "<empty message>" in srt(exc):
202
+ _ = " (wrong key?)"
203
+ else:
204
+ _ = ""
205
+ st.write(f"**{BOOK_NAME}:**: {exc}{_}")
206
  st.stop()
207
 
208
  st.write(f"**{BOOK_NAME}:** {answer}")