File size: 1,887 Bytes
cbd58d0 e097d14 3de061f e097d14 3de061f e097d14 3de061f e097d14 3de061f e097d14 98e04a7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# Edge GPT
ChatGPT with internet access
## Requirements
- A Microsoft Account with early access to http://bing.com/chat
- Microsoft Edge
## Setup
### Checking access
- Install the latest version of Microsoft Edge
- Open http://bing.com/chat
- If you see a chat feature, you are good to go
### Getting authentication
- Open the developer tools (F12)
- Go to the Application tab → Storage → Cookies
- Find the cookie named "_U"
- Copy the value of the cookie
- Method 1
- `export BING_U="<COOKIE_VALUE>"`
- Method 2
- Use it as command line argument later
## Installation
- `python3 -m pip install EdgeGPT`
## Demo usage
- If `BING_U` in environment variables: `python3 -m EdgeGPT`
- Else: `python3 -m EdgeGPT "<COOKIE_VALUE>"`
## Developer
Use Async for the best experience
```python
import asyncio
from EdgeGPT import Chatbot
async def main():
"""
Main function
"""
print("Initializing...")
bot = Chatbot()
await bot.start()
while True:
prompt = input("\nYou:\n")
if prompt == "!exit":
break
elif prompt == "!help":
print("""
!help - Show this help message
!exit - Exit the program
!reset - Reset the conversation
""")
continue
elif prompt == "!reset":
await bot.reset()
continue
print("Bot:")
print((await bot.ask(prompt=prompt))["item"]["messages"][1]["text"])
await bot.close()
if __name__ == "__main__":
print(
"""
EdgeGPT - A demo of reverse engineering the Edge GPT chatbot
Repo: github.com/acheong08/EdgeGPT
By: Antonio Cheong
!help for help
Type !exit to exit
Enter twice to send message
"""
)
asyncio.run(main())
```
## Work in progress
- Response streaming (Easily achievable)
- Error handling
|