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

XFEstudio/gpt4free

Remove unused message formatting function and clean up Yupp account reward claiming logic

bbf3c8e4
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +0 -45
Modified g4f/Provider/Yupp.py +0 -45
@@ -97,38 +97,6 @@ def get_best_yupp_account() -> Optional[Dict[str, Any]]:
97 97 account["last_used"] = now
98 98 return account
99 99
100 def format_messages_for_yupp(messages: List[Dict[str, str]]) -> str:
101 """Format multi-turn conversation for Yupp single-turn format"""
102 if len(messages) == 1:
103 return messages[0].get("content", "").strip()
104
105 formatted = []
106
107 # Handle system messages
108 system_messages = [msg for msg in messages if msg.get("role") == "system"]
109 if system_messages:
110 for sys_msg in system_messages:
111 content = sys_msg.get("content", "")
112 formatted.append(content)
113
114 # Handle user and assistant messages
115 user_assistant_msgs = [msg for msg in messages if msg.get("role") != "system"]
116 for msg in user_assistant_msgs:
117 role = "Human" if msg.get("role") == "user" else "Assistant"
118 content = msg.get("content", "")
119 formatted.append(f"\n\n{role}: {content}")
120
121 # Ensure it ends with Assistant:
122 if not formatted or not formatted[-1].strip().startswith("Assistant:"):
123 formatted.append("\n\nAssistant:")
124
125 result = "".join(formatted)
126 # Remove leading \n\n if present
127 if result.startswith("\n\n"):
128 result = result[2:]
129
130 return result
131
132 100 def claim_yupp_reward(account: Dict[str, Any], reward_id: str):
133 101 """Claim Yupp reward synchronously"""
134 102 try:
@@ -372,19 +340,6 @@ class Yupp(AbstractProvider, ProviderModelMixin):
372 340 response.iter_lines(), account, session, prompt, model_id
373 341 )
374 342
375 session.post("https://yupp.ai/api/trpc/chat.generateRetake?batch=1", data={
376 "0": {
377 "json": {
378 "attachmentIds": files,
379 "chatId": url_uuid,
380 "prompt": prompt,
381 "turnId": turn_id
382 }
383 }
384 }, cookies={
385 "__Secure-yupp.session-token": account["token"]
386 })
387
388 343 @classmethod
389 344 def _process_stream_response(
390 345 cls,