返回提交历史
Modified
g4f/models.py
+2
-2
Modified
g4f/providers/any_model_map.py
+3
-3
Deleted
scripts/tmp_fetch_frame.py
+0
-29
Deleted
scripts/tmp_fetch_sdk.py
+0
-22
Deleted
scripts/tmp_find_frame.py
+0
-16
XFEstudio/gpt4free
Fix unittests
ef713e38
代码差异
5 个文件
+5
-72
@@ -130,7 +130,7 @@ default = Model(
130
130
"Qwen",
131
131
"TeachAnything",
132
132
"OpenaiChat",
133
"ChatGPTLightweight",
133
"ChatGPT",
134
134
"OpenCode",
135
135
"KiloCode",
136
136
"OpenRouterFree",
@@ -184,7 +184,7 @@ gpt_4o = VisionModel(
184
184
gpt_4o_mini = Model(
185
185
name="gpt-4o-mini",
186
186
base_provider="OpenAI",
187
best_provider=IterListProvider(["OpenaiChat", "ChatGPTLightweight", "Surfsense"]),
187
best_provider=IterListProvider(["OpenaiChat", "ChatGPT", "Surfsense"]),
188
188
)
189
189
190
190
@@ -16,7 +16,7 @@ model_map = {
16
16
"OperaAria": "",
17
17
"GeminiPro": "",
18
18
"OpenRouterFree": "",
19
"ChatGPTLightweight": "",
19
"ChatGPT": "",
20
20
"LLM7": "default",
21
21
"OpenaiChat": "",
22
22
"G4FSpace": "default:"
@@ -47,12 +47,12 @@ model_map = {
47
47
"GithubCopilot": "gpt-4o",
48
48
"KiloCode": "openai/gpt-4o-2024-05-13",
49
49
"OpenRouter": "openai/gpt-4o:batch",
50
"ChatGPTLightweight": "gpt-4o",
50
"ChatGPT": "gpt-4o",
51
51
"Puter": "openrouter:openai/gpt-4o:batch"
52
52
},
53
53
"gpt-4o-mini": {
54
54
"OpenaiChat": "gpt-4o-mini",
55
"ChatGPTLightweight": "gpt-4o-mini",
55
"ChatGPT": "gpt-4o-mini",
56
56
"Airforce": "gpt-4o-mini",
57
57
"CopilotApp": "chat",
58
58
"GithubCopilot": "gpt-4o-mini",
@@ -1,29 +0,0 @@
1
import asyncio, re, sys
2
sys.path.insert(0, "/home/heiner/Projects/gpt4free")
3
4
5
async def main():
6
from g4f.requests import StreamSession
7
from g4f.Provider.needs_auth import ChatGPTLightweight as M
8
9
cookies, _ = M.ChatGPTLightweight._load_auth_state()
10
ua = M.ChatGPTLightweight.user_agent
11
async with StreamSession(impersonate="chrome", timeout=60, cookies=cookies) as s:
12
async with s.get(
13
"https://chatgpt.com/backend-api/sentinel/frame.html",
14
headers={"user-agent": ua, "accept": "text/html", "referer": "https://chatgpt.com/"},
15
) as r:
16
html = await r.text()
17
print("status ok, len:", len(html))
18
with open("/tmp/frame.html", "w") as f:
19
f.write(html)
20
for m in re.findall(r'<script[^>]*src="([^"]+)"', html):
21
print("script:", m)
22
inline = re.findall(r"<script(?![^>]*src)[^>]*>(.*?)</script>", html, re.S)
23
for i, t in enumerate(inline):
24
print(f"inline[{i}]: {len(t)} chars")
25
with open(f"/tmp/frame_inline_{i}.js", "w") as f:
26
f.write(t)
27
28
29
asyncio.run(main())
@@ -1,22 +0,0 @@
1
import asyncio, sys
2
sys.path.insert(0, "/home/heiner/Projects/gpt4free")
3
4
5
async def main():
6
from g4f.requests import StreamSession
7
from g4f.Provider.needs_auth import ChatGPTLightweight as M
8
9
cookies, _ = M.ChatGPTLightweight._load_auth_state()
10
ua = M.ChatGPTLightweight.user_agent
11
async with StreamSession(impersonate="chrome", timeout=60, cookies=cookies) as s:
12
async with s.get(
13
"https://chatgpt.com/sentinel/20260810913b/sdk.js",
14
headers={"user-agent": ua, "referer": "https://chatgpt.com/backend-api/sentinel/frame.html"},
15
) as r:
16
js = await r.text()
17
print("len:", len(js))
18
with open("/tmp/sentinel_sdk.js", "w") as f:
19
f.write(js)
20
21
22
asyncio.run(main())
@@ -1,16 +0,0 @@
1
import json, re
2
3
har = json.load(open("har_and_cookies/chatgpt.com.har"))
4
for e in har["log"]["entries"]:
5
u = e["request"]["url"]
6
if "frame" in u.lower() or ("sentinel" in u and u.endswith(".js")):
7
print(u[:160])
8
9
for e in har["log"]["entries"]:
10
if "frame.html" in e["request"]["url"]:
11
c = e.get("response", {}).get("content", {})
12
txt = c.get("text", "") or ""
13
print("\nframe.html size:", c.get("size"), "has text:", len(txt))
14
for m in re.findall(r'src="([^"]+)"', txt)[:10]:
15
print(" script:", m)
16
break