Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bing): add functionality for receiving internal queries #451

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 46 additions & 9 deletions src/BingAIClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,25 +332,55 @@ export default class BingAIClient {
const obj = {
arguments: [
{
source: 'cib',
optionsSets: [
'nlu_direct_response_filter',
'deepleo',
'disable_emoji_spoken_text',
'responsible_ai_policy_235',
'enablemm',
toneOption,
'dtappid',
'cricinfo',
'cricinfov2',
'dv3sugg',
'nojbfedge',
// 'autosave', // Saves conversations to vanilla bing conversation history
'iyxapbing',
'iycapbing',
toneOption,
'clgalileo',
...((toneStyle === 'creative' && this.options.features.genImage) ? ['gencontentv3'] : []),
'fluxsrtrunc',
'fluxtrunc',
'fluxv1',
'rai278',
'replaceurl',
// 'savemem', // Saves conversations to vanilla bing conversation history
// 'savememfilter', // Saves conversations to vanilla bing conversation history
'eredirecturl',
'nojbfedge', // Not included in standard message, but won't work without.
],
allowedMessageTypes: [
'ActionRequest',
'Chat',
'Context',
'InternalSearchQuery',
'InternalSearchResult',
// 'Disengage', unwanted
'InternalLoaderMessage',
'Progress',
'RenderCardRequest',
// 'AdsQuery', unwanted
// 'SemanticSerp',// usually not encountered, related to semantic web search
'GenerateContentQuery',
'SearchQuery',
],
sliceIds: [
'222dtappid',
'225cricinfo',
'224locals0',
'abv2',
'srdicton',
'convcssclick',
'stylewv2',
'contctxp2tf',
'802fluxv1pc_a',
'806log2sphs0',
'727savemem',
'277teditgnds0',
'207hlthgrds0',
],
traceId: genRanHex(32),
isStartOfSession: invocationId === 0,
Expand Down Expand Up @@ -453,6 +483,13 @@ export default class BingAIClient {
});
return;
}
// Usable later when displaying internal processes, but should be discarded for now.
if (messages[0]?.messageType === 'InternalLoaderMessage'
|| messages[0]?.messageType === 'InternalSearchQuery'
|| messages[0]?.messageType === 'InternalSearchResult'
|| messages[0]?.messageType === 'GenerateContentQuery') {
return;
}
const updatedText = messages[0].text;
if (!updatedText || updatedText === replySoFar) {
return;
Expand Down