This commit is contained in:
Kovid Goyal 2026-04-17 09:44:11 +05:30
parent 073f67522a
commit cfb2e7566e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@ class Model(NamedTuple):
owner: str
@classmethod
def from_dict(cls, x: dict[str, Any]) -> 'Model':
def from_dict(cls, x: dict[str, Any]) -> Model:
return cls(id=x['id'], owner=x.get('owned_by', 'remote'))
@ -141,7 +141,7 @@ def as_chat_responses(d: dict[str, Any], model_id: str) -> Iterator[ChatResponse
if blocked:
yield ChatResponse(exception=ResultBlocked(ResultBlockReason.safety), plugin_name=OpenAICompatible.name)
return
if usage := d.get('usage'):
if d.get('usage'):
yield ChatResponse(
has_metadata=True, provider=OpenAICompatible.name, model=d.get('model') or model_id,
plugin_name=OpenAICompatible.name

View File

@ -8,8 +8,8 @@ from calibre.ai.github import GitHubAI
from calibre.ai.google import GoogleAI
from calibre.ai.lm_studio import LMStudioAI
from calibre.ai.ollama import OllamaAI
from calibre.ai.openai_compatible import OpenAICompatible
from calibre.ai.open_router import OpenRouterAI
from calibre.ai.openai_compatible import OpenAICompatible
from calibre.constants import numeric_version
from calibre.customize import FileTypePlugin, InterfaceActionBase, MetadataReaderPlugin, MetadataWriterPlugin, PreferencesPlugin, StoreBase
from calibre.ebooks.html.to_zip import HTML2ZIP