mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 05:40:17 +00:00
Truncate query to 8k chars for find similar notes from obsidian plugin
Truncate current file data passed to khoj backend API via query string below default query size supported by popular servers
This commit is contained in:
@@ -63,8 +63,9 @@ export class KhojModal extends SuggestModal<SearchResult> {
|
|||||||
if (file && file.extension === 'md') {
|
if (file && file.extension === 'md') {
|
||||||
// Enable rerank of search results
|
// Enable rerank of search results
|
||||||
this.rerank = true
|
this.rerank = true
|
||||||
// Set contents of active markdown file to input element
|
// Set input element to contents of active markdown file
|
||||||
this.inputEl.value = await this.app.vault.read(file);
|
// truncate to first 8,000 characters to avoid hitting query size limits
|
||||||
|
this.inputEl.value = await this.app.vault.read(file).then(file_str => file_str.slice(0, 8000));
|
||||||
// Trigger search to get and render similar notes from khoj backend
|
// Trigger search to get and render similar notes from khoj backend
|
||||||
this.inputEl.dispatchEvent(new Event('input'));
|
this.inputEl.dispatchEvent(new Event('input'));
|
||||||
this.rerank = false
|
this.rerank = false
|
||||||
|
|||||||
Reference in New Issue
Block a user