返回提交历史
Modified
g4f/Provider/Pi.py
+6
-3
XFEstudio/gpt4free
Update Pi.py
5862d55a
代码差异
1 个文件
+6
-3
@@ -27,7 +27,10 @@ class Pi(BaseProvider):
27
27
session = get_session_from_browser(url=cls.url, proxy=proxy, timeout=timeout)
28
28
if not conversation_id:
29
29
conversation_id = cls.start_conversation(session)
30
answer = cls.ask(session, messages, conversation_id)
30
prompt = format_prompt(messages)
31
else:
32
prompt = messages[-1]["content"]
33
answer = cls.ask(session, prompt, conversation_id)
31
34
for line in answer:
32
35
if "text" in line:
33
36
yield line["text"]
@@ -51,9 +54,9 @@ class Pi(BaseProvider):
51
54
raise RuntimeError('Error: Cloudflare detected')
52
55
return response.json()
53
56
54
def ask(session: Session, messages: Messages, conversation_id: str):
57
def ask(session: Session, prompt: str, conversation_id: str):
55
58
json_data = {
56
'text': format_prompt(messages),
59
'text': prompt,
57
60
'conversation': conversation_id,
58
61
'mode': 'BASE',
59
62
}