Coder Social home page Coder Social logo

bingchat's Introduction

Hi, I'm B/Syn, a.k.a. bs,

A Full Stack <Developer/>

WakaTime

C OK C# OK TypeScript OK Python OK
C++ Learning Kotlin Learning


Moe Counter

bingchat's People

Contributors

awbugl avatar bsdayo avatar caulm avatar neon-sunset avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bingchat's Issues

BingChat.BingChatException HResult=0x80131500 Message=UnauthorizedRequest: The conversationSignature is not set and is required to ensure that you have permission to use our APIs. IsAuthenticated=False. App ID= Source=BingChat

BingChat.BingChatException
HResult=0x80131500
Message=UnauthorizedRequest: The conversationSignature is not set and is required to ensure that you have permission to use our APIs. IsAuthenticated=False. App ID=
Source=BingChat
StackTrace:
於 BingChat.BingChatConversation.BuildAnswer(ChatResponse response)
於 BingChat.BingChatConversation.d__5.MoveNext()
於 BingChat.BingChatConversation.d__5.MoveNext()
於 BingChat.BingChatClient.d__3.MoveNext()
於 Program.<

$>d__0.MoveNext() 在 C:\Users\USER\source\repos\bingchat_test\bingchat_test\Program.cs:行 86 中

此例外狀況原先在此呼叫堆疊擲回:
[外部程式碼]
Program.

$(string[]) 位於 Program.cs

我已經嘗試過作者所教UnauthorizedRequest的所有方法,除了proxy(但是我並非是在bing不支援的地區),而且我昨天都還能一次大量的傳送訊息,或如過超量使用其他的帳號,但今天晚上卻都不行使用了,僅能問一點點問題,就會遇到UnauthorizedRequest,我該怎麼辦?

謝謝!

I have tried all the methods mentioned by the author to resolve the UnauthorizedRequest issue, except for using a proxy (however, I am not in a region where Bing is unsupported). Also, yesterday I was able to send a large number of queries, even exceeded the limit using other accounts. However, tonight, I'm unable to use the service as usual. I can only ask a few questions before encountering the UnauthorizedRequest error. What should I do?

(而且奇怪的是,我有些edge帳號,可能因為問太多問題而被禁,然而其中有一個我根本沒問幾個問題(應該不到20)也被禁?我問的問題並沒有違反bing chat的條款?而且在嘗試使用正常的帳號也不行使用,非常奇怪?)

Thank you!

Code doesn't work in the CLI

System.NullReferenceException: Object reference not set to an instance of an object
at BingChat.BingChatConversation.g__GetAnswer|3_1(BingChatConversationResponse response)
at BingChat.BingChatConversation.<>c__DisplayClass3_0.g__OnMessageReceived|2(String text)
--- End of stack trace from previous location ---
at HelloWold.Program.ComposeAnswerAsync(String request)
at System.Threading.Tasks.Task.<>c.b__128_1(Object state)
at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()

Project maintenance status

Hi @bsdayo , I have noticed you pushed an update that this library is now in maintenance mode.

I would like to help with this (well, at least solve a couple of old issues with formatting).

request option to have results returned in json format

When I issue the following query directly in bing chat I get a nicely formated json result. When I use BingChat class it returns only as text. It would be nice to have the option to have the results returned exactly as output by bing chat rather than converted to text.

string query = $"what are the book sereis related to {keyword}, return results in json format with the variables title, description, author and number of books in series";

Configurable country/region settings

English information sources are always applied when searching for non-English content.
Haven't looked closely but guess that accept-language header and/or _tarLang, _EDGE_CD, WLS and SRCHHPGUSR cookies are related to this.

I'm getting a BingChatException: 'Success'

I have added BingChat to my project and copied my bing.com's "_U" cookie value, but when I try to run var answer = await client.AskAsync("Whats the weather like?"); I get this error: BingChat.BingChatException: 'Success: .'

How would I go about fixing this?

Captcha Challenge

Hello,

Bing started to give captcha challenge.

image

image

Is there anyway to fix it?

Simple response streaming

Problem Statement

As of now, it can take more than 60 seconds to get final response if the user query requires BingChat to search for information or conduct any other intermediate actions

Proposed Change

Adjust API surface to allow the user to either stream intermediate response state or opt in to await the final response.

Discussion

Because Bing Chat implementation is world-class, it does not bother with trivialities such as efficiency, saving bandwidth or having an event type to send response parts over websocket (and cancel previous output where BC refuses to honor user prompt) and instead just re-sends the whole thing instead (see below).

This creates an issue where we can't just expose IAsyncEnumerable<string> because it can confuse the users of the library by sending the same message with extra words appended, making for cumbersome user experience. Thus, I'm creating this issue for feedback while I'm trying out a couple of prototypes to encapsulate the response into a public type ConversationResponse (placeholder) so that the users can either explicitly .GetCompletedResponse() or .ReadIntermediateMessages() (also placeholders).

Ideally, I want to make it more user-friendly than what WSS API exposes by detecting whether we're still receiving the continuations of the previous response message or if BingChat decided to completely rewrite it so that the user can just Console.Write(msg) until it is done.

Let me know what you think.

Example WSS output (cut out for brevity):

t":"Generating answers for you...","hiddenText":"Generating answers for you...","
18:32:33.849
{"type":1,"target":"update","arguments":[{"cursor":{"j":"$['cb8f7fa8-4055-4452-9a
18:32:33.858
{"type":1,"target":"update","arguments":[{"messages":[{"text":"The","author":"bot
18:32:33.864
{"type":1,"target":"update","arguments":[{"messages":[{"text":"The weather","auth
18:32:33.864
{"type":1,"target":"update","arguments":[{"messages":[{"text":"The weather in","a
18:32:33.864
{"type":1,"target":"update","arguments":[{"messages":[{"text":"The weather in Ky"

CaptchaChallange without _U Cookie?

After all, it is possible to chat with Bing in other browsers and without logging in.
I am trying to understand how to show Bing that you have solved a catcha when you are not logged in and there is no _U cookie.
Does anyone know what cookies or headers are set when a captcha is solved?

Publish BingChat.Cli as tool to nuget

Publishing BingChat.Cli as tool would allow for dotnet tool install -g BingChat.Cli without having to build it and add to $PATH manually.

(also, version 0.8.0 when?😅)

Timout until chat session expires?

Hi, in the roadmap description it says that it is possible to set a timeout. Unfortunately I didn't find any option in this context in the current version of the library. Is this implementation not checked in yet? I would be interested in how long you have until the chat session expires if you don't make a request and is it possible to configure this timeout?

InternalError exception

I can often catch this exception.
InternalError: Unhandled Dependency Failure: DeepLeo

The text is part of the response message, which the websocket client received from the server. (see below)

{
    "type": 2,
    "invocationId": "1",
    "item": {
        "firstNewMessageIndex": null,
        "defaultChatName": null,
        "conversationId": "51D|BingProdUnAuthenticatedUsers|E7D ... 284",
        "requestId": "88e6dd8c-2cae-49e4-aef4-223d27f69487",
        "telemetry": { },
        "result": {
            "value": "InternalError",
            "message": "Unhandled Dependency Failure: DeepLeo",
            "error": "Unhandled Dependency Failure: DeepLeo\n ---> ServiceClient failure for DeepLeo",
            "exception": "Microsoft.TuringBot.Common.ServiceInternalError: Unhandled Dependency Failure: DeepLeo\r\n ---> Microsoft.TuringBot.Common.ServiceClientException: ServiceClient failure for DeepLeo\r\n ---> System.Net.Http.HttpRequestException: Failed to call \"DeepLeo\" at \"SelectedByPapyrusLoadBalancer\"...(some call stack information)...",
            "serviceVersion": "20230518.47"
        }
    }
}

It seems to appear once in every 5 questions on average. If I asked the same question again, it can answer. I'm not sure if it's just for me, or if it's a network issue.

If you have any solutions or clues, please let me know. Thank you.

UnauthorizedRequest

Is someone else getting this Error?

UnauthorizedRequest

"The conversationSignature is not set and is required to ensure that you have permission to use our APIs. IsAuthenticated=False. App ID="

Edit: If I comparing the current payload on Bing, it seems that "ConversationSignature" is not send in the payload anymore and it is also missing in the new conversation response. I removed the attribute from the payload, but still get this error. So, the create call still works, only when creating the websocket connection there are problems. I can't figure out why this doesn't work with the modified payload. Is anyone here more familiar with websockets?

CaptchaChallenge: User needs to solve CAPTCHA to continue.

when I run it I receive

BingChat.BingChatException
HResult=0x80131500
Message=CaptchaChallenge: User needs to solve CAPTCHA to continue.
Source=BingChat
StackTrace:
at BingChat.BingChatConversation.BuildAnswer(ChatResponse response)
at BingChat.BingChatConversation.d__5.MoveNext()
at BingChat.BingChatConversation.d__5.MoveNext()
at BingChat.BingChatClient.d__3.MoveNext()
at BingChat_test.Program.

d__0.MoveNext() in C:\Users\Kevin\source\repos\BingChat-test\Program.cs:line 19
at BingChat_test.Program.(String[] args)

About www.bing.com/turing/conversation/create result judgment

The return on this site looks like that
QQ截图20230322233945

This judgment is always true
QQ截图20230322235212

I skipped this judgment, it works properly
QQ截图20230322233745

Maybe a judgment value not equal to "Success" should be added?

        if (response!.Result is { } errResult && !errResult.Value.Equals("Success", StringComparison.OrdinalIgnoreCase))

CLI reply missing source attributions

I noticed that the CLI reply containes citation numbers, like "[^1^]", but does not contain the source attribution link. It looks a bit strange. I'm not sure if this is intentional.

Does it need an option to control whether citations are displayed or hidden?

- displayed: For users who want to read the source page for detailed information.
- hidden: For users who want to chat or get direct answers.

UnauthorizedRequest Exception

Message

UnauthorizedRequest: Sorry, you need to login first to access this service.. If you confirm that the correct cookie is set and you still keep seeing this, maybe Bing doesn't serve your region. You can use a proxy and try again.

I have added "bing.com" to my VPN pac list, and I can access Bing AI in Edge browser.
I have set the cookie and proxy in code like tihs. The exception still exist.

HttpClient.DefaultProxy = new WebProxy("127.0.0.1:8807"); //local proxy
var client = new BingChatClient(new BingChatClientOptions
{
    Cookie = File.ReadAllText(cookiePath),
});
var conversation = await client.CreateConversation();

Question repeated in CLI reply

Just like the preview in README, some times Bing's reply will repeat the question.

preview

Not sure if Bing's reply itself contains these, I'll check it out when I have enough time

Error When Using CLI

Current behavior

After sending a message, the following error is thrown:
Error: Object reference not set to an instance of an object.
Then the program crashes.

Expected Behavior:

Bing AI responds to user message.

Reproduction steps:

  1. Open command prompt at root
  2. Run dotnet run --project src/BingChat.Cli/BingChat.Cli.csproj
  3. Type in anything and hit enter
  4. Notice the error message after

Log

Welcome to Bing Chat!
Enter message to chat with Bing, or enter /help to get command help.
[REDACTED]
Creating new conversation...
Error: Object reference not set to an instance of an object.

Closing Notes:

  • At the time the error was thrown, my daily limit was already met
  • This was done on a fresh install with the environment variable set
  • OS: Windows 11 Home

Very interesting API though. Curious to see if it can get through the censoring.

UnauthorizedRequest:I can ask 1 to 5 questions, but I can't ask any more after that. Why?

BingChat.BingChatException
HResult=0x80131500
Message=UnauthorizedRequest: The conversationSignature is not set and is required to ensure that you have permission to use our APIs. IsAuthenticated=False. App ID=
Source=BingChat
StackTrace:
於 BingChat.BingChatConversation.BuildAnswer(ChatResponse response)
於 BingChat.BingChatConversation.d__5.MoveNext()
於 BingChat.BingChatConversation.d__5.MoveNext()
於 BingChat.BingChatClient.d__3.MoveNext()
於 Program.<

$>d__0.MoveNext() 在 C:\Users\USER\source\repos\bingchat_test\bingchat_test\Program.cs:行 86 中

我已經嘗試過作者所教UnauthorizedRequest的所有方法,除了proxy(但是我並非是在bing不支援的地區),而且我昨天都還能一次大量的傳送訊息,或如過超量使用其他的帳號,但今天晚上卻都不行使用了,僅能問一點點問題,就會遇到UnauthorizedRequest,我該怎麼辦?

謝謝!

I have tried all the methods mentioned by the author to resolve the UnauthorizedRequest issue, except for using a proxy (however, I am not in a region where Bing is unsupported). Also, yesterday I was able to send a large number of queries, even exceeded the limit using other accounts. However, tonight, I'm unable to use the service as usual. I can only ask a few questions before encountering the UnauthorizedRequest error. What should I do?

Thank you!

Cookie no longer Required

Since the public release of New Bing the cookie field is no longer required. For the mean time just putting anything in the CookieU field allows you to chat but there should be the option to leave the cookie as null

CLI The server returned status code '200' when status code '101' was expected.

System.Net.WebSockets.WebSocketException: The server returned status code '200' when status code '101' was expected.
at async Task System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, CancellationToken cancellationToken,
ClientWebSocketOptions options)
at async Task System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, CancellationToken cancellationToken)
at async ValueTask Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.
DefaultWebSocketFactory(WebSocketConnectionContext context, CancellationToken cancellationToken)
at async Task Microsoft.AspNetCore.Http.Connections.Client.Internal.WebSocketsTransport.StartAsync(Uri url,
TransferFormat transferFormat, CancellationToken cancellationToken)
at async Task Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartTransport(Uri connectUrl,
HttpTransportType transportType, TransferFormat transferFormat, CancellationToken cancellationToken)
at async Task Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.SelectAndStartTransport(TransferFormat
transferFormat, CancellationToken cancellationToken)
at async Task Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsyncCore(TransferFormat transferFormat
, CancellationToken cancellationToken)
at async Task Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsync(TransferFormat transferFormat,
CancellationToken cancellationToken)
at async ValueTask Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync(
EndPoint endPoint, CancellationToken cancellationToken)
at async ValueTask Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync(
EndPoint endPoint, CancellationToken cancellationToken)
at async Task Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncCore(CancellationToken cancellationToken)
at async Task Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncInner(CancellationToken cancellationToken)
at async Task Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsync(CancellationToken cancellationToken)
at async Task BingChat.BingChatConversation.Connect(CancellationToken ct) in
/home/runner/work/BingChat/BingChat/src/BingChat/BingChatConversation.cs:181
at async IAsyncEnumerable BingChat.BingChatConversation.StreamAsync(string message, CancellationToken ct) in
/home/runner/work/BingChat/BingChat/src/BingChat/BingChatConversation.cs:74
at async IAsyncEnumerable BingChat.BingChatConversation.StreamAsync(string message, CancellationToken ct)
at void BingChat.Cli.Utils.<>c__DisplayClass3_0.<b__0>d.MoveNext() in
/home/runner/work/BingChat/BingChat/src/dotnet-bingchat/Utils.cs:79
at void BingChat.Cli.Utils.<>c__DisplayClass3_0.<b__0>d.MoveNext() in
/home/runner/work/BingChat/BingChat/src/dotnet-bingchat/Utils.cs:79
at void Spectre.Console.LiveDisplay.<>c__DisplayClass17_0.<b__0>d.MoveNext() in
//src/Spectre.Console/Live/LiveDisplay.cs:80
at void Spectre.Console.LiveDisplay.<>c__DisplayClass18_0`1.<b__0>d.MoveNext() in
/
/src/Spectre.Console/Live/LiveDisplay.cs:110

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.