mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Fix send_message_to_model_wrapper by using sync is_user_subscribed check
Calling an async function from a sync function wouldn't work.
This commit is contained in:
@@ -50,6 +50,7 @@ from khoj.database.adapters import (
|
|||||||
get_user_name,
|
get_user_name,
|
||||||
get_user_notion_config,
|
get_user_notion_config,
|
||||||
get_user_subscription_state,
|
get_user_subscription_state,
|
||||||
|
is_user_subscribed,
|
||||||
run_with_process_lock,
|
run_with_process_lock,
|
||||||
)
|
)
|
||||||
from khoj.database.models import (
|
from khoj.database.models import (
|
||||||
@@ -1264,7 +1265,7 @@ def send_message_to_model_wrapper_sync(
|
|||||||
if chat_model is None:
|
if chat_model is None:
|
||||||
raise HTTPException(status_code=500, detail="Contact the server administrator to set a default chat model.")
|
raise HTTPException(status_code=500, detail="Contact the server administrator to set a default chat model.")
|
||||||
|
|
||||||
subscribed = ais_user_subscribed(user) if user else False
|
subscribed = is_user_subscribed(user) if user else False
|
||||||
max_tokens = (
|
max_tokens = (
|
||||||
chat_model.subscribed_max_prompt_size
|
chat_model.subscribed_max_prompt_size
|
||||||
if subscribed and chat_model.subscribed_max_prompt_size
|
if subscribed and chat_model.subscribed_max_prompt_size
|
||||||
|
|||||||
Reference in New Issue
Block a user