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
|
@Override
|
||||||
public @Nullable Collection<ParameterOption> getParameterOptions(URI uri, String param, @Nullable String context,
|
public @Nullable Collection<ParameterOption> getParameterOptions(URI uri, String param, @Nullable String context,
|
||||||
@Nullable Locale locale) {
|
@Nullable Locale locale) {
|
||||||
|
String accountParameterUrl = "thing-type:" + ChatGPTBindingConstants.THING_TYPE_ACCOUNT.getAsString();
|
||||||
|
if (accountParameterUrl.equals(uri.toString())) {
|
||||||
if ("model".equals(param)) {
|
if ("model".equals(param)) {
|
||||||
List<ParameterOption> options = new ArrayList<>();
|
List<ParameterOption> options = new ArrayList<>();
|
||||||
if (thingHandler instanceof ChatGPTHandler chatGPTHandler) {
|
if (thingHandler instanceof ChatGPTHandler chatGPTHandler) {
|
||||||
chatGPTHandler.getModels().forEach(model -> options.add(new ParameterOption(model, model)));
|
chatGPTHandler.getModels().forEach(model -> options.add(new ParameterOption(model, model)));
|
||||||
}
|
}
|
||||||
return options;
|
return options;
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setThingHandler(ThingHandler handler) {
|
public void setThingHandler(ThingHandler handler) {
|
||||||
|
|
Loading…
Reference in New Issue