mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-30 19:03:01 +01:00
Return enabled content types via api/config/types API endpoint
Simplifies dynamically populating enabled content types for interfaces
This commit is contained in:
parent
68bd5d9ebc
commit
9d38eadd42
1 changed files with 11 additions and 0 deletions
|
@ -26,6 +26,17 @@ def get_default_config_data():
|
||||||
return constants.default_config
|
return constants.default_config
|
||||||
|
|
||||||
|
|
||||||
|
@api.get("/config/types", response_model=List[str])
|
||||||
|
def get_config_types():
|
||||||
|
"""Get configured content types"""
|
||||||
|
return [
|
||||||
|
search_type.name
|
||||||
|
for search_type in SearchType
|
||||||
|
if any(search_type.value == configured_content_type[0] for configured_content_type in state.config.content_type)
|
||||||
|
or search_type.value in state.config.content_type.plugins.keys()
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@api.get("/config/data", response_model=FullConfig)
|
@api.get("/config/data", response_model=FullConfig)
|
||||||
def get_config_data():
|
def get_config_data():
|
||||||
return state.config
|
return state.config
|
||||||
|
|
Loading…
Reference in a new issue