shuanglei commited on
Commit
bfc31b3
1 Parent(s): ddb2412

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -18,12 +18,13 @@ messages = [
18
 
19
  def chatbot(input):
20
  if input:
 
21
  messages.append({"role": "user", "content": input})
22
  chat = openai.ChatCompletion.create(
23
  model="gpt-3.5-turbo", messages=messages
24
  )
25
  reply = chat.choices[0].message.content
26
- messages.append({"role": "assistant", "content": reply})
27
  return reply
28
 
29
  inputs = gr.inputs.Textbox(lines=7, label="提示词生成器")
 
18
 
19
  def chatbot(input):
20
  if input:
21
+ global messages
22
  messages.append({"role": "user", "content": input})
23
  chat = openai.ChatCompletion.create(
24
  model="gpt-3.5-turbo", messages=messages
25
  )
26
  reply = chat.choices[0].message.content
27
+ messages = {"role": "system", "content": prompt}]
28
  return reply
29
 
30
  inputs = gr.inputs.Textbox(lines=7, label="提示词生成器")