GianJSX commited on
Commit
ad90478
1 Parent(s): f99ef57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -64,7 +64,6 @@ async def gpt_call(message_history: list = []):
64
  stream = client.chat.completions.create(
65
  model=model,
66
  messages=message_history,
67
- max_tokens=4096,
68
  stream=True,
69
  )
70
  return stream
@@ -76,7 +75,7 @@ def gpt_vision_call(image_history: list = []):
76
  stream = client.chat.completions.create(
77
  model=model_vision,
78
  messages=image_history,
79
- max_tokens=350,
80
  stream=True,
81
  )
82
 
@@ -84,7 +83,7 @@ def gpt_vision_call(image_history: list = []):
84
 
85
  @traceable(run_type="llm", name="api-key set")
86
  async def wait_for_key():
87
- res = await cl.AskUserMessage(content="Send an openai api-key to start", timeout=600).send()
88
  if res:
89
  await cl.Message(content="setting up...", indent=1).send()
90
  # check if the key is valid
@@ -96,12 +95,12 @@ async def wait_for_key():
96
  max_tokens=1,
97
  )
98
  if stream:
99
- await cl.Message(content="api-key setted, you can start chatting!", indent=1).send()
100
  cl.user_session.set("api_key", res["content"])
101
  except Exception as e:
102
  await cl.Message(content=f"{e}", indent=1).send()
103
  return await wait_for_key()
104
- return await cl.Message(content="api-key setted, you can start chatting!").send()
105
  else:
106
  return await wait_for_key()
107
 
 
64
  stream = client.chat.completions.create(
65
  model=model,
66
  messages=message_history,
 
67
  stream=True,
68
  )
69
  return stream
 
75
  stream = client.chat.completions.create(
76
  model=model_vision,
77
  messages=image_history,
78
+ max_tokens=500,
79
  stream=True,
80
  )
81
 
 
83
 
84
  @traceable(run_type="llm", name="api-key set")
85
  async def wait_for_key():
86
+ res = await cl.AskUserMessage(content="Send an Openai API_KEY to start. [https://platform.openai.com/api-keys](https://platform.openai.com/api-keys)", timeout=600).send()
87
  if res:
88
  await cl.Message(content="setting up...", indent=1).send()
89
  # check if the key is valid
 
95
  max_tokens=1,
96
  )
97
  if stream:
98
+ await cl.Message(content="API_KEY setted, you can start chatting!", indent=1).send()
99
  cl.user_session.set("api_key", res["content"])
100
  except Exception as e:
101
  await cl.Message(content=f"{e}", indent=1).send()
102
  return await wait_for_key()
103
+ return await cl.Message(content="API_KEY setted, you can start chatting!").send()
104
  else:
105
  return await wait_for_key()
106