[chatgpt] Set proper default values for channel configuration (#15451)
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
parent
a293fc8fd9
commit
52c657ff41
|
@ -22,11 +22,11 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
|
|||
@NonNullByDefault
|
||||
public class ChatGPTChannelConfiguration {
|
||||
|
||||
public String model = "";
|
||||
public String model = "gpt-3.5-turbo";
|
||||
|
||||
public float temperature;
|
||||
public float temperature = 0.5f;
|
||||
|
||||
public String systemMessage = "";
|
||||
|
||||
int maxTokens;
|
||||
int maxTokens = 500;
|
||||
}
|
||||
|
|
|
@ -122,9 +122,11 @@ public class ChatGPTHandler extends BaseThingHandler {
|
|||
messages.add(userMessage);
|
||||
root.add("messages", messages);
|
||||
|
||||
String queryJson = gson.toJson(root);
|
||||
Request request = httpClient.newRequest(OPENAI_API_URL).method(HttpMethod.POST)
|
||||
.header("Content-Type", "application/json").header("Authorization", "Bearer " + apiKey)
|
||||
.content(new StringContentProvider(gson.toJson(root)));
|
||||
.content(new StringContentProvider(queryJson));
|
||||
logger.trace("Query '{}'", queryJson);
|
||||
try {
|
||||
ContentResponse response = request.send();
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
|
|
Loading…
Reference in New Issue