mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-05 05:39:11 +00:00
Resolve datetime deprecation warnings
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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 ""
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user