Support multiple message combination #12
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The main purpose of the modification is to support the 'Disangaged' message so that I know when to reset a conversation.
The 'Disangaged' message indicates that Bing AI has closed a conversation. After that, any question in this conversation will not be answered.
The 'Disengaged' messages and normal 'Chat' messages are different elements in the message array. Here is an example of a reply message array.
In
BingChatConversation.GetAnswer
method, only the last 'Chat' message will be parsed, resulting in the loss of other messages.So my plan is to combine multiple message contents in order.
Since there is no display text in the 'Disangaged' message, I used the 'MessageType' tag instead. The caller may replace it with readable text.
Other messages such as 'InternalSearchQuery' and 'InternalLoaderMessage' will also be output. I think watching AI searching internet is also a kind of fun. This combination may also be helpful for outputting 'GenerateContentQuery' messages in the future, such as image generation, as it is also multiple messages.
I also made some adjustments to the parsing of 'Chat' messages. Currently, the main content from 'Text' and the referenced content from 'sourceAttributes' will be combined, with the latter becoming footnotes.