File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ export async function generateAnswersWithBingWebApi(
2929 jailbreakConversationId : sydneyMode ,
3030 onProgress : ( token ) => {
3131 answer += token
32- // remove reference markers [^number^]
33- answer = answer . replaceAll ( / \[ \^ \d + \^ \] / g, '' )
32+ // reference markers [^number^]
33+ answer = answer . replaceAll ( / \[ \^ ( \d + ) \^ \] / g, '<sup>$1</sup> ' )
3434 port . postMessage ( { answer : answer , done : false , session : null } )
3535 } ,
3636 ...( session . bingWeb_conversationId
@@ -52,6 +52,15 @@ export async function generateAnswersWithBingWebApi(
5252 session . bingWeb_clientId = response . clientId
5353 session . bingWeb_invocationId = response . invocationId
5454
55+ if ( response . details . sourceAttributions . length > 0 ) {
56+ const footnotes =
57+ '\n\\-\n' +
58+ response . details . sourceAttributions
59+ . map ( ( attr , index ) => `\\[${ index + 1 } ]: [${ attr . providerDisplayName } ](${ attr . seeMoreUrl } )` )
60+ . join ( '\n' )
61+ answer += footnotes
62+ }
63+
5564 pushRecord ( session , question , answer )
5665 console . debug ( 'conversation history' , { content : session . conversationRecords } )
5766 port . onMessage . removeListener ( messageListener )
You can’t perform that action at this time.
0 commit comments