Skip to content

Commit

Permalink
chore: bump version to 0.1.26
Browse files Browse the repository at this point in the history
  • Loading branch information
anpigon committed Dec 20, 2024
1 parent c4263d3 commit 4cdbac0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "smart-seeker",
"name": "Smart Seeker",
"version": "0.1.25",
"version": "0.1.26",
"minAppVersion": "0.15.0",
"description": "A smart search plugin for Obsidian that helps you find document contents quickly and efficiently.",
"author": "Obsidian",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smart-seeker",
"version": "0.1.25",
"version": "0.1.26",
"description": "An Obsidian plugin that enables fast and intelligent note search using RAG (Retrieval Augmented Generation) with Pinecone vector database and OpenAI",
"main": "main.js",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/utils/editorHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,8 @@ export async function openNoteAndHighlightText(
throw new Error("Failed to open file");
}
}

export function removeFrontmatter(content: string): string {
const frontmatterRegex = /^---\s*[\s\S]*?\s*---\s*/;
return content.replace(frontmatterRegex, "");
}
10 changes: 7 additions & 3 deletions src/ui/RelatedNotesView/RelatedNotes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Logger } from "@/helpers/logger";
import {
openNote,
openNoteAndHighlightText,
removeFrontmatter,
} from "@/helpers/utils/editorHelpers";
import getEmbeddingModel from "@/helpers/utils/getEmbeddingModel";
import truncateContent from "@/helpers/utils/truncateContent";
Expand Down Expand Up @@ -74,9 +75,12 @@ const RelatedNotes = ({ currentFile }: RelatedNotesProps) => {
queryFn: async () => {
if (!currentFile) return [];
const content = await app?.vault.cachedRead(currentFile);
// logger.debug("--→ content", content?.length, content);
if (!content || content.length < 50) return [];
const truncatedContent = truncateContent(content, 8192);
if (!content || !content?.length) return [];

const title = currentFile.basename;
const cleanedContent = removeFrontmatter(content);
const query = `# ${title}\n\n${cleanedContent}`;
const truncatedContent = truncateContent(query, 8192);
return queryByFileContent(truncatedContent || "", currentFile.path);
},
enabled:
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@
"0.1.22": "0.15.0",
"0.1.23": "0.15.0",
"0.1.24": "0.15.0",
"0.1.25": "0.15.0"
"0.1.25": "0.15.0",
"0.1.26": "0.15.0"
}

0 comments on commit 4cdbac0

Please sign in to comment.