ynhe commited on
Commit
e1e7ba5
1 Parent(s): 1630d9e

Update chatbot.py

Browse files
Files changed (1) hide show
  1. chatbot.py +3 -2
chatbot.py CHANGED
@@ -64,7 +64,8 @@ class ConversationBot:
64
  {agent_scratchpad}
65
  """
66
  self.memory.clear()
67
-
 
68
  self.llm = OpenAI(temperature=0, openai_api_key=openai_api_key)
69
  self.agent = initialize_agent(
70
  self.tools,
@@ -75,7 +76,7 @@ class ConversationBot:
75
  return_intermediate_steps=True,
76
  agent_kwargs={'prefix': PREFIX, 'format_instructions': FORMAT_INSTRUCTIONS, 'suffix': SUFFIX}, )
77
  state = state + [("I upload a video, Please watch it first! ","I have watch this video, Let's chat!")]
78
- return gr.update(visible = True),state, state
79
 
80
  if __name__=="__main__":
81
  import pdb
 
64
  {agent_scratchpad}
65
  """
66
  self.memory.clear()
67
+ if not openai_api_key.startswith('sk-'):
68
+ return gr.update(visible = False),state, state, "Please paste your key here !"
69
  self.llm = OpenAI(temperature=0, openai_api_key=openai_api_key)
70
  self.agent = initialize_agent(
71
  self.tools,
 
76
  return_intermediate_steps=True,
77
  agent_kwargs={'prefix': PREFIX, 'format_instructions': FORMAT_INSTRUCTIONS, 'suffix': SUFFIX}, )
78
  state = state + [("I upload a video, Please watch it first! ","I have watch this video, Let's chat!")]
79
+ return gr.update(visible = True), state, state, openai_api_key
80
 
81
  if __name__=="__main__":
82
  import pdb