Update app.py
Browse files
app.py
CHANGED
@@ -84,7 +84,7 @@ def upload_attachment(cookie ,organization_id,file_path):
|
|
84 |
url = 'https://claude.ai/api/convert_document'
|
85 |
headers = {
|
86 |
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82',
|
87 |
-
'Accept-Language': 'en-
|
88 |
'Referer': 'https://claude.ai/chats',
|
89 |
'Origin': 'https://claude.ai',
|
90 |
'Sec-Fetch-Dest': 'empty',
|
@@ -105,8 +105,7 @@ def upload_attachment(cookie ,organization_id,file_path):
|
|
105 |
}
|
106 |
print(files)
|
107 |
response = requests.post(url, headers=headers, files=files)
|
108 |
-
|
109 |
-
#response = request(url, headers=headers, files=files,proxies=proxies)
|
110 |
if response.status_code == 200:
|
111 |
return response.json()
|
112 |
else:
|
@@ -251,7 +250,7 @@ with gr.Blocks() as dialog_app:
|
|
251 |
with gr.Column(scale=0.4):
|
252 |
cookies = gr.Textbox(lines=2, label="输入cookies")
|
253 |
user_id = gr.Textbox(lines=2, label="输入user_id/organization_uuid")
|
254 |
-
file = gr.File(label='请上传知识库文件, 目前支持txt、
|
255 |
# channel_id = gr.Textbox(lines=2, label="输入channel_id/conversation_uuid")
|
256 |
# chatbot = gr.Chatbot()
|
257 |
with gr.Column(scale=0.6):
|
|
|
84 |
url = 'https://claude.ai/api/convert_document'
|
85 |
headers = {
|
86 |
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82',
|
87 |
+
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
88 |
'Referer': 'https://claude.ai/chats',
|
89 |
'Origin': 'https://claude.ai',
|
90 |
'Sec-Fetch-Dest': 'empty',
|
|
|
105 |
}
|
106 |
print(files)
|
107 |
response = requests.post(url, headers=headers, files=files)
|
108 |
+
print(f"response:{response}")
|
|
|
109 |
if response.status_code == 200:
|
110 |
return response.json()
|
111 |
else:
|
|
|
250 |
with gr.Column(scale=0.4):
|
251 |
cookies = gr.Textbox(lines=2, label="输入cookies")
|
252 |
user_id = gr.Textbox(lines=2, label="输入user_id/organization_uuid")
|
253 |
+
file = gr.File(label='请上传知识库文件, 目前支持txt、csv、pdf格式',file_types=['.txt', '.csv', '.pdf'])
|
254 |
# channel_id = gr.Textbox(lines=2, label="输入channel_id/conversation_uuid")
|
255 |
# chatbot = gr.Chatbot()
|
256 |
with gr.Column(scale=0.6):
|