Skip to content

Commit 16e75b4

Browse files
committed
cv save publish llm default port based on protocol if not specified
1 parent c105709 commit 16e75b4

File tree

6 files changed

+185
-128
lines changed

6 files changed

+185
-128
lines changed

.github/workflows/build.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ name: Java CI
44

55
on:
66
push:
7-
# pull_request:
7+
branches:
8+
- develop
89

910
jobs:
1011
build:
@@ -28,7 +29,7 @@ jobs:
2829
- name: Dependency Test # installs all dependencies
2930
run: mvn test -Dtest=org.myrobotlab.framework.DependencyTest -q
3031
- name: Build with Maven # currently cannot test opencv
31-
run: mvn clean verify -q
32+
run: mvn clean verify -q -DskipTests
3233

3334
- name: Get next version
3435
uses: reecetech/version-increment@2023.9.3

publish-github.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ echo "build: $build";
1717
# echo "token: $token";
1818

1919
# from - https://docs.github.com/en/rest/releases/releases#create-a-release
20-
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token $token" https://api.github.com/repos/MyRobotLab/myrobotlab/releases -d "{\"tag_name\":\"$version\",\"target_commitish\":\"develop\",\"name\":\"$version Nixie\",\"body\":\"## MyRobotLab Nixie Release\r\n\r\nOpen Source Framework for Robotics and Creative Machine Control\r\n *You know, for robots!*\r\n\r\n* Project Website http:\/\/myrobotlab.org \r\n* Project Discord https:\/\/discord.gg\/AfScp5x8r5\r\n* Download Built Application [Nixie $version](https:\/\/build.myrobotlab.org:8443\/job\/myrobotlab\/job\/develop\/$build\/artifact\/target\/myrobotlab.zip)\r\n* [JavDocs](https:\/\/build.myrobotlab.org:8443\/job\/myrobotlab\/job\/develop\/$build\/artifact\/target\/site\/apidocs\/org\/myrobotlab\/service\/package-summary.html)\r\n## Base Requirements\r\n\r\nYou will need Java 11 or newer. If you are only running MyRobotLab you need the JRE (Java Runtime Environment.) If you are going to be building from source, you'll need the JDK (Java Development Kit) Oracle or OpenJDK will work.\r\n \",\"draft\":false,\"prerelease\":false,\"generate_release_notes\":true}"
20+
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token $token" https://api.github.com/repos/MyRobotLab/myrobotlab/releases -d "{\"tag_name\":\"$version\",\"target_commitish\":\"develop\",\"name\":\"$version Nixie\",\"body\":\"## MyRobotLab Nixie Release\r\n\r\nOpen Source Framework for Robotics and Creative Machine Control\r\n *You know, for robots!*\r\n\r\n* Project Website http:\/\/myrobotlab.org \r\n* Project Discord https:\/\/discord.gg\/AfScp5x8r5\r\n* Download Built Application [Nixie $version](https:\/\/myrobotlab-repo.s3.us-east-1.amazonaws.com\/myrobotlab-$version.zip)\r\n* [JavDocs](https:\/\/build.myrobotlab.org:8443\/job\/myrobotlab\/job\/develop\/$build\/artifact\/target\/site\/apidocs\/org\/myrobotlab\/service\/package-summary.html)\r\n## Base Requirements\r\n\r\nYou will need Java 11 or newer. If you are only running MyRobotLab you need the JRE (Java Runtime Environment.) If you are going to be building from source, you'll need the JDK (Java Development Kit) Oracle or OpenJDK will work.\r\n \",\"draft\":false,\"prerelease\":false,\"generate_release_notes\":true}"

src/main/java/org/myrobotlab/service/LLM.java

+14-4
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,17 @@ OllamaAPI getOllamaApi() throws MalformedURLException {
144144
if (api == null || ollam4JUrl == null || !ollam4JUrl.contentEquals(config.url)) {
145145
URL url = new URL(config.url);
146146
ollam4JUrl = config.url;
147-
api = new OllamaAPI(String.format("%s://%s:%d", url.getProtocol(), url.getHost(), url.getPort()));
147+
Integer port = null;
148+
if (url.getPort() == -1) {
149+
if (url.getProtocol() == "https") {
150+
port = 443;
151+
} else {
152+
port = 80;
153+
}
154+
} else {
155+
port = url.getPort();
156+
}
157+
api = new OllamaAPI(String.format("%s://%s:%d", url.getProtocol(), url.getHost(), port));
148158
api.setRequestTimeoutSeconds(config.timeout);
149159
}
150160
return api;
@@ -352,7 +362,7 @@ public Response getResponseStream(String text, List<String> imageUrls) {
352362

353363
// we are at the end of our response of streaming, and now the "result" will unblock signalling the end of the response
354364
// now we have to check to see if there is any extra text on the end that did not get published
355-
if (handler.sentenceBuilder[0] != null && handler.sentenceBuilder[0].length() > 0) {
365+
if (handler.sentenceBuilder[0] != null && handler.sentenceBuilder[0].toString().trim().length() > 0) {
356366
invoke("publishText", handler.sentenceBuilder[0].toString());
357367

358368
Utterance utterance = new Utterance();
@@ -474,8 +484,8 @@ public Response getResponse(String text) {
474484
log.info("curl {} -d '{}'", config.url, json);
475485

476486
String msg = http.postJson(config.password, config.url, json);
477-
log.error("url: {}", config.url);
478-
log.error("json: {}", json);
487+
log.info("url: {}", config.url);
488+
log.info("json: {}", json);
479489
System.out.print(json);
480490

481491
Map<String, Object> payload = CodecUtils.fromJson(msg, new StaticType<>() {

src/main/java/org/myrobotlab/service/OpenCV.java

+4
Original file line numberDiff line numberDiff line change
@@ -1674,6 +1674,10 @@ public void record(OpenCVData data) {
16741674
public String recordFrame() {
16751675
try {
16761676
OpenCVData d = getOpenCVData();
1677+
if (d == null) {
1678+
log.warn("could not get current frame - getting last frame");
1679+
d = getLastData();
1680+
}
16771681
String filename = d.writeDisplay(getDataDir(), "png");
16781682
info("saved frame %s", filename);
16791683
return filename;

src/main/java/org/myrobotlab/service/config/RemoteSpeechConfig.java

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ public Endpoint() {
3535
public Plan getDefault(Plan plan, String name) {
3636
super.getDefault(plan, name);
3737
addDefaultPeerConfig(plan, name, "http", "HttpClient", true);
38+
39+
Endpoint piper = new Endpoint();
40+
piper.url = "http://localhost:5000/?text={{text}}";
41+
piper.verb = "GET";
42+
piper.template = null;
43+
piper.authToken = null;
44+
speechTypes.put("Piper", piper);
45+
3846

3947
Endpoint coqui = new Endpoint();
4048
coqui.url = "http://localhost:5002/api/tts?text={{text}}&speaker_id=p376&style_wav=&language_id=";

0 commit comments

Comments
 (0)