summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/GptForLove.py
diff options
context:
space:
mode:
authorTekky <98614666+xtekky@users.noreply.github.com>2023-10-14 15:36:47 +0200
committerGitHub <noreply@github.com>2023-10-14 15:36:47 +0200
commit8bdbb9e9cda7901c3bfc23de2f9f44b3f2e3d1e5 (patch)
tree5f205c79c060098f056a9e1460b872696de5871c /g4f/Provider/GptForLove.py
parentMerge branch 'main' of https://github.com/xtekky/gpt4free (diff)
parentFix Opchatgpts and ChatForAi Provider (diff)
downloadgpt4free-8bdbb9e9cda7901c3bfc23de2f9f44b3f2e3d1e5.tar
gpt4free-8bdbb9e9cda7901c3bfc23de2f9f44b3f2e3d1e5.tar.gz
gpt4free-8bdbb9e9cda7901c3bfc23de2f9f44b3f2e3d1e5.tar.bz2
gpt4free-8bdbb9e9cda7901c3bfc23de2f9f44b3f2e3d1e5.tar.lz
gpt4free-8bdbb9e9cda7901c3bfc23de2f9f44b3f2e3d1e5.tar.xz
gpt4free-8bdbb9e9cda7901c3bfc23de2f9f44b3f2e3d1e5.tar.zst
gpt4free-8bdbb9e9cda7901c3bfc23de2f9f44b3f2e3d1e5.zip
Diffstat (limited to 'g4f/Provider/GptForLove.py')
-rw-r--r--g4f/Provider/GptForLove.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/g4f/Provider/GptForLove.py b/g4f/Provider/GptForLove.py
index 01cef443..9f7156b2 100644
--- a/g4f/Provider/GptForLove.py
+++ b/g4f/Provider/GptForLove.py
@@ -42,11 +42,10 @@ class GptForLove(AsyncGeneratorProvider):
data = {
"prompt": prompt,
"options": {},
- "systemMessage": "You are ChatGPT, the version is GPT3.5, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.",
- "temperature": 0.8,
- "top_p": 1,
+ "systemMessage": kwargs.get("system_message", "You are ChatGPT, the version is GPT3.5, a large language model trained by OpenAI. Follow the user's instructions carefully."),
+ "temperature": kwargs.get("temperature", 0.8),
+ "top_p": kwargs.get("top_p", 1),
"secret": get_secret(),
- **kwargs
}
async with session.post("https://api.gptplus.one/chat-process", json=data, proxy=proxy) as response:
response.raise_for_status()
@@ -67,9 +66,9 @@ class GptForLove(AsyncGeneratorProvider):
def get_secret() -> str:
dir = os.path.dirname(__file__)
- dir += '/npm/node_modules/crypto-js'
+ include = dir + '/npm/node_modules/crypto-js/crypto-js'
source = """
-CryptoJS = require('{dir}/crypto-js')
+CryptoJS = require({include})
var k = '14487141bvirvvG'
, e = Math.floor(new Date().getTime() / 1e3);
var t = CryptoJS.enc.Utf8.parse(e)
@@ -79,5 +78,5 @@ var t = CryptoJS.enc.Utf8.parse(e)
});
return o.toString()
"""
- source = source.replace('{dir}', dir)
+ source = source.replace('{include}', json.dumps(include))
return execjs.compile(source).call('')