diff --git a/README.md b/README.md index 3c13c40..4f90e10 100755 --- a/README.md +++ b/README.md @@ -72,6 +72,8 @@ docker run -d -p 777:777 -e "OPENAI_API_KEY=[YOUR-OPENAI-API-KEY]" -e "STABILITY ![Web](https://github.com/tinystruct/smalltalk/assets/3631818/32e50145-a5be-41d6-9cea-5b25e76e9f1b) + + Demonstration --- A demonstration for the comet technology, without any websocket and support any web browser: diff --git a/bin/dispatcher b/bin/dispatcher index f23cfe3..cc2ef22 100755 --- a/bin/dispatcher +++ b/bin/dispatcher @@ -1,6 +1,6 @@ #!/usr/bin/env sh ROOT="$(pwd)" -VERSION="1.5.1" +VERSION="1.5.5" cd "$(dirname "$0")" || exit cd "../" # Navigate to the root directory diff --git a/bin/dispatcher.cmd b/bin/dispatcher.cmd index e06ffdc..542a49a 100755 --- a/bin/dispatcher.cmd +++ b/bin/dispatcher.cmd @@ -33,7 +33,7 @@ set "JAVA_CMD=%JAVA_HOME%\bin\java.exe" @REM Consolidate classpath entries, initialize ROOT and VERSION set "ROOT=%~dp0..\" -set "VERSION=1.5.1" +set "VERSION=1.5.5" set "classpath=%ROOT%target\classes;%ROOT%lib\tinystruct-%VERSION%-jar-with-dependencies.jar;%ROOT%lib\tinystruct-%VERSION%.jar;%ROOT%lib\*;%ROOT%WEB-INF\lib\*;%ROOT%WEB-INF\classes;%USERPROFILE%\.m2\repository\org\tinystruct\tinystruct\%VERSION%\tinystruct-%VERSION%-jar-with-dependencies.jar;%USERPROFILE%\.m2\repository\org\tinystruct\tinystruct\%VERSION%\tinystruct-%VERSION%.jar" @REM Run Java application diff --git a/pom.xml b/pom.xml index 8ca7d29..8d221db 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ org.tinystruct tinystruct - 1.5.1 + 1.6.9 diff --git a/src/main/java/custom/ai/OpenAI.java b/src/main/java/custom/ai/OpenAI.java index de2f287..a369951 100644 --- a/src/main/java/custom/ai/OpenAI.java +++ b/src/main/java/custom/ai/OpenAI.java @@ -14,9 +14,9 @@ import java.util.Base64; public class OpenAI extends AbstractApplication implements Provider { - public static final String IMAGES_GENERATIONS = "https://api.openai.com/v1/images/generations"; - public static final String IMAGES_EDITS = "https://api.openai.com/v1/images/edits"; - public static final String IMAGES_VARIATIONS = "https://api.openai.com/v1/images/variations"; + public static final String IMAGES_GENERATIONS = "/v1/images/generations"; + public static final String IMAGES_EDITS = "/v1/images/edits"; + public static final String IMAGES_VARIATIONS = "/v1/images/variations"; @Action("openai") public Builder call() throws ApplicationException { diff --git a/src/main/java/custom/application/v1/smalltalk.java b/src/main/java/custom/application/v1/smalltalk.java index bb53ee4..b92a5ba 100644 --- a/src/main/java/custom/application/v1/smalltalk.java +++ b/src/main/java/custom/application/v1/smalltalk.java @@ -78,7 +78,7 @@ public smalltalk index(Request request, Response response) { dispatcher.dispatch(new SessionCreated(String.valueOf(meetingCode))); } - List session_ids; + Set session_ids; final String sessionId = request.getSession().getId(); if (this.groups.get(meetingCode) == null) { this.groups.put(meetingCode.toString(), new ArrayBlockingQueue(DEFAULT_MESSAGE_POOL_SIZE)); @@ -86,10 +86,10 @@ public smalltalk index(Request request, Response response) { // If the current user is not in the list of the sessions, we create a default session list for the meeting generated. if ((session_ids = this.sessions.get(meetingCode)) == null) { - this.sessions.put(meetingCode.toString(), session_ids = new ArrayList()); + this.sessions.put(meetingCode.toString(), session_ids = new HashSet<>()); } - if (!session_ids.contains(sessionId)) session_ids.add(sessionId); + session_ids.add(sessionId); if (!this.list.containsKey(sessionId)) { this.list.put(sessionId, new ArrayDeque()); @@ -666,7 +666,7 @@ public String update(String meetingCode, String sessionId, Request request, Resp if (request.getSession().getId().equalsIgnoreCase(sessionId)) { String error = "{ \"error\": \"expired\" }"; if (this.groups.containsKey(meetingCode)) { - List list; + Set list; if ((list = sessions.get(meetingCode)) != null && list.contains(sessionId)) { return this.take(sessionId); } @@ -826,7 +826,7 @@ public void onSessionEvent(SessionEvent arg0) { this.save(meetingCode, builder); Queue messages; - List session_ids; + Set session_ids; if ((session_ids = this.sessions.get(meetingCode)) != null) { session_ids.remove(arg0.getSession().getId()); }