Automate updating embeddings, search index on a hourly schedule

- Use the schedule pypi package
- Use QTimer to poll schedule.run_pending() regularly for jobs to run
This commit is contained in:
Debanjum Singh Solanky
2023-01-01 16:22:35 -03:00
parent a58c243bc0
commit 3b0783aab9
4 changed files with 15 additions and 2 deletions

View File

@@ -126,4 +126,6 @@ def search(q: str, n: Optional[int] = 5, t: Optional[SearchType] = None, r: Opti
@api.get('/update')
def update(t: Optional[SearchType] = None, force: Optional[bool] = False):
state.model = configure_search(state.model, state.config, regenerate=force, t=t)
logger.info("Search Index updated via API call")
return {'status': 'ok', 'message': 'index updated'}