mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
refac/fix: source citation
This commit is contained in:
parent
e023a98f11
commit
a28ca30519
1 changed files with 4 additions and 1 deletions
|
|
@ -70,7 +70,10 @@ export const replaceTokens = (content, sourceIds, char, user) => {
|
||||||
if (Array.isArray(sourceIds)) {
|
if (Array.isArray(sourceIds)) {
|
||||||
sourceIds.forEach((sourceId, idx) => {
|
sourceIds.forEach((sourceId, idx) => {
|
||||||
const regex = new RegExp(`\\[${idx + 1}\\]`, 'g');
|
const regex = new RegExp(`\\[${idx + 1}\\]`, 'g');
|
||||||
segment = segment.replace(regex, `<source_id data="${idx + 1}" title="${sourceId}" />`);
|
segment = segment.replace(
|
||||||
|
regex,
|
||||||
|
`<source_id data="${idx + 1}" title="${encodeURIComponent(sourceId)}" />`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue