Resolve datetime deprecation warnings

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
This commit is contained in:
Emmanuel Ferdman
2025-04-18 10:41:16 -07:00
parent eb1406bcb4
commit fee1d3682b
2 changed files with 4 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
import base64
import logging
import os
from datetime import datetime
from datetime import datetime, timezone
from typing import Dict, List, Tuple
from khoj.database.models import Entry as DbEntry
@@ -58,7 +58,7 @@ class ImageToEntries(TextToEntries):
try:
bytes = image_files[image_file]
# write the image to a temporary file
timestamp_now = datetime.utcnow().timestamp()
timestamp_now = datetime.now(timezone.utc).timestamp()
# use either png or jpg
if image_file.endswith(".png"):
tmp_file = f"tmp_image_file_{timestamp_now}.png"

View File

@@ -480,7 +480,7 @@ async def infer_webpage_urls(
username = prompts.user_name.format(name=user.get_full_name()) if user.get_full_name() else ""
chat_history = construct_chat_history(conversation_history)
utc_date = datetime.utcnow().strftime("%Y-%m-%d")
utc_date = datetime.now(timezone.utc).strftime("%Y-%m-%d")
personality_context = (
prompts.personality_context.format(personality=agent.personality) if agent and agent.personality else ""
)
@@ -545,7 +545,7 @@ async def generate_online_subqueries(
chat_history = construct_chat_history(conversation_history)
max_queries = 3
utc_date = datetime.utcnow().strftime("%Y-%m-%d")
utc_date = datetime.now(timezone.utc).strftime("%Y-%m-%d")
personality_context = (
prompts.personality_context.format(personality=agent.personality) if agent and agent.personality else ""
)