Skip to content

Commit

Permalink
Show scores
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves committed Aug 31, 2023
1 parent b897e78 commit db0ee23
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
23 changes: 20 additions & 3 deletions web/src/components/search/DocumentDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 " +
Expand All @@ -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>
Expand All @@ -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>
);
};
4 changes: 2 additions & 2 deletions web/src/components/search/QAFeedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/search/SearchResultsDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) => (
Expand Down
2 changes: 2 additions & 0 deletions web/src/lib/search/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export interface DanswerDocument {
source_type: ValidSources;
blurb: string;
semantic_identifier: string | null;
boost: number;
score: number;
}

export interface SearchResponse {
Expand Down

0 comments on commit db0ee23

Please sign in to comment.