Fix config option provider to only become active for chatgpt things (#15578)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
parent
7f56f0579a
commit
4059003e9e
|
@ -39,16 +39,18 @@ public class ChatGPTModelOptionProvider implements ThingHandlerService, ConfigOp
|
|||
@Override
|
||||
public @Nullable Collection<ParameterOption> getParameterOptions(URI uri, String param, @Nullable String context,
|
||||
@Nullable Locale locale) {
|
||||
String accountParameterUrl = "thing-type:" + ChatGPTBindingConstants.THING_TYPE_ACCOUNT.getAsString();
|
||||
if (accountParameterUrl.equals(uri.toString())) {
|
||||
if ("model".equals(param)) {
|
||||
List<ParameterOption> options = new ArrayList<>();
|
||||
if (thingHandler instanceof ChatGPTHandler chatGPTHandler) {
|
||||
chatGPTHandler.getModels().forEach(model -> options.add(new ParameterOption(model, model)));
|
||||
}
|
||||
return options;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThingHandler(ThingHandler handler) {
|
||||
|
|
Loading…
Reference in New Issue