Skip to content

Commit

Permalink
src/components/DBResultPreview.tsx: Added FileName to chunk for Relat…
Browse files Browse the repository at this point in the history
…ed Notes and Search Preview.
  • Loading branch information
milaiwi committed May 6, 2024
1 parent 6ba6d48 commit c444bf2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/File/DBResultPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const DBResultPreview: React.FC<DBResultPreview> = ({
onSelect,
}) => {
const modified = formatModifiedDate(entry.filemodified);
const fileName = getFileName(entry.notepath);
return (
<div
className="pr-2 pb-1 mt-0 text-slate-300 pt-1 rounded border-solid border-gray-600 bg-neutral-800 border-[0.1px] pl-2 shadow-md cursor-pointer hover:scale-104 hover:shadow-lg hover:bg-neutral-700 transition-transform duration-300"
Expand All @@ -30,10 +31,13 @@ export const DBResultPreview: React.FC<DBResultPreview> = ({
{entry.content}
</ReactMarkdown>
<div className="text-xs text-gray-400 mt-0">
{fileName && (
<span className="text-xs text-gray-400">{fileName} </span>
)} |{" "}
Similarity: {cosineDistanceToPercentage(entry._distance)}% |{" "}
{modified && (
<span className="text-xs text-gray-400">Modified {modified}</span>
)}
)} |{" "}
</div>
</div>
);
Expand All @@ -49,6 +53,7 @@ export const DBSearchPreview: React.FC<DBSearchPreviewProps> = ({
onSelect,
}) => {
const modified = formatModifiedDate(entry.filemodified);
const fileName = getFileName(entry.notepath)

return (
<div
Expand All @@ -67,6 +72,9 @@ export const DBSearchPreview: React.FC<DBSearchPreviewProps> = ({
{entry.content}
</ReactMarkdown>
<div className="text-xs text-gray-400 mt-0">
{fileName && (
<span className="text-xs text-gray-400">{fileName} </span>
)} |{" "}
Similarity: {cosineDistanceToPercentage(entry._distance)}% |{" "}
{modified && (
<span className="text-xs text-gray-400">Modified {modified}</span>
Expand Down

0 comments on commit c444bf2

Please sign in to comment.