mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[chatgpt] Set proper default values for channel configuration (#15451)
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
parent
313cca64cc
commit
177d75e7dd
@ -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
Block a user