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:
Debanjum
2025-05-17 02:29:29 -07:00
parent a4ab498aec
commit d867dca310

View File

@@ -50,6 +50,7 @@ from khoj.database.adapters import (
get_user_name,
get_user_notion_config,
get_user_subscription_state,
is_user_subscribed,
run_with_process_lock,
)
from khoj.database.models import (
@@ -1264,7 +1265,7 @@ def send_message_to_model_wrapper_sync(
if chat_model is None:
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 = (
chat_model.subscribed_max_prompt_size
if subscribed and chat_model.subscribed_max_prompt_size