mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-12-18 02:27:10 +00:00
Merge /reload, /regenerate into single /update API endpoint
- Pass force=true to /update API to force regenerating index from scratch - Otherwise calls to the /update API endpoint will result in an incremental update to index
This commit is contained in:
parent
02d944030f
commit
ee65a4f2c7
1 changed files with 4 additions and 10 deletions
|
@ -137,16 +137,10 @@ def search(q: str, n: Optional[int] = 5, t: Optional[SearchType] = None, r: Opti
|
|||
return results
|
||||
|
||||
|
||||
@router.get('/reload')
|
||||
def reload(t: Optional[SearchType] = None):
|
||||
state.model = configure_search(state.model, state.config, regenerate=False, t=t)
|
||||
return {'status': 'ok', 'message': 'reload completed'}
|
||||
|
||||
|
||||
@router.get('/regenerate')
|
||||
def regenerate(t: Optional[SearchType] = None):
|
||||
state.model = configure_search(state.model, state.config, regenerate=True, t=t)
|
||||
return {'status': 'ok', 'message': 'regeneration completed'}
|
||||
@router.get('/update')
|
||||
def update(t: Optional[SearchType] = None, force: Optional[bool] = False):
|
||||
state.model = configure_search(state.model, state.config, regenerate=force, t=t)
|
||||
return {'status': 'ok', 'message': 'index updated completed'}
|
||||
|
||||
|
||||
@router.get('/beta/search')
|
||||
|
|
Loading…
Reference in a new issue