Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -69,47 +69,45 @@ def request_to_v2(message, cookie, user_id, channel_id,context=[]):
|
|
69 |
|
70 |
return responses, context
|
71 |
|
72 |
-
if __name__ == "__main__":
|
73 |
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
""")
|
85 |
|
86 |
-
|
87 |
-
with gr.Column(scale=0.4):
|
88 |
-
cookies = gr.Textbox(lines=2, label="输入cookies")
|
89 |
-
user_id = gr.Textbox(lines=2, label="输入user_id/organization_uuid")
|
90 |
-
channel_id = gr.Textbox(lines=2, label="输入channel_id/conversation_uuid")
|
91 |
-
# chatbot = gr.Chatbot()
|
92 |
-
with gr.Column(scale=0.6):
|
93 |
-
chatbot = gr.Chatbot([])
|
94 |
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
with gr.Row():
|
98 |
-
inputs = gr.Textbox(
|
99 |
-
label="输入问题",
|
100 |
-
placeholder="请输入你的文本,确保已经正确填入cookies、user_id、channel_id"
|
101 |
-
)
|
102 |
-
inputs.submit(request_to_v2, [inputs, cookies, user_id,channel_id,state], [chatbot, state])
|
103 |
-
send = gr.Button("发送请求.....")
|
104 |
-
send.click(request_to_v2, [inputs, cookies, user_id,channel_id,state], [chatbot, state], api_name="xiaolvgpt", show_progress=True)
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
# dialog_app.launch(show_error=True,show_api=True,share=True)
|
114 |
|
115 |
|
|
|
69 |
|
70 |
return responses, context
|
71 |
|
|
|
72 |
|
73 |
|
74 |
+
with gr.Blocks() as dialog_app:
|
75 |
+
gr.HTML("""<h1 align="center">Claude2-API-xiaolv</h1>""")
|
76 |
+
with gr.Tab("Claude2 API xiaolv"):
|
77 |
+
gr.Markdown("""
|
78 |
+
## 需要传入的参数有:
|
79 |
+
1.cookie:intercom-device-id-lupk8zyo=.......
|
80 |
+
2.user_id:对应 organization_uuid
|
81 |
+
3.channel_id:对应 conversation_uuid
|
82 |
+
""")
|
83 |
|
84 |
+
with gr.Row():
|
85 |
+
with gr.Column(scale=0.4):
|
86 |
+
cookies = gr.Textbox(lines=2, label="输入cookies")
|
87 |
+
user_id = gr.Textbox(lines=2, label="输入user_id/organization_uuid")
|
88 |
+
channel_id = gr.Textbox(lines=2, label="输入channel_id/conversation_uuid")
|
89 |
+
# chatbot = gr.Chatbot()
|
90 |
+
with gr.Column(scale=0.6):
|
91 |
+
chatbot = gr.Chatbot([])
|
|
|
92 |
|
93 |
+
state = gr.State([])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
+
with gr.Row():
|
96 |
+
inputs = gr.Textbox(
|
97 |
+
label="输入问题",
|
98 |
+
placeholder="请输入你的文本,确保已经正确填入cookies、user_id、channel_id"
|
99 |
+
)
|
100 |
+
inputs.submit(request_to_v2, [inputs, cookies, user_id,channel_id,state], [chatbot, state])
|
101 |
+
send = gr.Button("发送请求.....")
|
102 |
+
send.click(request_to_v2, [inputs, cookies, user_id,channel_id,state], [chatbot, state], api_name="xiaolvgpt", show_progress=True)
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
+
gr.Markdown("""
|
106 |
+
清除历史记录是,请输入:```/resrt```""")
|
107 |
+
|
108 |
+
# 为网站设置密码防止滥用
|
109 |
+
# dialog_app.launch(auth=("admin", "2240560729"),show_error=True,show_api=True,share=True)
|
110 |
+
dialog_app.launch(auth=("admin", "2240560729"),show_error=True)
|
111 |
+
# dialog_app.launch(show_error=True,show_api=True,share=True)
|
|
|
112 |
|
113 |
|