mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 05:39:12 +00:00
Index configured plugins on app start and via update API endpoint
This commit is contained in:
@@ -8,6 +8,7 @@ import schedule
|
|||||||
|
|
||||||
# Internal Packages
|
# Internal Packages
|
||||||
from khoj.processor.ledger.beancount_to_jsonl import BeancountToJsonl
|
from khoj.processor.ledger.beancount_to_jsonl import BeancountToJsonl
|
||||||
|
from khoj.processor.jsonl.jsonl_to_jsonl import JsonlToJsonl
|
||||||
from khoj.processor.markdown.markdown_to_jsonl import MarkdownToJsonl
|
from khoj.processor.markdown.markdown_to_jsonl import MarkdownToJsonl
|
||||||
from khoj.processor.org_mode.org_to_jsonl import OrgToJsonl
|
from khoj.processor.org_mode.org_to_jsonl import OrgToJsonl
|
||||||
from khoj.search_type import image_search, text_search
|
from khoj.search_type import image_search, text_search
|
||||||
@@ -105,6 +106,18 @@ def configure_search(model: SearchModels, config: FullConfig, regenerate: bool,
|
|||||||
config.content_type.image, search_config=config.search_type.image, regenerate=regenerate
|
config.content_type.image, search_config=config.search_type.image, regenerate=regenerate
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Initialize External Plugin Search
|
||||||
|
if (t == None or t in state.SearchType) and config.content_type.plugins:
|
||||||
|
model.plugin_search = {}
|
||||||
|
for plugin_type, plugin_config in config.content_type.plugins.items():
|
||||||
|
model.plugin_search[plugin_type] = text_search.setup(
|
||||||
|
JsonlToJsonl,
|
||||||
|
plugin_config,
|
||||||
|
search_config=config.search_type.asymmetric,
|
||||||
|
regenerate=regenerate,
|
||||||
|
filters=[DateFilter(), WordFilter(), FileFilter()],
|
||||||
|
)
|
||||||
|
|
||||||
# Invalidate Query Cache
|
# Invalidate Query Cache
|
||||||
state.query_cache = LRU()
|
state.query_cache = LRU()
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from __future__ import annotations # to avoid quoting type hints
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING, List
|
from typing import TYPE_CHECKING, Dict, List
|
||||||
|
|
||||||
# External Packages
|
# External Packages
|
||||||
import torch
|
import torch
|
||||||
@@ -62,6 +62,7 @@ class SearchModels:
|
|||||||
music_search: TextSearchModel = None
|
music_search: TextSearchModel = None
|
||||||
markdown_search: TextSearchModel = None
|
markdown_search: TextSearchModel = None
|
||||||
image_search: ImageSearchModel = None
|
image_search: ImageSearchModel = None
|
||||||
|
plugin_search: Dict[str, TextSearchModel] = None
|
||||||
|
|
||||||
|
|
||||||
class ConversationProcessorConfigModel:
|
class ConversationProcessorConfigModel:
|
||||||
|
|||||||
Reference in New Issue
Block a user