Skip to content
Snippets Groups Projects
Commit 9252b12b authored by Andréas Livet's avatar Andréas Livet
Browse files

Add Link on source list

parent 11713a6f
No related branches found
No related tags found
No related merge requests found
......@@ -296,6 +296,12 @@ export const SimpleChat = () => {
return source;
};
const getSourceLink = (source: Source) => {
return `/collection/${currentCollection!.id}/documents/${
source.id
}?pageNum=${source.page}&tab=chat`;
};
const replaceDocRefWithLink = (
content: string,
sources: Source[] | undefined
......@@ -309,9 +315,7 @@ export const SimpleChat = () => {
const source =
sources.length >= Number(index) ? sources[Number(index) - 1] : null;
if (source) {
return `[[${index}](/collection/${
currentCollection!.id
}/documents/${source.id}?pageNum=${source.page}&tab=chat)]`;
return `[[${index}](${getSourceLink(source)})]`;
} else {
return original;
}
......@@ -484,8 +488,15 @@ export const SimpleChat = () => {
<ol className={classes.sourceList + " fr-text--sm"}>
{currentChatResponse.sources.map((source, index) => (
<li key={index}>
<Tooltip kind="hover" title={source.content}>
{source.title || source.filename}, p{source.page}
<Tooltip
kind="hover"
title={`Score : ${Math.round(source.score * 100)}% ${
source.content
}`}
>
<Link to={getSourceLink(source)}>
{source.title || source.filename}, p{source.page}
</Link>
</Tooltip>
</li>
))}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment