Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,17 +6,17 @@ def request_to_v2(message, cookie, user_id, channel_id,context=[]):
|
|
6 |
times = 3
|
7 |
context = [message]
|
8 |
headers = {
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
'Content-Type': 'application/json',
|
14 |
'Origin': 'https://claude.ai',
|
15 |
'Referer': f'https://claude.ai/chat/{channel_id}',
|
16 |
'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',
|
17 |
'Cookie': cookie,
|
18 |
-
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8
|
19 |
-
|
20 |
'Accept': 'text/event-stream, text/event-stream',
|
21 |
'Sec-Ch-Ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',
|
22 |
'Sec-Ch-Ua-Mobile': '?0',
|
@@ -29,6 +29,7 @@ def request_to_v2(message, cookie, user_id, channel_id,context=[]):
|
|
29 |
post_msg_url = 'https://claude.ai/api/append_message'
|
30 |
post_msg_data = {
|
31 |
"completion":{
|
|
|
32 |
"prompt": message,
|
33 |
"timezone":"Asia/Shanghai",
|
34 |
"model":"claude-2"
|
|
|
6 |
times = 3
|
7 |
context = [message]
|
8 |
headers = {
|
9 |
+
':Authority': 'claude.ai',
|
10 |
+
':Method': 'POST',
|
11 |
+
':Path': '/api/append_message',
|
12 |
+
':Scheme': 'https',
|
13 |
'Content-Type': 'application/json',
|
14 |
'Origin': 'https://claude.ai',
|
15 |
'Referer': f'https://claude.ai/chat/{channel_id}',
|
16 |
'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',
|
17 |
'Cookie': cookie,
|
18 |
+
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
|
19 |
+
'Accept-Encoding': 'gzip, deflate, br',
|
20 |
'Accept': 'text/event-stream, text/event-stream',
|
21 |
'Sec-Ch-Ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',
|
22 |
'Sec-Ch-Ua-Mobile': '?0',
|
|
|
29 |
post_msg_url = 'https://claude.ai/api/append_message'
|
30 |
post_msg_data = {
|
31 |
"completion":{
|
32 |
+
"incremental":True,
|
33 |
"prompt": message,
|
34 |
"timezone":"Asia/Shanghai",
|
35 |
"model":"claude-2"
|