summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2023-12-06 13:47:22 +0100
committerGitHub <noreply@github.com>2023-12-06 13:47:22 +0100
commit5862d55abf44c3e9bc63b4fe231c80475ec1157d (patch)
tree4e2b1e555878e690444cf0ddbdf97697c5944f0f
parent~ | g4f v-0.1.9.2 (diff)
downloadgpt4free-5862d55abf44c3e9bc63b4fe231c80475ec1157d.tar
gpt4free-5862d55abf44c3e9bc63b4fe231c80475ec1157d.tar.gz
gpt4free-5862d55abf44c3e9bc63b4fe231c80475ec1157d.tar.bz2
gpt4free-5862d55abf44c3e9bc63b4fe231c80475ec1157d.tar.lz
gpt4free-5862d55abf44c3e9bc63b4fe231c80475ec1157d.tar.xz
gpt4free-5862d55abf44c3e9bc63b4fe231c80475ec1157d.tar.zst
gpt4free-5862d55abf44c3e9bc63b4fe231c80475ec1157d.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/Pi.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/g4f/Provider/Pi.py b/g4f/Provider/Pi.py
index 385f477b..529a4a52 100644
--- a/g4f/Provider/Pi.py
+++ b/g4f/Provider/Pi.py
@@ -27,7 +27,10 @@ class Pi(BaseProvider):
session = get_session_from_browser(url=cls.url, proxy=proxy, timeout=timeout)
if not conversation_id:
conversation_id = cls.start_conversation(session)
- answer = cls.ask(session, messages, conversation_id)
+ prompt = format_prompt(messages)
+ else:
+ prompt = messages[-1]["content"]
+ answer = cls.ask(session, prompt, conversation_id)
for line in answer:
if "text" in line:
yield line["text"]
@@ -51,9 +54,9 @@ class Pi(BaseProvider):
raise RuntimeError('Error: Cloudflare detected')
return response.json()
- def ask(session: Session, messages: Messages, conversation_id: str):
+ def ask(session: Session, prompt: str, conversation_id: str):
json_data = {
- 'text': format_prompt(messages),
+ 'text': prompt,
'conversation': conversation_id,
'mode': 'BASE',
}