Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 9f261d5

Browse files
authored
Merge pull request #131 from Integration-Automation/dev
Support change 4 and turbo
2 parents 3e6b374 + a3a4255 commit 9f261d5

File tree

9 files changed

+130
-80
lines changed

9 files changed

+130
-80
lines changed

dev.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66

77
[project]
88
name = "re_edge_gpt_dev"
9-
version = "0.0.41"
9+
version = "0.0.42"
1010
authors = [
1111
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
1212
]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66

77
[project]
88
name = "re_edge_gpt"
9-
version = "0.0.34"
9+
version = "0.0.35"
1010
authors = [
1111
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
1212
]

re_edge_gpt/chat/chathub.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(
4040
conversation: Conversation,
4141
proxy: str = None,
4242
cookies: Union[List[dict], None] = None,
43-
mode: str = "Bing"
43+
mode: str = "Bing",
4444
) -> None:
4545
self.aio_session = None
4646
self.request: ChatHubRequest
@@ -84,7 +84,7 @@ async def ask_stream(
8484
# Use for attachment
8585
attachment: dict = None,
8686
remove_options: list = None,
87-
add_options: list = None
87+
add_options: list = None,
8888
) -> Generator[bool, Union[dict, str], None]:
8989
""" """
9090
if self.encrypted_conversation_signature is not None:

re_edge_gpt/chat/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"Edg/121.0.0.0",
105105
}
106106

107-
BUNDLE_VERSION = "1.1573.4"
107+
BUNDLE_VERSION = "1.1642.1"
108108
APP_ID = "6c0f12ef-97d3-4869-bc42-c1d9bdb4a759"
109109

110110
SYDNEY_INIT_HEADER = HEADERS_INIT_CONVER.update(

re_edge_gpt/chat/conversation_style.py

Lines changed: 72 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,60 +9,89 @@
99

1010
class ConversationStyle(Enum):
1111
creative = [
12-
"fluxcopilot",
13-
"nojbf",
12+
"nlu_direct_response_filter",
13+
"deepleo",
14+
"disable_emoji_spoken_text",
15+
"responsible_ai_policy_235",
16+
"enablemm",
17+
"dv3sugg",
18+
"autosave",
1419
"iyxapbing",
1520
"iycapbing",
16-
"dgencontentv3",
17-
"nointernalsugg",
18-
"disable_telemetry",
19-
"machine_affinity",
20-
"streamf",
21-
"codeint",
22-
"langdtwb",
23-
"fdwtlst",
24-
"fluxprod",
25-
"eredirecturl",
26-
"deuct3"
21+
"h3imaginative",
22+
"clgalileo",
23+
"gencontentv3",
24+
"uquopt",
25+
"sunoupsell",
26+
"gndlogcf",
27+
"flxvsearch",
28+
"noknowimg",
29+
"eredirecturl"
30+
]
31+
creative_classic = [
32+
"nlu_direct_response_filter",
33+
"deepleo",
34+
"disable_emoji_spoken_text",
35+
"responsible_ai_policy_235",
36+
"enablemm",
37+
"dv3sugg",
38+
"autosave",
39+
"iyxapbing",
40+
"iycapbing",
41+
"h3imaginative",
42+
"clgalileo",
43+
"gencontentv3",
44+
"uquopt",
45+
"sunoupsell",
46+
"gndlogcf",
47+
"flxvsearch",
48+
"noknowimg",
49+
"eredirecturl"
2750
]
2851
balanced = [
29-
"fluxcopilot",
30-
"nojbf",
52+
"nlu_direct_response_filter",
53+
"deepleo",
54+
"disable_emoji_spoken_text",
55+
"responsible_ai_policy_235",
56+
"enablemm",
57+
"dv3sugg",
58+
"autosave",
3159
"iyxapbing",
3260
"iycapbing",
33-
"dgencontentv3",
34-
"nointernalsugg",
35-
"disable_telemetry",
36-
"machine_affinity",
37-
"streamf",
38-
"codeint",
39-
"langdtwb",
40-
"fdwtlst",
41-
"fluxprod",
42-
"eredirecturl",
43-
"deuct3",
44-
# Balance
61+
"enable_user_consent",
62+
"fluxmemcst",
4563
"galileo",
46-
"gldcl1p"
64+
"saharagenconv5",
65+
"dc1mncp",
66+
"uquopt",
67+
"sunoupsell",
68+
"crkt2t",
69+
"immslots",
70+
"cpproname",
71+
"vidtoppb",
72+
"gptv1desc2",
73+
"eredirecturl"
4774
]
4875
precise = [
49-
"fluxcopilot",
50-
"nojbf",
76+
"nlu_direct_response_filter",
77+
"deepleo",
78+
"disable_emoji_spoken_text",
79+
"responsible_ai_policy_235",
80+
"enablemm",
81+
"dv3sugg",
82+
"autosave",
5183
"iyxapbing",
5284
"iycapbing",
53-
"dgencontentv3",
54-
"nointernalsugg",
55-
"disable_telemetry",
56-
"machine_affinity",
57-
"streamf",
58-
"codeint",
59-
"langdtwb",
60-
"fdwtlst",
61-
"fluxprod",
62-
"eredirecturl",
63-
"deuct3",
64-
# Precise
65-
"h3precise"
85+
"enable_user_consent",
86+
"fluxmemcst",
87+
"h3precise",
88+
"clgalileo",
89+
"uquopt",
90+
"sunoupsell",
91+
"crkt2t",
92+
"flxvsearchans",
93+
"noknowimg",
94+
"eredirecturl"
6695
]
6796

6897

re_edge_gpt/chat/re_edge_gpt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Chatbot:
1919
def __init__(
2020
self,
2121
proxy: str | None = None,
22-
cookies: list[dict] | None = None
22+
cookies: list[dict] | None = None,
2323
) -> None:
2424
self.proxy: str | None = proxy
2525
self.chat_hub: ChatHub = ChatHub(

re_edge_gpt/chat/request.py

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,47 +55,64 @@ def update(
5555

5656
# Get current time
5757
timestamp = datetime.now().strftime("%Y-%m-%dT%H:%M:%S") + offset_string
58+
style = conversation_style.name.capitalize() # Make first letter uppercase
59+
not_in_style = {"creative_classic": "CreativeClassic"}
5860
self.struct = {
5961
"arguments": [
6062
{
61-
"source": "cib",
63+
"source": "cib-ccp",
6264
"optionsSets": conversation_style.value,
6365
"allowedMessageTypes": [
6466
"ActionRequest",
6567
"Chat",
68+
"ConfirmationCard",
6669
"Context",
6770
"InternalSearchQuery",
6871
"InternalSearchResult",
72+
"Disengaged",
6973
"InternalLoaderMessage",
7074
"Progress",
75+
"RenderCardRequest",
76+
"RenderContentRequest",
77+
"AdsQuery",
78+
"SemanticSerp",
7179
"GenerateContentQuery",
7280
"SearchQuery",
7381
"GeneratedCode",
82+
"InternalTasksMessage"
7483
],
7584
"sliceIds": [
76-
"schurmsg",
77-
"ntbkcf",
78-
"rankcf",
79-
"bgstreamcf",
80-
"cmcallapptf",
81-
"vnextvoicecf",
82-
"tts5cf",
83-
"abv2mobcf",
84-
"ctvismctrl",
85-
"suppsm240rev10-t",
86-
"suppsm240-t",
87-
"translrefctrl",
88-
"1215perscs0",
89-
"0212bops0",
90-
"116langwb",
91-
"0112wtlsts0",
92-
"118wcsmw",
93-
"1201reasons0",
94-
"0116trimgd",
95-
"cacfastapis"
85+
"disbotgrtcf",
86+
"ntbkgold2",
87+
"ntbkf1",
88+
"qna10",
89+
"thdnsrch",
90+
"slangcf",
91+
"vnextr100",
92+
"vnext100",
93+
"vnextvoice",
94+
"rdlidncf",
95+
"semserpnomlbg",
96+
"semserpnoml",
97+
"srchqryfix",
98+
"cacntjndcae",
99+
"edgenorrwrap",
100+
"cmcpupsalltf",
101+
"sunoupsell",
102+
"313dynaplfs0",
103+
"0312hrthrots0",
104+
"0317immslotsc",
105+
"228pyfiles0",
106+
"kcclickthrucf",
107+
"sportsatis0",
108+
"0317dc1pro",
109+
"defgrey",
110+
"ssadsv4chtiidnoifbm",
111+
"adsltmdsc",
112+
"ssadsv2nocm"
96113
],
97114
"verbosity": "verbose",
98-
"scenario":"SERP",
115+
"scenario": "SERP",
99116
"traceId": get_ran_hex(32),
100117
"isStartOfSession": self.invocation_id == 3,
101118
"message": {
@@ -113,7 +130,8 @@ def update(
113130
"imageUrl": image_url if image_url else None,
114131
"originalImageUrl": image_url if image_url else None,
115132
},
116-
"tone": conversation_style.name.capitalize(), # Make first letter uppercase
133+
"tone": style if style not in not_in_style.keys()
134+
else not_in_style.get(style),
117135
"requestId": message_id,
118136
"conversationSignature": self.conversation_signature,
119137
"participant": {

test/unit_test/back-end/manual_test/test_bot_manual.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import asyncio
22
import json
3+
# If you are using jupyter pls install this package
4+
# from nest_asyncio import apply
35
from pathlib import Path
46

57
from re_edge_gpt import Chatbot
68
from re_edge_gpt import ConversationStyle
79

810

9-
# If you are using jupyter pls install this package
10-
# from nest_asyncio import apply
11-
12-
1311
async def test_ask() -> None:
1412
bot = None
1513
try:
@@ -22,10 +20,10 @@ async def test_ask() -> None:
2220
str(Path(str(Path.cwd()) + "/copilot_cookies.json")), encoding="utf-8").read())
2321
bot = await Chatbot.create(cookies=cookies, mode=mode)
2422
response = await bot.ask(
25-
prompt="HELLO",
26-
conversation_style=ConversationStyle.balanced,
23+
prompt="What version u are using GPT-4 turbo?",
24+
conversation_style=ConversationStyle.creative_classic,
2725
simplify_response=True,
28-
search_result=True
26+
search_result=True,
2927
)
3028
# If you are using non ascii char you need set ensure_ascii=False
3129
print(json.dumps(response, indent=2, ensure_ascii=False))

test/unit_test/back-end/manual_test/test_generation_manual_async_loop.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
import asyncio
22
import shutil
3+
import ssl
34
import sys
45
from pathlib import Path
56

7+
import certifi
8+
69
from re_edge_gpt import ImageGenAsync
710

811
# create a temporary output directory for testing purposes
912
test_output_dir = "test_output"
1013
# download a test image
1114
test_image_url = "https://picsum.photos/200"
1215
auth_cooker = open("bing_cookies.txt", "r+").read()
13-
async_gen = ImageGenAsync(auth_cookie=auth_cooker)
16+
ssl_context = ssl.create_default_context()
17+
ssl_context.load_verify_locations(certifi.where())
18+
async_gen = ImageGenAsync(auth_cookie=auth_cooker, proxy="http://WfJu9DjPeWsHgjI3So6q3A@smartproxy.crawlbase.com:8012")
1419

1520

1621
# Generate image list async

0 commit comments

Comments
 (0)