diff --git a/src/interface/web/app/agents/page.tsx b/src/interface/web/app/agents/page.tsx index 9a854d4d..3ef2abaf 100644 --- a/src/interface/web/app/agents/page.tsx +++ b/src/interface/web/app/agents/page.tsx @@ -267,7 +267,7 @@ export default function Agents() { const modelOptions: ModelOptions[] = userConfig?.chat_model_options || []; const selectedChatModelOption: number = userConfig?.selected_chat_model_config || 0; - const isSubscribed: boolean = isUserSubscribed(userConfig); + const isSubscribed: boolean = userConfig?.is_active || false; // The default model option should map to the item in the modelOptions array that has the same id as the selectedChatModelOption const defaultModelOption = modelOptions.find( diff --git a/src/khoj/processor/conversation/openai/utils.py b/src/khoj/processor/conversation/openai/utils.py index e98daf97..76b175b5 100644 --- a/src/khoj/processor/conversation/openai/utils.py +++ b/src/khoj/processor/conversation/openai/utils.py @@ -1,7 +1,7 @@ import logging import os from threading import Thread -from typing import Dict +from typing import Dict, List import openai from openai.types.chat.chat_completion import ChatCompletion @@ -181,6 +181,19 @@ def llm_thread( elif model_name.startswith("o1-"): temperature = 1 model_kwargs.pop("response_format", None) + elif model_name.startswith("deepseek-reasoner"): + # Two successive messages cannot be from the same role. Should merge any back-to-back messages from the same role. + # The first message should always be a user message (except system message). + updated_messages: List[dict] = [] + for i, message in enumerate(formatted_messages): + if i > 0 and message["role"] == formatted_messages[i - 1]["role"]: + updated_messages[-1]["content"] += " " + message["content"] + elif i == 1 and formatted_messages[i - 1]["role"] == "system" and message["role"] == "assistant": + updated_messages[-1]["content"] += " " + message["content"] + else: + updated_messages.append(message) + + formatted_messages = updated_messages if os.getenv("KHOJ_LLM_SEED"): model_kwargs["seed"] = int(os.getenv("KHOJ_LLM_SEED")) diff --git a/src/khoj/routers/api_content.py b/src/khoj/routers/api_content.py index fe0a0d50..d9412629 100644 --- a/src/khoj/routers/api_content.py +++ b/src/khoj/routers/api_content.py @@ -104,7 +104,7 @@ async def put_content( incoming_entries_size_limit=10, subscribed_incoming_entries_size_limit=75, total_entries_size_limit=10, - subscribed_total_entries_size_limit=200, + subscribed_total_entries_size_limit=500, ) ), ): @@ -126,7 +126,7 @@ async def patch_content( incoming_entries_size_limit=10, subscribed_incoming_entries_size_limit=75, total_entries_size_limit=10, - subscribed_total_entries_size_limit=200, + subscribed_total_entries_size_limit=500, ) ), ):