Skip to content

Commit 7c1d842

Browse files
authored
(1.0) fix: invalid default model provider (#13572)
1 parent 2ea3b64 commit 7c1d842

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

api/core/model_runtime/model_providers/model_provider_factory.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from core.model_runtime.model_providers.__base.tts_model import TTSModel
2121
from core.model_runtime.schema_validators.model_credential_schema_validator import ModelCredentialSchemaValidator
2222
from core.model_runtime.schema_validators.provider_credential_schema_validator import ProviderCredentialSchemaValidator
23+
from core.plugin.entities.plugin import ModelProviderID
2324
from core.plugin.entities.plugin_daemon import PluginModelProviderEntity
2425
from core.plugin.manager.asset import PluginAssetManager
2526
from core.plugin.manager.model import PluginModelManager
@@ -112,6 +113,9 @@ def get_plugin_model_provider(self, provider: str) -> PluginModelProviderEntity:
112113
:param provider: provider name
113114
:return: provider schema
114115
"""
116+
if "/" not in provider:
117+
provider = str(ModelProviderID(provider))
118+
115119
# fetch plugin model providers
116120
plugin_model_provider_entities = self.get_plugin_model_providers()
117121

@@ -363,4 +367,4 @@ def get_plugin_id_and_provider_name_from_provider(self, provider: str) -> tuple[
363367
plugin_id = "/".join(provider.split("/")[:-1])
364368
provider_name = provider.split("/")[-1]
365369

366-
return plugin_id, provider_name
370+
return str(plugin_id), provider_name

api/core/plugin/entities/plugin.py

+7
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ def plugin_id(self) -> str:
169169
return f"{self.organization}/{self.plugin_name}"
170170

171171

172+
class ModelProviderID(GenericProviderID):
173+
def __init__(self, value: str, is_hardcoded: bool = False) -> None:
174+
super().__init__(value, is_hardcoded)
175+
if self.organization == "langgenius" and self.provider_name == "google":
176+
self.provider_name = "gemini"
177+
178+
172179
class PluginDependency(BaseModel):
173180
class Type(enum.StrEnum):
174181
Github = PluginInstallationSource.Github.value

0 commit comments

Comments
 (0)