neuralleap commited on
Commit
184d9a7
·
verified ·
1 Parent(s): eda487c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -194,9 +194,9 @@ def get_ai_response(prompt, history):
194
  )
195
  return response.choices[0].message.content
196
 
197
- except openai.error.AuthenticationError as auth_err:
198
  return f"Authentication error: {str(auth_err)}. Check your API key."
199
- except openai.error.InvalidRequestError as inv_err:
200
  return f"Invalid request: {str(inv_err)}. The model '{model}' might not be available with your API key."
201
  except Exception as e:
202
  return f"An error occurred: {str(e)}. Please try a different model or check your setup."
@@ -369,4 +369,4 @@ with main_content:
369
  time.sleep(0.005)
370
  message_placeholder.markdown(full_response)
371
  messages.append({"role": "assistant", "content": full_response})
372
- st.rerun()
 
194
  )
195
  return response.choices[0].message.content
196
 
197
+ except openai.AuthenticationError as auth_err:
198
  return f"Authentication error: {str(auth_err)}. Check your API key."
199
+ except openai.InvalidRequestError as inv_err:
200
  return f"Invalid request: {str(inv_err)}. The model '{model}' might not be available with your API key."
201
  except Exception as e:
202
  return f"An error occurred: {str(e)}. Please try a different model or check your setup."
 
369
  time.sleep(0.005)
370
  message_placeholder.markdown(full_response)
371
  messages.append({"role": "assistant", "content": full_response})
372
+ st.rerun()