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

XFEstudio/gpt4free

Update Yupp.py

5aa372ef
Ammar <ammar.alkotb@gmail.com>
提交于

代码差异

1 个文件 +7 -6
Modified g4f/Provider/Yupp.py +7 -6
@@ -22,7 +22,8 @@ from .helper import get_last_user_message
22 22 from ..debug import log
23 23
24 24 # Global variables to manage Yupp accounts
25 YUPP_ACCOUNTS: List[Dict[str, Any]] = []
25 YUPP_ACCOUNT = Dict[str, Any]
26 YUPP_ACCOUNTS: List[YUPP_ACCOUNT] = []
26 27 account_rotation_lock = asyncio.Lock()
27 28
28 29 # Global variables to manage Yupp Image Cache
@@ -65,7 +66,7 @@ def create_headers() -> Dict[str, str]:
65 66 "Sec-Fetch-Site": "same-origin",
66 67 }
67 68
68 async def get_best_yupp_account() -> Optional[Dict[str, Any]]:
69 async def get_best_yupp_account() -> Optional[YUPP_ACCOUNT]:
69 70 """Get the best available Yupp account using smart selection algorithm"""
70 71 max_error_count = int(os.getenv("MAX_ERROR_COUNT", "3"))
71 72 error_cooldown = int(os.getenv("ERROR_COOLDOWN", "300"))
@@ -99,7 +100,7 @@ async def get_best_yupp_account() -> Optional[Dict[str, Any]]:
99 100 account["last_used"] = now
100 101 return account
101 102
102 async def claim_yupp_reward(session: aiohttp.ClientSession, account: Dict[str, Any], reward_id: str):
103 async def claim_yupp_reward(session: aiohttp.ClientSession, account: YUPP_ACCOUNT, reward_id: str):
103 104 """Claim Yupp reward asynchronously"""
104 105 try:
105 106 log_debug(f"Claiming reward {reward_id}...")
@@ -121,7 +122,7 @@ async def claim_yupp_reward(session: aiohttp.ClientSession, account: Dict[str, A
121 122 log_debug(f"Failed to claim reward {reward_id}. Error: {e}")
122 123 return None
123 124
124 async def make_chat_private(session: aiohttp.ClientSession, account: Dict[str, Any], chat_id: str) -> bool:
125 async def make_chat_private(session: aiohttp.ClientSession, account: YUPP_ACCOUNT, chat_id: str) -> bool:
125 126 """Set a Yupp chat's sharing status to PRIVATE"""
126 127 try:
127 128 log_debug(f"Setting chat {chat_id} to PRIVATE...")
@@ -233,7 +234,7 @@ class Yupp(AsyncGeneratorProvider, ProviderModelMixin):
233 234 return cls.models
234 235
235 236 @classmethod
236 async def prepare_files(cls, media, session:aiohttp.ClientSession, account:Dict[str, ...])->list:
237 async def prepare_files(cls, media, session:aiohttp.ClientSession, account:YUPP_ACCOUNT)->list:
237 238 files = []
238 239 if not media:
239 240 return files
@@ -440,7 +441,7 @@ class Yupp(AsyncGeneratorProvider, ProviderModelMixin):
440 441 async def _process_stream_response(
441 442 cls,
442 443 response_content,
443 account: Dict[str, Any],
444 account: YUPP_ACCOUNT,
444 445 session: aiohttp.ClientSession,
445 446 prompt: str,
446 447 model_id: str