Skip to content

Commit e06a759

Browse files
committed
adjustments for discovery
1 parent 8e8f695 commit e06a759

25 files changed

Lines changed: 692 additions & 79 deletions
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package elite.intel.ai.brain.handlers.query;
22

33
import com.google.gson.JsonObject;
4+
import elite.intel.gameapi.journal.events.dto.BioSampleDto;
45
import elite.intel.gameapi.journal.events.dto.LocationDto;
56
import elite.intel.session.PlayerSession;
7+
import elite.intel.util.json.GsonFactory;
8+
import elite.intel.util.json.ToJsonConvertible;
9+
10+
import java.util.List;
611

712
public class AnalyzeCurrentPlanetHandler extends BaseQueryAnalyzer implements QueryHandler {
813

@@ -11,6 +16,13 @@ public class AnalyzeCurrentPlanetHandler extends BaseQueryAnalyzer implements Qu
1116
@Override public JsonObject handle(String action, JsonObject params, String originalUserInput) throws Exception {
1217
PlayerSession playerSession = PlayerSession.getInstance();
1318
LocationDto currentLocation = playerSession.getCurrentLocation();
14-
return analyzeData(currentLocation.toJson(), originalUserInput);
19+
List<BioSampleDto> bioSamples = playerSession.getBioSamples();
20+
return analyzeData(new DataDto(currentLocation,bioSamples).toJson(), originalUserInput);
21+
}
22+
23+
record DataDto(LocationDto location, List<BioSampleDto> bioSamples) implements ToJsonConvertible {
24+
@Override public String toJson() {
25+
return GsonFactory.getGson().toJson(this);
26+
}
1527
}
1628
}

app/src/main/java/elite/intel/ai/brain/openai/OpenAiContextFactory.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private OpenAiContextFactory() {
3232
StringBuilder sb = new StringBuilder();
3333
getSessionValues(sb);
3434
appendBehavior(sb);
35-
sb.append("Instructions: Analyze this input: ").append(sensorInput).append(". prefer shortName for stellar objects ");
35+
sb.append("Instructions: Analyze this input: ").append(sensorInput).append(". Use shortName for stellar objects. ");
3636
return sb.toString();
3737
}
3838

@@ -176,12 +176,13 @@ private String generateSupportedCommandsCause() {
176176
sb.append("Apply personality: ").append(aiPersonality.name().toUpperCase()).append(" - ").append(aiPersonality.getBehaviorClause()).append(" ");
177177
sb.append("For star system codes or ship plates (e.g., RH-F), use NATO phonetic alphabet (e.g., Romeo Hotel dash Foxtrot). ");
178178
sb.append("Spell out numerals in full words (e.g., 285 = two hundred and eighty-five, 27 = twenty-seven). ");
179-
sb.append("Gravity units in G, Temperature units Kelvin provide conversion to Celsius. Mass units metric");
179+
sb.append("Gravity units in G, Temperature units Kelvin provide conversion to Celsius. Mass units metric. NEVER USE GRAMS!!!!!!!!!!!!!!");
180180
sb.append("Distances between stars in light years. Distance between planets in light seconds.");
181+
sb.append("Bio samples are taken from organisms not stellar objects.");
181182
sb.append("Round billions to nearest million. ");
182183
sb.append("Round millions to nearest 250000. ");
183184
sb.append("Start responses directly with the requested information, avoiding conversational fillers like 'noted,' 'well,' 'right,' 'understood,' or similar phrases. ");
184-
sb.append("Do not end your response with a question.");
185+
sb.append("Do not end responses with any fillers, conversational closers, or unnecessary phrases like 'Ready for exploration', 'Ready for orders', 'All set', 'Ready to explore', or similar open-ended questions or remarks.");
185186
if (personality.equals(AIPersonality.UNHINGED) || personality.equals(AIPersonality.FRIENDLY)) {
186187
sb.append("For UNHINGED personality, use playful slang matching cadence.");
187188
}

app/src/main/java/elite/intel/ai/ears/google/GoogleSTTImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public void stop() {
194194
*/
195195
@SuppressWarnings("deprecation") private void startStreaming() { // v2 is not an option as it is for SAAS v1 uses bidiStreamingCall and there is no upgrade
196196
int retryCount = 0;
197-
int maxRetries = 5; // Cap to prevent infinite loops
197+
int maxRetries = 15; // Cap to prevent infinite loops
198198
StringBuffer currentTranscript = new StringBuffer();
199199
List<Float> confidences = Collections.synchronizedList(new ArrayList<>());
200200
while (isListening.get()) {
@@ -225,7 +225,8 @@ public void onNext(StreamingRecognizeResponse response) {
225225

226226
@Override
227227
public void onError(Throwable t) {
228-
log.error("STT error: {}", t.getMessage(), t);
228+
log.warn("STT error: {}", t.getMessage());
229+
throw new RuntimeException("retry");
229230
}
230231

231232
@Override
@@ -319,7 +320,7 @@ public void onCompleted() {
319320
if (isStreamingModeOn) {
320321
String voiceName = SystemSession.getInstance().getAIVoice().getName();
321322
if (sanitizedTranscript.toLowerCase().startsWith("computer") || sanitizedTranscript.toLowerCase().startsWith(voiceName.toLowerCase())) {
322-
sendToAi(sanitizedTranscript.replace("computer,", "").replace(voiceName.toLowerCase() + ",", ""), avgConfidence);
323+
sendToAi(sanitizedTranscript.replace("computer,", "").replace(voiceName.toLowerCase() + ",", ""), 100);
323324
}
324325
} else {
325326
sendToAi(sanitizedTranscript, avgConfidence);

app/src/main/java/elite/intel/ai/mouth/google/GoogleTTSImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private void speak(String text, AiVoices aiVoice) {
189189
log.debug("Added VoiceRequest to queue: text='{}', voice='{}'", text, aiVoice.getName());
190190
} catch (InterruptedException e) {
191191
Thread.currentThread().interrupt();
192-
log.error("Interrupted while adding voice request to queue", e);
192+
log.warn("Interrupted while adding voice request to queue");
193193
}
194194
}
195195

@@ -289,7 +289,6 @@ private void processVoiceRequest(String text, String voiceName, double speechRat
289289
AudioConfig config = AudioConfig.newBuilder()
290290
.setAudioEncoding(AudioEncoding.LINEAR16)
291291
.setSpeakingRate(speechRate)
292-
.setVolumeGainDb(-3)
293292
.build();
294293
SynthesizeSpeechResponse response = textToSpeechClient.synthesizeSpeech(input, voice, config);
295294
long apiEndTime = System.currentTimeMillis();

app/src/main/java/elite/intel/gameapi/JournalParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public synchronized void stop() {
7676
processingThread.join(5000); // Wait up to 5 seconds for clean shutdown
7777
log.info("JournalParser stopped");
7878
} catch (InterruptedException e) {
79-
log.error("Interrupted while waiting for JournalParser to stop", e);
79+
log.warn("Interrupted while waiting for JournalParser to stop");
8080
Thread.currentThread().interrupt(); // Restore interrupted status
8181
}
8282
processingThread = null;

0 commit comments

Comments
 (0)