fix: type errors

Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
-LAN-
2025-09-11 15:01:16 +08:00
parent b4c1766932
commit a923ab1ab8
25 changed files with 310 additions and 316 deletions

View File

@ -1,4 +1,5 @@
import json
from collections.abc import Mapping
from datetime import datetime
from typing import TYPE_CHECKING, Any, Optional, cast
from urllib.parse import urlparse
@ -314,11 +315,11 @@ class MCPToolProvider(Base):
return [MCPTool(**tool) for tool in json.loads(self.tools)]
@property
def provider_icon(self) -> dict[str, str] | str:
def provider_icon(self) -> Mapping[str, str] | str:
from core.file import helpers as file_helpers
try:
return cast(dict[str, str], json.loads(self.icon))
return json.loads(self.icon)
except json.JSONDecodeError:
return file_helpers.get_signed_file_url(self.icon)