File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
ts/packages/dispatcher/src/search Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,8 @@ async function runEntityExtraction(
254
254
return [ ] ;
255
255
}
256
256
let entityText = "" ;
257
+ let linkEntities : Array < Entity > = [ ] ;
258
+ let refCount = 0 ;
257
259
for ( const message of messages ) {
258
260
for ( const content of message . content ) {
259
261
const textContent = content as MessageTextContent ;
@@ -266,6 +268,10 @@ async function runEntityExtraction(
266
268
case "url_citation" :
267
269
const url = a as MessageTextUrlCitationAnnotation ;
268
270
entityText += `Reference: ${ url . urlCitation . title } - ${ url . urlCitation . url } ` ;
271
+ linkEntities . push ( {
272
+ type : [ "link" , "url" , "website" ] ,
273
+ name : `Reference #${ ++ refCount } - ${ url . urlCitation . title } - ${ url . urlCitation . url } ` ,
274
+ } ) ;
269
275
break ;
270
276
default :
271
277
console . warn (
@@ -282,8 +288,11 @@ async function runEntityExtraction(
282
288
if ( entityText . length > settings . maxEntityTextLength ) {
283
289
entityText = entityText . slice ( 0 , settings . maxEntityTextLength ) ;
284
290
}
285
- const results = await extractEntities ( settings . entityGenModel , entityText ) ;
286
- return results ;
291
+
292
+ return [
293
+ ...( await extractEntities ( settings . entityGenModel , entityText ) ) ,
294
+ ...linkEntities ,
295
+ ] ;
287
296
}
288
297
289
298
let groundingConfig : bingWithGrounding . ApiSettings | undefined ;
You can’t perform that action at this time.
0 commit comments