mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Swap the Models label for the model name not it's display name, (#147918)
Swap display name for name.
This commit is contained in:
parent
6842bfae4c
commit
2e7113d881
@ -330,13 +330,14 @@ async def google_generative_ai_config_option_schema(
|
|||||||
api_models = [api_model async for api_model in api_models_pager]
|
api_models = [api_model async for api_model in api_models_pager]
|
||||||
models = [
|
models = [
|
||||||
SelectOptionDict(
|
SelectOptionDict(
|
||||||
label=api_model.display_name,
|
label=api_model.name.lstrip("models/"),
|
||||||
value=api_model.name,
|
value=api_model.name,
|
||||||
)
|
)
|
||||||
for api_model in sorted(api_models, key=lambda x: x.display_name or "")
|
for api_model in sorted(
|
||||||
|
api_models, key=lambda x: x.name.lstrip("models/") or ""
|
||||||
|
)
|
||||||
if (
|
if (
|
||||||
api_model.display_name
|
api_model.name
|
||||||
and api_model.name
|
|
||||||
and ("tts" in api_model.name) == (subentry_type == "tts")
|
and ("tts" in api_model.name) == (subentry_type == "tts")
|
||||||
and "vision" not in api_model.name
|
and "vision" not in api_model.name
|
||||||
and api_model.supported_actions
|
and api_model.supported_actions
|
||||||
|
@ -43,25 +43,21 @@ from tests.common import MockConfigEntry
|
|||||||
def get_models_pager():
|
def get_models_pager():
|
||||||
"""Return a generator that yields the models."""
|
"""Return a generator that yields the models."""
|
||||||
model_25_flash = Mock(
|
model_25_flash = Mock(
|
||||||
display_name="Gemini 2.5 Flash",
|
|
||||||
supported_actions=["generateContent"],
|
supported_actions=["generateContent"],
|
||||||
)
|
)
|
||||||
model_25_flash.name = "models/gemini-2.5-flash"
|
model_25_flash.name = "models/gemini-2.5-flash"
|
||||||
|
|
||||||
model_20_flash = Mock(
|
model_20_flash = Mock(
|
||||||
display_name="Gemini 2.0 Flash",
|
|
||||||
supported_actions=["generateContent"],
|
supported_actions=["generateContent"],
|
||||||
)
|
)
|
||||||
model_20_flash.name = "models/gemini-2.0-flash"
|
model_20_flash.name = "models/gemini-2.0-flash"
|
||||||
|
|
||||||
model_15_flash = Mock(
|
model_15_flash = Mock(
|
||||||
display_name="Gemini 1.5 Flash",
|
|
||||||
supported_actions=["generateContent"],
|
supported_actions=["generateContent"],
|
||||||
)
|
)
|
||||||
model_15_flash.name = "models/gemini-1.5-flash-latest"
|
model_15_flash.name = "models/gemini-1.5-flash-latest"
|
||||||
|
|
||||||
model_15_pro = Mock(
|
model_15_pro = Mock(
|
||||||
display_name="Gemini 1.5 Pro",
|
|
||||||
supported_actions=["generateContent"],
|
supported_actions=["generateContent"],
|
||||||
)
|
)
|
||||||
model_15_pro.name = "models/gemini-1.5-pro-latest"
|
model_15_pro.name = "models/gemini-1.5-pro-latest"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user