Merge branch 'master' of github.com:khoj-ai/khoj into features/add-chat-controls

This commit is contained in:
sabaimran
2025-02-01 14:25:58 -08:00
14 changed files with 25 additions and 11 deletions

View File

@@ -329,7 +329,7 @@ Using Ollama? See the [Ollama Integration](/advanced/ollama) section for more cu
- Give the configuration a friendly name like `Gemini`. Do not configure the API base url.
2. Create a new [chat model](http://localhost:42110/server/admin/database/chatmodel/add)
- Set the `chat-model` field to a [Google Gemini chat model](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models#gemini-models). Example: `gemini-1.5-flash`.
- Set the `model-type` field to `Gemini`.
- Set the `model-type` field to `Google`.
- Set the `ai model api` field to the Gemini AI Model API you created in step 1.
</TabItem>

View File

@@ -1,7 +1,7 @@
{
"id": "khoj",
"name": "Khoj",
"version": "1.35.2",
"version": "1.35.3",
"minAppVersion": "0.15.0",
"description": "Your Second Brain",
"author": "Khoj Inc.",

View File

@@ -1,6 +1,6 @@
{
"name": "Khoj",
"version": "1.35.2",
"version": "1.35.3",
"description": "Your Second Brain",
"author": "Khoj Inc. <team@khoj.dev>",
"license": "GPL-3.0-or-later",

View File

@@ -6,7 +6,7 @@
;; Saba Imran <saba@khoj.dev>
;; Description: Your Second Brain
;; Keywords: search, chat, ai, org-mode, outlines, markdown, pdf, image
;; Version: 1.35.2
;; Version: 1.35.3
;; Package-Requires: ((emacs "27.1") (transient "0.3.0") (dash "2.19.1"))
;; URL: https://github.com/khoj-ai/khoj/tree/master/src/interface/emacs

View File

@@ -1,7 +1,7 @@
{
"id": "khoj",
"name": "Khoj",
"version": "1.35.2",
"version": "1.35.3",
"minAppVersion": "0.15.0",
"description": "Your Second Brain",
"author": "Khoj Inc.",

View File

@@ -1,6 +1,6 @@
{
"name": "Khoj",
"version": "1.35.2",
"version": "1.35.3",
"description": "Your Second Brain",
"author": "Debanjum Singh Solanky, Saba Imran <team@khoj.dev>",
"license": "GPL-3.0-or-later",

View File

@@ -112,5 +112,6 @@
"1.34.0": "0.15.0",
"1.35.0": "0.15.0",
"1.35.1": "0.15.0",
"1.35.2": "0.15.0"
"1.35.2": "0.15.0",
"1.35.3": "0.15.0"
}

View File

@@ -1,6 +1,6 @@
{
"name": "khoj-ai",
"version": "1.35.2",
"version": "1.35.3",
"private": true,
"scripts": {
"dev": "next dev",

View File

@@ -1840,7 +1840,7 @@ class AutomationAdapters:
def get_automation(user: KhojUser, automation_id: str) -> Job:
# Perform validation checks
# Check if user is allowed to delete this automation id
if not automation_id.startswith(f"automation_{user.uuid}_"):
if not is_none_or_empty(automation_id) or automation_id.startswith(f"automation_{user.uuid}_"):
raise ValueError("Invalid automation id")
# Check if automation with this id exist
automation: Job = state.scheduler.get_job(job_id=automation_id)

View File

@@ -71,6 +71,8 @@ def completion_with_backoff(
elif model_name.startswith("o1"):
temperature = 1
model_kwargs.pop("response_format", None)
elif model_name.startswith("o3-"):
temperature = 1
if os.getenv("KHOJ_LLM_SEED"):
model_kwargs["seed"] = int(os.getenv("KHOJ_LLM_SEED"))
@@ -181,6 +183,8 @@ def llm_thread(
elif model_name.startswith("o1-"):
temperature = 1
model_kwargs.pop("response_format", None)
elif model_name.startswith("o3-"):
temperature = 1
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).

View File

@@ -55,6 +55,7 @@ model_to_prompt_size = {
"gpt-4o-mini": 60000,
"o1": 20000,
"o1-mini": 60000,
"o3-mini": 60000,
# Google Models
"gemini-1.5-flash": 60000,
"gemini-1.5-pro": 60000,

View File

@@ -2012,7 +2012,13 @@ def schedule_automation(
# Run automation at some random minute (to distribute request load) instead of running every X minutes
crontime = " ".join([str(math.floor(random() * 60))] + crontime.split(" ")[1:])
user_timezone = pytz.timezone(timezone)
# Convert timezone string to timezone object
try:
user_timezone = pytz.timezone(timezone)
except pytz.UnknownTimeZoneError:
logger.error(f"Invalid timezone: {timezone}. Fallback to use UTC to schedule automation.")
user_timezone = pytz.utc
trigger = CronTrigger.from_crontab(crontime, user_timezone)
trigger.jitter = 60
# Generate id and metadata used by task scheduler and process locks for the task runs

View File

@@ -40,6 +40,7 @@ model_to_cost: Dict[str, Dict[str, float]] = {
"gpt-4o-mini": {"input": 0.15, "output": 0.60},
"o1": {"input": 15.0, "output": 60.00},
"o1-mini": {"input": 3.0, "output": 12.0},
"o3-mini": {"input": 1.10, "output": 4.40},
# Gemini Pricing: https://ai.google.dev/pricing
"gemini-1.5-flash": {"input": 0.075, "output": 0.30},
"gemini-1.5-flash-002": {"input": 0.075, "output": 0.30},

View File

@@ -112,5 +112,6 @@
"1.34.0": "0.15.0",
"1.35.0": "0.15.0",
"1.35.1": "0.15.0",
"1.35.2": "0.15.0"
"1.35.2": "0.15.0",
"1.35.3": "0.15.0"
}