danny-avila / LibreChat

Enhanced ChatGPT Clone: Features Anthropic, AWS, OpenAI, Assistants API, Azure, Groq, o1, GPT-4o, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, langchain, DALL-E-3, ChatGPT Plugins, OpenAI Functions, Secure Multi-User System, Presets, completely open-source for self-hosting. Actively in public development.
https://librechat.ai/
MIT License
18.5k stars 3.11k forks source link

[error]: /turing/conversation/create: failed to parse response body #370

Closed leoleaf closed 1 year ago

leoleaf commented 1 year ago

hello, guys. this project is really fantastic, i have been using it for a while time. but,yesterday,when i asked bingAI,it returned a error. Have you ever see this error?

An error occurred. Please try again in a few moments. Error message: /turing/conversation/create: failed to parse response body. <!DOCTYPE html> ...

response body is a html. i put it into chrome. the follow is something which chrome show. image

danny-avila commented 1 year ago

Hi, yes it seems Bing has updated something on their end but I have a solution for you. Update the project to latest on main branch, I also posted this here: https://github.com/waylaidwanderer/node-chatgpt-api/issues/378#issuecomment-1559868368 and updated the project accordingly here #369

You will need to set BINGAI_TOKEN in your ./api/.env file (or in your browser if using "user_provided") to your full cookies string from bing.com, instead of just the U= value.

This is confirmed working for me

image

Using firefox and dev tools, i get my cookies string from here:

image


You can use any browser, just fish around in the network tab to see which request has a Cookie value in the Request headers

image

Thanks for checking out the project, I'm glad you're enjoying it!

danny-avila commented 1 year ago

@feng2505664393 let me know if the above worked for you

There were also some other suggestions at the bottom of this issues page https://github.com/waylaidwanderer/node-chatgpt-api/issues/378

leoleaf commented 1 year ago

@feng2505664393 let me know if the above worked for you

There were also some other suggestions at the bottom of this issues page waylaidwanderer/node-chatgpt-api#378

Sorry, sir. I used an old version of chat-clone. In order to try the solution you provided, I had to update my Docker image. It took me some time, but the exciting thing is that I just finished all the work on the solution and it works! Hahaha, thank you.

danny-avila commented 1 year ago

Awesome, glad to help!

rraymondgh commented 10 months ago

if like me you do not like manual steps to derive BING_API_TOKEN configuration, this can be automated

if __name__ == "__main__":
    token = get_bing_api_token("username", "password")
    print(token)
python selenium function to get BING_API_TOKEN ``` from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import TimeoutException as STimeout from http.cookies import SimpleCookie import json import time def get_bing_api_token( username, password, headless=True, remote_selenium="http://localhost:4444", wait=10, json_outfile="bing_cookie.json", ): options = webdriver.ChromeOptions() options.set_capability("goog:loggingPrefs", {"performance": "ALL"}) if headless: options.add_argument("headless") # Run browser in headless mode # Create a new WebDriver instance with Docker driver = webdriver.Remote(remote_selenium, options=options) # Open Bing driver.get("https://www.bing.com") #