mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 13:25:11 +00:00
Handle the case where a previous serach model isn't set when updating the model
This commit is contained in:
@@ -265,7 +265,11 @@ async def update_search_model(
|
|||||||
prev_config = await adapters.aget_user_search_model(user)
|
prev_config = await adapters.aget_user_search_model(user)
|
||||||
new_config = await adapters.aset_user_search_model(user, int(id))
|
new_config = await adapters.aset_user_search_model(user, int(id))
|
||||||
|
|
||||||
if int(id) != prev_config.id:
|
if prev_config and int(id) != prev_config.id and new_config:
|
||||||
|
await EntryAdapters.adelete_all_entries(user)
|
||||||
|
|
||||||
|
if not prev_config:
|
||||||
|
# If the use was just using the default config, delete all the entries and set the new config.
|
||||||
await EntryAdapters.adelete_all_entries(user)
|
await EntryAdapters.adelete_all_entries(user)
|
||||||
|
|
||||||
if new_config is None:
|
if new_config is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user