xiaolv commited on
Commit
ffdedc8
1 Parent(s): 955a0ae

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -24,10 +24,12 @@ async def get_model_reply(prompt,style,cookies,context=[]):
24
  # given the most recent context (4096 characters)
25
  # continue the text up to 2048 tokens ~ 8192 charaters
26
  bot = Chatbot(cookies=cookies)
27
- raw_data = await bot.ask(prompt, conversation_style=style)
28
- await bot.close()
29
- print(raw_data)
30
  try:
 
 
 
 
31
  try:
32
  response = raw_data["item"]["messages"][1]["text"]
33
  except:
@@ -38,7 +40,7 @@ async def get_model_reply(prompt,style,cookies,context=[]):
38
  responses = [(u, b) for u, b in zip(context[::2], context[1::2])]
39
  return responses, context
40
 
41
- except EdgeGPT.NotAllowedToAccess :
42
  response = " >>>> 账号需要重新激活。"
43
  print(response)
44
  context += ["-1"]
 
24
  # given the most recent context (4096 characters)
25
  # continue the text up to 2048 tokens ~ 8192 charaters
26
  bot = Chatbot(cookies=cookies)
27
+
 
 
28
  try:
29
+ raw_data = await bot.ask(prompt, conversation_style=style)
30
+ await bot.close()
31
+ print(raw_data)
32
+
33
  try:
34
  response = raw_data["item"]["messages"][1]["text"]
35
  except:
 
40
  responses = [(u, b) for u, b in zip(context[::2], context[1::2])]
41
  return responses, context
42
 
43
+ except EdgeGPT.NotAllowedToAccess:
44
  response = " >>>> 账号需要重新激活。"
45
  print(response)
46
  context += ["-1"]