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(
29
29
jailbreakConversationId : sydneyMode ,
30
30
onProgress : ( token ) => {
31
31
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> ' )
34
34
port . postMessage ( { answer : answer , done : false , session : null } )
35
35
} ,
36
36
...( session . bingWeb_conversationId
@@ -52,6 +52,15 @@ export async function generateAnswersWithBingWebApi(
52
52
session . bingWeb_clientId = response . clientId
53
53
session . bingWeb_invocationId = response . invocationId
54
54
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
+
55
64
pushRecord ( session , question , answer )
56
65
console . debug ( 'conversation history' , { content : session . conversationRecords } )
57
66
port . onMessage . removeListener ( messageListener )
You can’t perform that action at this time.
0 commit comments