Remove additional references to image content config

This commit is contained in:
sabaimran 2024-04-17 13:00:50 +05:30
parent 105dbf49e4
commit d11354f9c8
3 changed files with 1 additions and 37 deletions

View file

@ -53,17 +53,8 @@ class NotionContentConfig(ConfigBase):
token: str token: str
class ImageContentConfig(ConfigBase):
input_directories: Optional[List[Path]] = None
input_filter: Optional[List[str]] = None
embeddings_file: Path
use_xmp_metadata: bool
batch_size: int
class ContentConfig(ConfigBase): class ContentConfig(ConfigBase):
org: Optional[TextContentConfig] = None org: Optional[TextContentConfig] = None
image: Optional[ImageContentConfig] = None
markdown: Optional[TextContentConfig] = None markdown: Optional[TextContentConfig] = None
pdf: Optional[TextContentConfig] = None pdf: Optional[TextContentConfig] = None
plaintext: Optional[TextContentConfig] = None plaintext: Optional[TextContentConfig] = None

View file

@ -30,12 +30,7 @@ from khoj.utils import fs_syncer, state
from khoj.utils.config import SearchModels from khoj.utils.config import SearchModels
from khoj.utils.constants import web_directory from khoj.utils.constants import web_directory
from khoj.utils.helpers import resolve_absolute_path from khoj.utils.helpers import resolve_absolute_path
from khoj.utils.rawconfig import ( from khoj.utils.rawconfig import ContentConfig, ImageSearchConfig, SearchConfig
ContentConfig,
ImageContentConfig,
ImageSearchConfig,
SearchConfig,
)
from tests.helpers import ( from tests.helpers import (
ChatModelOptionsFactory, ChatModelOptionsFactory,
OfflineChatProcessorConversationConfigFactory, OfflineChatProcessorConversationConfigFactory,
@ -223,13 +218,6 @@ def content_config(tmp_path_factory, search_models: SearchModels, default_user:
# Generate Image Embeddings from Test Images # Generate Image Embeddings from Test Images
content_config = ContentConfig() content_config = ContentConfig()
content_config.image = ImageContentConfig(
input_filter=None,
input_directories=["tests/data/images"],
embeddings_file=content_dir.joinpath("image_embeddings.pt"),
batch_size=1,
use_xmp_metadata=False,
)
LocalOrgConfig.objects.create( LocalOrgConfig.objects.create(
input_files=None, input_files=None,

View file

@ -1,15 +0,0 @@
import pytest
from khoj.utils.rawconfig import ImageContentConfig, TextContentConfig
# Test
# ----------------------------------------------------------------------------------------------------
def test_input_filter_or_directories_required_in_image_content_config():
# Act
with pytest.raises(ValueError):
ImageContentConfig(
input_directories=None,
input_filter=None,
embeddings_file="note_embeddings.pt",
)