mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-05 21:29:11 +00:00
Update global model on regenerate via API
This commit is contained in:
@@ -92,7 +92,8 @@ def search(q: str, n: Optional[int] = 5, t: Optional[SearchType] = None):
|
|||||||
|
|
||||||
@app.get('/regenerate')
|
@app.get('/regenerate')
|
||||||
def regenerate(t: Optional[SearchType] = None):
|
def regenerate(t: Optional[SearchType] = None):
|
||||||
initialize_search(config, regenerate=True, t=t)
|
global model
|
||||||
|
model = initialize_search(config, regenerate=True, t=t)
|
||||||
return {'status': 'ok', 'message': 'regeneration completed'}
|
return {'status': 'ok', 'message': 'regeneration completed'}
|
||||||
|
|
||||||
|
|
||||||
@@ -138,8 +139,6 @@ def chat(q: str):
|
|||||||
|
|
||||||
|
|
||||||
def initialize_search(config: FullConfig, regenerate: bool, t: SearchType = None):
|
def initialize_search(config: FullConfig, regenerate: bool, t: SearchType = None):
|
||||||
model = SearchModels()
|
|
||||||
|
|
||||||
# Initialize Org Notes Search
|
# Initialize Org Notes Search
|
||||||
if (t == SearchType.Notes or t == None) and config.content_type.org:
|
if (t == SearchType.Notes or t == None) and config.content_type.org:
|
||||||
# Extract Entries, Generate Notes Embeddings
|
# Extract Entries, Generate Notes Embeddings
|
||||||
|
|||||||
Reference in New Issue
Block a user