From 4059003e9e3ff6cf8aa5844d588f04e58cd7bd8a Mon Sep 17 00:00:00 2001 From: Kai Kreuzer Date: Sat, 23 Sep 2023 17:59:40 +0200 Subject: [PATCH] Fix config option provider to only become active for chatgpt things (#15578) Signed-off-by: Kai Kreuzer --- .../internal/ChatGPTModelOptionProvider.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bundles/org.openhab.binding.chatgpt/src/main/java/org/openhab/binding/chatgpt/internal/ChatGPTModelOptionProvider.java b/bundles/org.openhab.binding.chatgpt/src/main/java/org/openhab/binding/chatgpt/internal/ChatGPTModelOptionProvider.java index 9057398de..f0964ce18 100644 --- a/bundles/org.openhab.binding.chatgpt/src/main/java/org/openhab/binding/chatgpt/internal/ChatGPTModelOptionProvider.java +++ b/bundles/org.openhab.binding.chatgpt/src/main/java/org/openhab/binding/chatgpt/internal/ChatGPTModelOptionProvider.java @@ -39,15 +39,17 @@ public class ChatGPTModelOptionProvider implements ThingHandlerService, ConfigOp @Override public @Nullable Collection getParameterOptions(URI uri, String param, @Nullable String context, @Nullable Locale locale) { - if ("model".equals(param)) { - List options = new ArrayList<>(); - if (thingHandler instanceof ChatGPTHandler chatGPTHandler) { - chatGPTHandler.getModels().forEach(model -> options.add(new ParameterOption(model, model))); + String accountParameterUrl = "thing-type:" + ChatGPTBindingConstants.THING_TYPE_ACCOUNT.getAsString(); + if (accountParameterUrl.equals(uri.toString())) { + if ("model".equals(param)) { + List options = new ArrayList<>(); + if (thingHandler instanceof ChatGPTHandler chatGPTHandler) { + chatGPTHandler.getModels().forEach(model -> options.add(new ParameterOption(model, model))); + } + return options; } - return options; - } else { - return null; } + return null; } @Override