XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

Fix undefined names, type errors, and code quality issues (#3288)

* Initial plan * Fix critical code issues: undefined names, unused nonlocal, and type annotations Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com> * Fix code style issues: improve None comparisons, membership tests, and lambda usage Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com> * Remove unused imports: clean up re and os imports from tools Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>

f244ee0c
Copilot <198982749+Copilot@users.noreply.github.com>
提交于

代码差异

8 个文件 +15 -6
Modified g4f/Provider/Yupp.py +1 -1
@@ -518,7 +518,7 @@ class Yupp(AsyncGeneratorProvider, ProviderModelMixin):
518 518
519 519 - If for_target=True → chunk belongs to the target model output.
520 520 """
521 nonlocal is_thinking, thinking_content, normal_content, variant_text, session
521 nonlocal normal_content
522 522
523 523 if not is_valid_content(content):
524 524 return
Modified g4f/Provider/needs_auth/GithubCopilot.py +1 -1
@@ -131,7 +131,7 @@ class GithubCopilot(AsyncGeneratorProvider, ProviderModelMixin):
131 131 "streaming": stream,
132 132 "confirmations": [],
133 133 "customInstructions": [],
134 "model": api_model,
134 "model": model,
135 135 "mode": "immersive"
136 136 }
137 137
Modified g4f/Provider/needs_auth/You.py +6 -0
@@ -4,6 +4,12 @@ import re
4 4 import json
5 5 import uuid
6 6
7 try:
8 import nodriver
9 has_nodriver = True
10 except ImportError:
11 has_nodriver = False
12
7 13 from ...typing import AsyncResult, Messages, ImageType, Cookies
8 14 from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
9 15 from ..helper import format_prompt
Modified g4f/cookies.py +5 -1
@@ -50,7 +50,11 @@ class CookiesConfig:
50 50 class BrowserConfig:
51 51 port: int = None
52 52 host: str = "127.0.0.1"
53 stop_browser = lambda: None
53
54 @staticmethod
55 def stop_browser():
56 return None
57
54 58 browser_executable_path: str = None
55 59
56 60 DOMAINS = (
Modified g4f/tools/fetch_and_scrape.py +1 -0
@@ -25,6 +25,7 @@ def scrape_text(html: str, max_words: Optional[int] = None, add_source: bool = T
25 25 soup = BeautifulSoup(html, "html.parser")
26 26
27 27 # Read the meta tags
28 seen_texts = [] # Initialize seen_texts list to track already processed text
28 29 if add_metadata:
29 30 metadata: Dict[str, str] = {}
30 31
Modified g4f/tools/files.py +0 -1
@@ -1,6 +1,5 @@
1 1 from __future__ import annotations
2 2
3 import re
4 3 import os
5 4 import json
6 5 from pathlib import Path
Modified g4f/tools/run_tools.py +0 -1
@@ -1,6 +1,5 @@
1 1 from __future__ import annotations
2 2
3 import os
4 3 import re
5 4 import json
6 5 import math
Modified g4f/typing.py +1 -1
@@ -85,7 +85,7 @@ __all__ = [
85 85 "Message",
86 86 "ContentPart",
87 87 "Cookies",
88 "Image",
88 "PILImage", # Changed from "Image" to "PILImage" to match the actual class name
89 89 "ImageType",
90 90 "MediaListType",
91 91 "ResponseType",