summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/Aichat.py
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/Provider/Aichat.py')
-rw-r--r--g4f/Provider/Aichat.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/g4f/Provider/Aichat.py b/g4f/Provider/Aichat.py
index 62954e07..59640533 100644
--- a/g4f/Provider/Aichat.py
+++ b/g4f/Provider/Aichat.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import requests
from ..typing import Any, CreateResult
@@ -15,10 +17,8 @@ class Aichat(BaseProvider):
messages: list[dict[str, str]],
stream: bool, **kwargs: Any) -> CreateResult:
- base = ""
- for message in messages:
- base += "%s: %s\n" % (message["role"], message["content"])
- base += "assistant:"
+ chat = "\n".join(f"{message['role']}: {message['content']}" for message in messages)
+ chat += "\nassistant: "
headers = {
"authority": "chat-gpt.org",