Merge branch 'master' of github.com:debanjum/khoj into fix/obsidian-setup-issues

This commit is contained in:
sabaimran
2023-07-02 16:21:05 -07:00
6 changed files with 106 additions and 95 deletions

View File

@@ -1,7 +1,7 @@
[Desktop Entry]
Type=Application
Name=Khoj
Comment=A natural language search engine for your personal notes, transactions and images.
Comment=An AI personal assistant for your Digital Brain
Path=/opt
Exec=/opt/Khoj
Icon=Khoj

View File

@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "khoj-assistant"
description = "A natural language search engine for your personal notes, transactions and images"
description = "An AI personal assistant for your Digital Brain"
readme = "README.md"
license = "GPL-3.0-or-later"
requires-python = ">=3.8"

View File

@@ -1,6 +1,6 @@
<img src="/src/khoj/interface/web/assets/icons/khoj-logo-sideways.svg" width="200" alt="Khoj Logo">Obsidian
> Natural language search for your Obsidian notes using [Khoj](https://github.com/khoj-ai/khoj)
> An AI personal assistant for your Digital Brain in Obsidian
## Table of Contents

View File

@@ -93,6 +93,7 @@ def configure_search(model: SearchModels, config: FullConfig, regenerate: bool,
logger.warning("🚨 No Content or Search type is configured.")
return
try:
# Initialize Org Notes Search
if (t == state.SearchType.Org or t == None) and config.content_type.org and config.search_type.asymmetric:
logger.info("🦄 Setting up search for orgmode notes")
@@ -118,7 +119,11 @@ def configure_search(model: SearchModels, config: FullConfig, regenerate: bool,
)
# Initialize Markdown Search
if (t == state.SearchType.Markdown or t == None) and config.content_type.markdown and config.search_type.asymmetric:
if (
(t == state.SearchType.Markdown or t == None)
and config.content_type.markdown
and config.search_type.asymmetric
):
logger.info("💎 Setting up search for markdown notes")
# Extract Entries, Generate Markdown Embeddings
model.markdown_search = text_search.setup(
@@ -184,6 +189,9 @@ def configure_search(model: SearchModels, config: FullConfig, regenerate: bool,
regenerate=regenerate,
filters=[DateFilter(), WordFilter(), FileFilter()],
)
except Exception as e:
logger.error("🚨 Failed to setup search")
raise e
# Invalidate Query Cache
state.query_cache = LRU()

View File

@@ -357,7 +357,12 @@ def update(
):
try:
state.search_index_lock.acquire()
try:
state.model = configure_search(state.model, state.config, regenerate=force or False, t=t)
except Exception as e:
logger.error(e)
raise HTTPException(status_code=500, detail=str(e))
finally:
state.search_index_lock.release()
except ValueError as e:
logger.error(e)

View File

@@ -10,9 +10,7 @@ from khoj.utils.yaml import parse_config_from_file
def cli(args=None):
# Setup Argument Parser for the Commandline Interface
parser = argparse.ArgumentParser(
description="Start Khoj; A Natural Language Search Engine for your personal Notes, Transactions and Photos"
)
parser = argparse.ArgumentParser(description="Start Khoj; An AI personal assistant for your Digital Brain")
parser.add_argument(
"--config-file", "-c", default="~/.khoj/khoj.yml", type=pathlib.Path, help="YAML file to configure Khoj"
)