mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Fix null ref issue in query method and update logic for determining whether khoj is already configured in obsidian
This commit is contained in:
parent
2f18383349
commit
d2f9bca1cf
2 changed files with 9 additions and 0 deletions
|
@ -55,6 +55,7 @@ export async function configureKhojBackend(vault: Vault, setting: KhojSetting, n
|
||||||
await request(khoj_already_configured ? khojConfigUrl : `${khojConfigUrl}/default`)
|
await request(khoj_already_configured ? khojConfigUrl : `${khojConfigUrl}/default`)
|
||||||
.then(response => JSON.parse(response))
|
.then(response => JSON.parse(response))
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
khoj_already_configured = data["content-type"] != null;
|
||||||
// If khoj backend not configured yet
|
// If khoj backend not configured yet
|
||||||
if (!khoj_already_configured) {
|
if (!khoj_already_configured) {
|
||||||
// Create khoj content-type config with only markdown configured
|
// Create khoj content-type config with only markdown configured
|
||||||
|
|
|
@ -126,6 +126,14 @@ async def query(
|
||||||
dedupe: bool = True,
|
dedupe: bool = True,
|
||||||
) -> Tuple[List[dict], List[Entry]]:
|
) -> Tuple[List[dict], List[Entry]]:
|
||||||
"Search for entries that answer the query"
|
"Search for entries that answer the query"
|
||||||
|
if (
|
||||||
|
content.entries is None
|
||||||
|
or len(content.entries) == 0
|
||||||
|
or content.corpus_embeddings is None
|
||||||
|
or len(content.corpus_embeddings) == 0
|
||||||
|
):
|
||||||
|
return [], []
|
||||||
|
|
||||||
query, entries, corpus_embeddings = raw_query, content.entries, content.corpus_embeddings
|
query, entries, corpus_embeddings = raw_query, content.entries, content.corpus_embeddings
|
||||||
|
|
||||||
# Filter query, entries and embeddings before semantic search
|
# Filter query, entries and embeddings before semantic search
|
||||||
|
|
Loading…
Add table
Reference in a new issue