diff --git a/src/main/java/org/myrobotlab/service/Gpt3.java b/src/main/java/org/myrobotlab/service/Gpt3.java index 67ed717639..82d9ad90d2 100644 --- a/src/main/java/org/myrobotlab/service/Gpt3.java +++ b/src/main/java/org/myrobotlab/service/Gpt3.java @@ -61,7 +61,7 @@ public class Gpt3 extends Service implements TextListener, TextPubli private String currentChannelName; private String currentChannelType; - + public Gpt3(String n, String id) { super(n, id); } @@ -85,6 +85,10 @@ public Response getResponse(String text) { sleep(); responseText = "Ok, I will go to sleep"; } + + if (c.prefix != null) { + text = c.prefix + " " + text; + } if (!c.sleeping) { diff --git a/src/main/java/org/myrobotlab/service/config/Gpt3Config.java b/src/main/java/org/myrobotlab/service/config/Gpt3Config.java index 62a6627a1d..48f3612f17 100644 --- a/src/main/java/org/myrobotlab/service/config/Gpt3Config.java +++ b/src/main/java/org/myrobotlab/service/config/Gpt3Config.java @@ -18,6 +18,11 @@ public class Gpt3Config extends ServiceConfig { public String engine = "gpt-3.5-turbo"; // "text-davinci-003" public String wakeWord = "wake"; public String sleepWord = "sleep"; + /** + * static prefix to send to gpt3 + * e.g. " talk like a pirate when responding, " + */ + public String prefix = null; @Override public Plan getDefault(Plan plan, String name) { diff --git a/src/main/java/org/myrobotlab/vertx/WebSocketHandler.java b/src/main/java/org/myrobotlab/vertx/WebSocketHandler.java index e0ad0f2e61..d8b07023f2 100644 --- a/src/main/java/org/myrobotlab/vertx/WebSocketHandler.java +++ b/src/main/java/org/myrobotlab/vertx/WebSocketHandler.java @@ -108,6 +108,14 @@ public void handle(ServerWebSocket socket) { // client MultiMap headers = socket.headers(); String uri = socket.uri(); + + // FIXME - get "id" from js client - need something unique from the js + // client + // String id = r.getRequest().getParameter("id"); + String id = String.format("vertx-%s", service.getName()); + // String uuid = UUID.randomUUID().toString(); + String uuid = socket.binaryHandlerID(); + Connection connection = new Connection(uuid, id, service.getName()); connection.put("c-type", service.getSimpleName()); connection.put("gateway", service.getName());