python3 -m pip install EdgeGPT --upgrade
$ python3 -m EdgeGPT -h EdgeGPT - A demo of reverse engineering the Bing GPT chatbot Repo: github.com/acheong08/EdgeGPT By: Antonio Cheong !help for help Type !exit to exit Enter twice to send message or set --enter-once to send one line message usage: EdgeGPT.py [-h] [--enter-once] [--no-stream] [--style {creative,balanced,precise}] --cookie-file COOKIE_FILE options: -h, --help show this help message and exit --enter-once --no-stream --style {creative,balanced,precise} --cookie-file COOKIE_FILE
传入饼干的三种方式:
环境变量:。
export COOKIE_FILE=/path/to/cookies.json
在参数中指定路径,如下所示:
cookies.json
cookiePath
bot = Chatbot(cookiePath='./cookie.json')
直接通过参数传入 cookie ,如下所示:
cookies
with open('./cookie.json', 'r') as f:
cookies = json.load(f)
bot = Chatbot(cookies=cookies)
使用异步获得最佳体验
更高级用法示例的参考代码:
import asyncio
from EdgeGPT import Chatbot, ConversationStyle
async def main():
bot = Chatbot()
print(await bot.ask(prompt="Hello world", conversation_style=ConversationStyle.creative))
await bot.close()
if __name__ == "__main__":
asyncio.run(main())
这个项目的存在要归功于所有做出贡献的人。