mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Address mypy typing issues
This commit is contained in:
@@ -401,7 +401,7 @@ class ConversationAdapters:
|
||||
)
|
||||
|
||||
max_results = 3
|
||||
all_questions = await sync_to_async(list)(all_questions)
|
||||
all_questions = await sync_to_async(list)(all_questions) # type: ignore
|
||||
if len(all_questions) < max_results:
|
||||
return all_questions
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ async def text_to_image(message: str) -> Tuple[Optional[str], int]:
|
||||
)
|
||||
image = response.data[0].b64_json
|
||||
except openai.OpenAIError as e:
|
||||
logger.error(f"Image Generation failed with {e.http_status}: {e.error}")
|
||||
logger.error(f"Image Generation failed with {e}", exc_info=True)
|
||||
status_code = 500
|
||||
|
||||
return image, status_code
|
||||
@@ -302,7 +302,7 @@ class ApiUserRateLimiter:
|
||||
|
||||
class ConversationCommandRateLimiter:
|
||||
def __init__(self, trial_rate_limit: int, subscribed_rate_limit: int):
|
||||
self.cache = defaultdict(lambda: defaultdict(list))
|
||||
self.cache: Dict[str, Dict[str, List[float]]] = defaultdict(lambda: defaultdict(list))
|
||||
self.trial_rate_limit = trial_rate_limit
|
||||
self.subscribed_rate_limit = subscribed_rate_limit
|
||||
self.restricted_commands = [ConversationCommand.Online, ConversationCommand.Image]
|
||||
@@ -351,7 +351,7 @@ class ApiIndexedDataLimiter:
|
||||
if state.billing_enabled is False:
|
||||
return
|
||||
subscribed = has_required_scope(request, ["premium"])
|
||||
incoming_data_size_mb = 0
|
||||
incoming_data_size_mb = 0.0
|
||||
deletion_file_names = set()
|
||||
|
||||
if not request.user.is_authenticated:
|
||||
|
||||
Reference in New Issue
Block a user