xiaolv commited on
Commit
fa4def4
1 Parent(s): 6e62712

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -32
app.py CHANGED
@@ -80,49 +80,38 @@ def request_to_v2(message, cookie, user_id, channel_id,context=[]):
80
  if __name__ == "__main__":
81
 
82
 
 
83
  with gr.Blocks() as dialog_app:
84
- with gr.Tab("Cookies"):
85
- cookies = gr.Textbox(lines=2, label="输入cookies",)
86
- user_id = gr.Textbox(lines=2, label="输入user_id",)
87
- channel_id = gr.Textbox(lines=2, label="输入channel_id",)
88
- with gr.Tab("New Bing Chat GPT4"):
89
  gr.Markdown("""
90
- # 连接 new-bing 接口,用的是GPT4接口
91
- 如果回复为 "1" ,说明目前服务比较火爆,建议过段时间再来用;
92
- 如果回复为 "0" , 请刷新网页重来。
93
- 如果回复为 "-1" , 需要重新利用梯子去激活一下聊天功能。
94
- 如果回复为 "-2" , 说明该账号需要登录bing聊天页面进行人机验证。
95
-
96
- ### 由于源码的更新,此时传入 [ choices = None ] 才能返回要求的格式。即不选择特定的choices模式
97
  """)
98
 
99
- chatbot = gr.Chatbot()
100
- state = gr.State([])
101
- markdown = gr.Markdown(label="Output")
 
 
 
 
 
 
 
102
 
103
  with gr.Row():
104
  inputs = gr.Textbox(
105
  label="输入问题",
106
- placeholder="请输入你的文本,确保已经正确填入bing.com中的cookies"
107
  )
108
-
109
  inputs.submit(request_to_v2, [inputs, cookies, user_id,channel_id,state], [chatbot, state])
110
  send = gr.Button("发送请求.....")
111
- send.click(request_to_v2, [inputs, cookies, user_id,channel_id,state], [chatbot, state], api_name="xiaolvgpt")
112
 
113
- gr.Markdown("""
114
- 如果输入后没有返回结果,大概率是你的 cookies 账号未申请new-bing的聊天功能;
115
- 步骤:
116
- 1. 在 Edge 浏览器;
117
- 2. 登录 个人账号 // 申请新账号;
118
- 3. 打开“动力”;
119
- 4. https://cn.bing.com/ 网页 或者 https://www.bing.com/new 看是否有聊天功能;
120
- 5. 新版的 Edge 浏览器右上角有个bing的图标,点击后就可以进行聊天;
121
- 6. 说明可以了,再关掉“动力”,使用国内的网络再次复制cookies。
122
- """)
123
-
124
- # launches the app in a new local port
125
- dialog_app.launch(show_error=True)
126
  # 为网站设置密码防止滥用
127
- # dialog_app.launch(auth=("admin", "pass1234"))
 
128
 
 
80
  if __name__ == "__main__":
81
 
82
 
83
+
84
  with gr.Blocks() as dialog_app:
85
+ gr.HTML("""<h1 align="center">Claude2-API-xiaolv</h1>""")
86
+ with gr.Tab("Claude2 API xiaolv"):
 
 
 
87
  gr.Markdown("""
88
+ ## 需要传入的参数有:
89
+ 1.cookie:intercom-device-id-lupk8zyo=.......
90
+ 2.user_id:对应 organization_uuid
91
+ 3.channel_id:对应 conversation_uuid
 
 
 
92
  """)
93
 
94
+ with gr.Row().style():
95
+ with gr.Column(scale=0.4):
96
+ cookies = gr.Textbox(lines=2, label="输入cookies")
97
+ user_id = gr.Textbox(lines=2, label="输入user_id/organization_uuid")
98
+ channel_id = gr.Textbox(lines=2, label="输入channel_id/conversation_uuid")
99
+ # chatbot = gr.Chatbot()
100
+ with gr.Column(scale=0.6):
101
+ chatbot = gr.Chatbot([])
102
+
103
+ state = gr.State([])
104
 
105
  with gr.Row():
106
  inputs = gr.Textbox(
107
  label="输入问题",
108
+ placeholder="请输入你的文本,确保已经正确填入cookies、user_id、channel_id"
109
  )
 
110
  inputs.submit(request_to_v2, [inputs, cookies, user_id,channel_id,state], [chatbot, state])
111
  send = gr.Button("发送请求.....")
112
+ send.click(request_to_v2, [inputs, cookies, user_id,channel_id,state], [chatbot, state], api_name="xiaolvgpt", show_progress=True)
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  # 为网站设置密码防止滥用
115
+ dialog_app.launch(auth=("admin", "2240560729"),show_error=True,show_api=True,share=True, inbrowser=True)
116
+
117