Skip to content

Commit

Permalink
Do not hide model selection under the recommended flag
Browse files Browse the repository at this point in the history
  • Loading branch information
black-roland committed Dec 11, 2024
1 parent 6c55822 commit d34bd7e
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions custom_components/yandexgpt_conversation/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ async def async_step_init(
options = {
CONF_RECOMMENDED: user_input[CONF_RECOMMENDED],
CONF_PROMPT: user_input[CONF_PROMPT],
CONF_LLM_HASS_API: user_input[CONF_LLM_HASS_API],
CONF_CHAT_MODEL: user_input[CONF_CHAT_MODEL],
}

suggested_values = options.copy()
Expand Down Expand Up @@ -158,11 +160,30 @@ def yandexgpt_config_option_schema(
for api in llm.async_get_apis(hass)
)

models = [
SelectOptionDict(label="YandexGPT Lite", value="yandexgpt-lite/latest"),
SelectOptionDict(label="YandexGPT Pro", value="yandexgpt/latest"),
SelectOptionDict(label="YandexGPT Pro 32k", value="yandexgpt-32k/latest"),
SelectOptionDict(label="Llama 8b", value="llama-lite/latest"),
SelectOptionDict(label="Llama 70b", value="llama/latest"),
]

schema = {
vol.Optional(CONF_PROMPT): TemplateSelector(),
vol.Optional(CONF_LLM_HASS_API, default="none"): SelectSelector(
vol.Optional(
CONF_LLM_HASS_API,
description={"suggested_value": options.get(CONF_LLM_HASS_API)},
default="none",
): SelectSelector(
SelectSelectorConfig(options=hass_apis, translation_key=CONF_LLM_HASS_API)
),
vol.Optional(
CONF_CHAT_MODEL,
description={"suggested_value": options.get(CONF_CHAT_MODEL)},
default=RECOMMENDED_CHAT_MODEL,
): SelectSelector(
SelectSelectorConfig(mode=SelectSelectorMode.DROPDOWN, options=models)
),
vol.Required(
CONF_RECOMMENDED, default=options.get(CONF_RECOMMENDED, False)
): bool,
Expand All @@ -171,23 +192,8 @@ def yandexgpt_config_option_schema(
if options.get(CONF_RECOMMENDED):
return schema

models = [
SelectOptionDict(label="YandexGPT Lite", value="yandexgpt-lite/latest"),
SelectOptionDict(label="YandexGPT Pro", value="yandexgpt/latest"),
SelectOptionDict(label="YandexGPT Pro 32k", value="yandexgpt-32k/latest"),
SelectOptionDict(label="Llama 8b", value="llama-lite/latest"),
SelectOptionDict(label="Llama 70b", value="llama/latest"),
]

schema.update(
{
vol.Optional(
CONF_CHAT_MODEL,
description={"suggested_value": options.get(CONF_CHAT_MODEL)},
default=RECOMMENDED_CHAT_MODEL,
): SelectSelector(
SelectSelectorConfig(mode=SelectSelectorMode.DROPDOWN, options=models)
),
vol.Optional(
CONF_TEMPERATURE,
description={"suggested_value": options.get(CONF_TEMPERATURE)},
Expand Down

0 comments on commit d34bd7e

Please sign in to comment.