xiaolv commited on
Commit
712cb30
1 Parent(s): b33800e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -6
app.py CHANGED
@@ -48,12 +48,21 @@ async def get_model_reply(prompt,style,cookies,context=[]):
48
  return responses, context
49
 
50
  except:
51
- if raw_data["item"]["result"]["value"] == "Throttled":
52
- response = "> **错误: 我们很抱歉,但你已经达到了你在24小时内可以向Bing发送消息的最大数量。请稍后再查看!**"
53
- print(response)
54
- context += ["1"]
55
- responses = [(u, b) for u, b in zip(context[::2], context[1::2])]
56
- return responses, context
 
 
 
 
 
 
 
 
 
57
 
58
 
59
  with gr.Blocks() as dialog_app:
@@ -65,6 +74,7 @@ with gr.Blocks() as dialog_app:
65
  # 连接 new-bing 接口,用的是GPT4接口
66
  如果回复为 "1" ,说明目前服务比较火爆,建议过段时间再来用;
67
  如果回复为 "0" , 请刷新网页重来。
 
68
  """)
69
 
70
  chatbot = gr.Chatbot()
 
48
  return responses, context
49
 
50
  except:
51
+ try:
52
+ if 'error' in raw_data:
53
+ if raw_data['error'] == 'Authentication failed. You have not been accepted into the beta.':
54
+ response = " >>>> 账号需要重新激活。"
55
+ print(response)
56
+ context += ["-1"]
57
+ responses = [(u, b) for u, b in zip(context[::2], context[1::2])]
58
+ return responses, context
59
+ except:
60
+ if raw_data["item"]["result"]["value"] == "Throttled":
61
+ response = "> **错误: 我们很抱歉,但你已经达到了你在24小时内可以向Bing发送消息的最大数量。请稍后再查看!**"
62
+ print(response)
63
+ context += ["1"]
64
+ responses = [(u, b) for u, b in zip(context[::2], context[1::2])]
65
+ return responses, context
66
 
67
 
68
  with gr.Blocks() as dialog_app:
 
74
  # 连接 new-bing 接口,用的是GPT4接口
75
  如果回复为 "1" ,说明目前服务比较火爆,建议过段时间再来用;
76
  如果回复为 "0" , 请刷新网页重来。
77
+ 如果回复为 "-1" , 需要重新利用梯子去激活一下聊天功能。
78
  """)
79
 
80
  chatbot = gr.Chatbot()