-
Extension for Text Generation Webui based on EdgeGPT by acheong08, a reverse engineered API of Microsoft's Bing Chat AI. Now you can give a sort of Internet access to your characters, easily, quickly and free.
Last tested and working text-generation-webui commit: 0197fdddf106270ccf77fc2757d7bc53cc9729d4.
-
If you have some errors check the known weaknesses and the past issues.
-
Clone oobabooga's original repository and follow the instructions until you can chat with a chatbot.
-
Open the extensions folder and clone here this repo:
git clone https://github.com/GiusTex/EdgeGPT.git
- Enter the
textgen
conda environment using thecmd_windows.bat
/...mac.sh
/etc, then type and run:
pip install -r EdgeGPT/requirements.txt
- (OPTIONAL) Activate the cookies. If you get a captcha error or a login problem try enabling them.
- Open
cmd_windows.bat
(orLinux
ormacOS
depending on the platform you have) and typepip install EdgeGPT
. - Go in the EdgeGPT extension folder, copy the path, then in the
cmd.bat
file typecd your\copied\path
, press enter then typegit pull
.
- Option to use changeable keyword to activate Bing, or use it always
- 5 debug buttons to show or print different parts of the prompt
- Works in chat-mode, so you can use your desired characters
- Editable Bing context within the webui
- Bing conversation style (creative,balanced,precise)
- Added an option to use cookies
Start the prompt with Hey Bing, the default keyword to activate Bing when you need, and Bing will search and give an answer, that will be fed to the character memory before it answers you.
If the bot answer doesn't suit you, you can turn on "Show Bing Output" to show the Bing output in the webui, sometimes it doesn't answer well and need better search words.
You can also print in the console other prompt parts (user input, whole prompt, "raw" Bing output, Bing output + custom context):
It works with "chat, streaming, non-streaming, listen" modes.
Change the Bing activation word within the webui, from EdgeGPT options (punctuation marks are not supported, they give error).
Now you can customize the context around the Bing output.
Added Overwrite Activation Word, while this is turned on Bing will always answer you without the need of an activation word, if you don't want to mess your prompt with a keyword that doesn't fit in.
You can choose 3 Bing conversation styles between
creative
,balanced
orprecise
from EdgeGPT options.
Since many people had login issues, now there is an option to use cookies, thanks to Simplegram and some other edits of mine, you can turn them on from EdgeGPT options. To use them follow the instructions here.
Inside the function "input_modifier" the code looks for the chosen word:
BingOutput = re.search(ChosenWord, UserInput)
Then, if it finds it, it adds it to "custom_generate_chat_prompt" at line 172 and then it calls the function:
#Adding BingString
async def EdgeGPT():
global UserInput
global RawBingString
global PrintRawBingString
bot = await Chatbot.create()
response = await bot.ask(prompt=UserInput, conversation_style=ConversationStyle.creative)
# Select only the bot response from the response dictionary
for message in response["item"]["messages"]:
if message["author"] == "bot":
bot_response = message["text"]
# Remove [^#^] citations in response
RawBingString = re.sub('\[\^\d+\^\]', '', str(bot_response))
await bot.close()
return RawBingString
# Different ways to run the same EdgeGPT function:
# From chosen word
if(BingOutput!=None) and not OverwriteWord:
asyncio.run(EdgeGPT())
# of from OverwriteWord button
elif OverwriteWord:
asyncio.run(EdgeGPT())
# When Bing has given his answer we print (if requested) and save the output
if RawBingString != None and not "":
# Add Bing output to character memory
rows.append(BingString)
And at the end it takes RawBingString and adds it Bing context (useful to tell the character what to do with the informations), generating BingString. If you want you can also change the context around the RawBingString from the webui within EdgeGPT options > EdgeGPT context, to better suit your desidered answer.
Being still a new application, you are welcome to make tests to find your optimal result, be it clearing the conversation, changing the context around the Bing output, or something else.
- Sometimes the character ignores the Bing output, even if it is in his memory, in this case asking "Can you repeat me [whatever you asked]" may help.
- The character could start his answer with
:
, but after some messages it goes away.
You can read about the same problem here. Removing --listen
helped a bit (the error showed up less frequently); if you are using notebook
mode it may not work.
If you get a captcha error
you have to write something on bing.com-chat to complete the captcha, if then you still get the error you can use the cookies option
(after writing something on bing.com-chat
).
Now you need to always activate the cookies. One of the obabooga commits made the extension always gives the captcha error if cookies are not used.
If you get this error, update the webui state (delete the chat; close the webui; reload the model, etc. Basically do something after the error). Today Edgegpt worked again without cookies, while I got the error using them, so you can try not using them and see if it works.
There was a Colab notebook before, you can still get and download it from this commit, but sometimes the IP is blocked (Authentication failed
, link), and sometimes it works but you get another error, so in the end I removed and won't support it. You are free to edit and share it if you want.
Pull requests, suggestions and bug reports are welcome, but as I'm not a programmer I can't guarantee I'll be of help.