Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
/ EdgeGPT Public archive

Extension for Text Generation Webui based on EdgeGPT, a reverse engineered API of Microsoft's Bing Chat AI

Notifications You must be signed in to change notification settings

GiusTex/EdgeGPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EdgeGPT

  • 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.

Table of contents

How to Run

How to update

Features

How it works

Weaknesses and known errors

Contributing

Credits and inspiration

How to Run

  1. Clone oobabooga's original repository and follow the instructions until you can chat with a chatbot.

  2. Open the extensions folder and clone here this repo:

git clone https://github.com/GiusTex/EdgeGPT.git
  1. Enter the textgen conda environment using the cmd_windows.bat/...mac.sh/etc, then type and run:
pip install -r EdgeGPT/requirements.txt
  1. (OPTIONAL) Activate the cookies. If you get a captcha error or a login problem try enabling them.

How to update

  • Open cmd_windows.bat (or Linux or macOS depending on the platform you have) and type pip install EdgeGPT.
  • Go in the EdgeGPT extension folder, copy the path, then in the cmd.bat file type cd your\copied\path, press enter then type git pull.

Features

  • 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

Keyword

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.

Debug buttons

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):

Chat-mode

It works with "chat, streaming, non-streaming, listen" modes.

Change keyword

Change the Bing activation word within the webui, from EdgeGPT options (punctuation marks are not supported, they give error).

Edit Bing context

Now you can customize the context around the Bing output.

Overwrite Activation Word

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.

Bing conversation style

You can choose 3 Bing conversation styles between creative, balanced or precise from EdgeGPT options.

Cookies

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.

How it works

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.

Weaknesses:

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.

KeyError: 'adaptiveCards'

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.

Captcha error

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.

KeyError: 'conversationSignature'

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.

Colab

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.

Contributing

Pull requests, suggestions and bug reports are welcome, but as I'm not a programmer I can't guarantee I'll be of help.

Credits and inspiration

  • acheong08 for his amazing default EdgeGPT.
  • The tutorial video by Ai Austin, where he shows the code to install EdgeGPT and use it, and gave me a bit of inspiration.
  • You.

Star History Chart

About

Extension for Text Generation Webui based on EdgeGPT, a reverse engineered API of Microsoft's Bing Chat AI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages