[chatgpt] Fix ConfigOptionProvider (#16131)
Signed-off-by: Jan N. Klug <github@klug.nrw>pull/16150/head
parent
990610703c
commit
af13c9d133
|
@ -14,6 +14,7 @@ package org.openhab.binding.chatgpt.internal;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.openhab.core.thing.ThingTypeUID;
|
import org.openhab.core.thing.ThingTypeUID;
|
||||||
|
import org.openhab.core.thing.type.ChannelTypeUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link ChatGPTBindingConstants} class defines common constants, which are
|
* The {@link ChatGPTBindingConstants} class defines common constants, which are
|
||||||
|
@ -31,4 +32,6 @@ public class ChatGPTBindingConstants {
|
||||||
|
|
||||||
// List of all Channel ids
|
// List of all Channel ids
|
||||||
public static final String CHANNEL_CHAT = "chat";
|
public static final String CHANNEL_CHAT = "chat";
|
||||||
|
|
||||||
|
public static final ChannelTypeUID CHANNEL_TYPE_UID_CHAT = new ChannelTypeUID(BINDING_ID, CHANNEL_CHAT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.chatgpt.internal;
|
package org.openhab.binding.chatgpt.internal;
|
||||||
|
|
||||||
|
import static org.openhab.binding.chatgpt.internal.ChatGPTBindingConstants.CHANNEL_TYPE_UID_CHAT;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -39,8 +41,7 @@ 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 (CHANNEL_TYPE_UID_CHAT.getAsString().equals(uri.toString())) {
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue