mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-24 13:07:53 +08:00
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>
This commit is contained in:
@@ -518,7 +518,7 @@ class Yupp(AsyncGeneratorProvider, ProviderModelMixin):
|
||||
|
||||
- If for_target=True → chunk belongs to the target model output.
|
||||
"""
|
||||
nonlocal is_thinking, thinking_content, normal_content, variant_text, session
|
||||
nonlocal normal_content
|
||||
|
||||
if not is_valid_content(content):
|
||||
return
|
||||
|
||||
@@ -131,7 +131,7 @@ class GithubCopilot(AsyncGeneratorProvider, ProviderModelMixin):
|
||||
"streaming": stream,
|
||||
"confirmations": [],
|
||||
"customInstructions": [],
|
||||
"model": api_model,
|
||||
"model": model,
|
||||
"mode": "immersive"
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,12 @@ import re
|
||||
import json
|
||||
import uuid
|
||||
|
||||
try:
|
||||
import nodriver
|
||||
has_nodriver = True
|
||||
except ImportError:
|
||||
has_nodriver = False
|
||||
|
||||
from ...typing import AsyncResult, Messages, ImageType, Cookies
|
||||
from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
|
||||
from ..helper import format_prompt
|
||||
|
||||
@@ -50,7 +50,11 @@ class CookiesConfig:
|
||||
class BrowserConfig:
|
||||
port: int = None
|
||||
host: str = "127.0.0.1"
|
||||
stop_browser = lambda: None
|
||||
|
||||
@staticmethod
|
||||
def stop_browser():
|
||||
return None
|
||||
|
||||
browser_executable_path: str = None
|
||||
|
||||
DOMAINS = (
|
||||
|
||||
@@ -25,6 +25,7 @@ def scrape_text(html: str, max_words: Optional[int] = None, add_source: bool = T
|
||||
soup = BeautifulSoup(html, "html.parser")
|
||||
|
||||
# Read the meta tags
|
||||
seen_texts = [] # Initialize seen_texts list to track already processed text
|
||||
if add_metadata:
|
||||
metadata: Dict[str, str] = {}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import os
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import json
|
||||
import math
|
||||
|
||||
@@ -85,7 +85,7 @@ __all__ = [
|
||||
"Message",
|
||||
"ContentPart",
|
||||
"Cookies",
|
||||
"Image",
|
||||
"PILImage", # Changed from "Image" to "PILImage" to match the actual class name
|
||||
"ImageType",
|
||||
"MediaListType",
|
||||
"ResponseType",
|
||||
|
||||
Reference in New Issue
Block a user