( citations: CitationResponse[] | undefined, )
| 525 | }; |
| 526 | |
| 527 | const toCitationMap = ( |
| 528 | citations: CitationResponse[] | undefined, |
| 529 | ): Map<string, CitationResponse[]> => { |
| 530 | const map = new Map<string, CitationResponse[]>(); |
| 531 | citations?.forEach((c) => { |
| 532 | const list = map.get(c.chatMessageId); |
| 533 | if (list) { |
| 534 | list.push(c); |
| 535 | } else { |
| 536 | map.set(c.chatMessageId, [c]); |
| 537 | } |
| 538 | }); |
| 539 | |
| 540 | return map; |
| 541 | }; |