mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-29 05:15:12 +02:00
Show scores
This commit is contained in:
@@ -26,7 +26,24 @@ export const DocumentDisplay = ({
|
||||
onMouseLeave={() => setIsHovered(false)}
|
||||
>
|
||||
{popup}
|
||||
<div className="flex">
|
||||
<div className="flex relative">
|
||||
<div className="absolute -left-10 top-2/4 -translate-y-2/4 w-10 flex">
|
||||
<div
|
||||
className={`
|
||||
text-xs
|
||||
text-gray-200
|
||||
bg-gray-800
|
||||
rounded
|
||||
p-0.5
|
||||
w-fit
|
||||
my-auto
|
||||
select-none
|
||||
ml-auto
|
||||
mr-2`}
|
||||
>
|
||||
{document.score.toFixed(2)}
|
||||
</div>
|
||||
</div>
|
||||
<a
|
||||
className={
|
||||
"rounded-lg flex font-bold " +
|
||||
@@ -37,7 +54,7 @@ export const DocumentDisplay = ({
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{getSourceIcon(document.source_type, 20)}
|
||||
<p className="truncate break-all ml-2">
|
||||
<p className="truncate break-all ml-2 my-auto">
|
||||
{document.semantic_identifier || document.document_id}
|
||||
</p>
|
||||
</a>
|
||||
@@ -51,7 +68,7 @@ export const DocumentDisplay = ({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<p className="pl-1 py-3 text-gray-200">{document.blurb}</p>
|
||||
<p className="pl-1 pt-2 pb-3 text-gray-200">{document.blurb}</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@@ -57,12 +57,12 @@ const QAFeedback = ({
|
||||
{feedbackType === "like" ? (
|
||||
<ThumbsUpIcon
|
||||
size={size}
|
||||
className="my-auto flex flex-shrink-0 text-green-600"
|
||||
className="my-auto flex flex-shrink-0 text-gray-500"
|
||||
/>
|
||||
) : (
|
||||
<ThumbsDownIcon
|
||||
size={size}
|
||||
className="my-auto flex flex-shrink-0 text-red-700"
|
||||
className="my-auto flex flex-shrink-0 text-gray-500"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
@@ -101,16 +101,16 @@ export const SearchResultsDisplay: React.FC<SearchResultsDisplayProps> = ({
|
||||
|
||||
{quotes !== null && answer && (
|
||||
<>
|
||||
<h2 className="text-sm font-bold mb-2">Sources</h2>
|
||||
<h2 className="text-sm font-bold">Sources</h2>
|
||||
{isFetching && dedupedQuotes.length === 0 ? (
|
||||
<LoadingAnimation text="Finding quotes" size="text-sm" />
|
||||
) : (
|
||||
<div className="flex">
|
||||
<div className="flex flex-wrap">
|
||||
{dedupedQuotes.length > 0 ? (
|
||||
dedupedQuotes.map((quoteInfo) => (
|
||||
<a
|
||||
key={quoteInfo.document_id}
|
||||
className="p-2 ml-1 border border-gray-800 rounded-lg text-sm flex max-w-[280px] hover:bg-gray-800"
|
||||
className="p-2 ml-1 mt-2 border border-gray-800 rounded-lg text-sm flex max-w-[280px] hover:bg-gray-800"
|
||||
href={quoteInfo.link || undefined}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
@@ -148,7 +148,7 @@ export const SearchResultsDisplay: React.FC<SearchResultsDisplayProps> = ({
|
||||
|
||||
{documents && documents.length > 0 && (
|
||||
<div className="mt-4">
|
||||
<div className="font-bold border-b mb-4 pb-1 border-gray-800">
|
||||
<div className="font-bold border-b mb-3 pb-1 border-gray-800">
|
||||
Results
|
||||
</div>
|
||||
{removeDuplicateDocs(documents).map((document) => (
|
||||
|
@@ -27,6 +27,8 @@ export interface DanswerDocument {
|
||||
source_type: ValidSources;
|
||||
blurb: string;
|
||||
semantic_identifier: string | null;
|
||||
boost: number;
|
||||
score: number;
|
||||
}
|
||||
|
||||
export interface SearchResponse {
|
||||
|
Reference in New Issue
Block a user