Skip to content

Commit 036363c

Browse files
committed
multi-language support
1 parent bb81f93 commit 036363c

File tree

1 file changed

+33
-34
lines changed

1 file changed

+33
-34
lines changed

java-ai/src/main/java/oracleai/aiholo/AIHoloController.java

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public class AIHoloController {
3939
private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
4040
private static final String API_URL = "http://129.x.x.x/v1/chat/completions?client=server";
4141
private static final String AUTH_TOKEN = "Bearer asdf";
42-
private static final String DEFAULT_LANGUAGE_CODE = "Bearer asdf";
43-
private static final String DEFAULT_VOICE_NAME = "Bearer asdf";
42+
private static final String DEFAULT_LANGUAGE_CODE = "pt-BR";
43+
private static final String DEFAULT_VOICE_NAME = "pt-BR-Wavenet-D";
4444

4545
@Autowired
4646
private DataSource dataSource;
@@ -67,37 +67,10 @@ private void startInactivityMonitor() {
6767
}
6868

6969

70-
@GetMapping("/set")
71-
public String setValue(@RequestParam("value") String value) {
72-
theValue = value;
73-
System.out.println("EchoController set: " + theValue);
74-
String filePath = "C:/Users/opc/aiholo_output.txt";
75-
try (FileWriter writer = new FileWriter(filePath)) {
76-
JSONObject json = new JSONObject();
77-
json.put("data", value); // Store the response inside JSON
78-
writer.write(json.toString());
79-
writer.flush();
80-
} catch (IOException e) {
81-
return "Error writing to file: " + e.getMessage();
82-
}
83-
84-
if (value.equals("mirrorme") || value.equals("question"))
85-
return "「ミラーミー」モードが正常に有効化されました";
86-
else
87-
return "set successfully: " + theValue;
88-
89-
}
90-
91-
@GetMapping("/get")
92-
public String getValue() {
93-
System.out.println("EchoController get: " + theValue);
94-
return theValue;
95-
}
96-
9770
static String sql = """
9871
SELECT DBMS_CLOUD_AI.GENERATE(
9972
prompt => ?,
100-
profile_name => 'VIDEO_GAMES',
73+
profile_name => 'VIDEOGAMES_PROFILE',
10174
action => ?
10275
) FROM dual
10376
""";
@@ -210,9 +183,6 @@ public String executeSandbox(String cummulativeResult) {
210183
return " I'm sorry, I couldn't find an answer";
211184
}
212185
}
213-
// `https://141.148.204.74:8444/aiholo/tts?textToConvert=${encodeURIComponent(textToConvert)}&languageCode=${encodeURIComponent(languageCode)}&ssmlGender=${encodeURIComponent(ssmlGender)}&voiceName=${encodeURIComponent(voiceName)}`;
214-
215-
216186

217187
// `https://host:port/aiholo/tts?textToConvert=${encodeURIComponent(textToConvert)}&languageCode=${encodeURIComponent(languageCode)}&ssmlGender=${encodeURIComponent(ssmlGender)}&voiceName=${encodeURIComponent(voiceName)}`;
218188
@GetMapping("/tts")
@@ -266,5 +236,34 @@ public static String getFirst10Chars(String textToConvert) {
266236
return "";
267237
}
268238
return textToConvert.length() > 10 ? textToConvert.substring(0, 10) : textToConvert;
269-
}
239+
}
240+
241+
242+
@GetMapping("/set")
243+
public String setValue(@RequestParam("value") String value) {
244+
theValue = value;
245+
System.out.println("EchoController set: " + theValue);
246+
String filePath = "C:/Users/opc/aiholo_output.txt";
247+
try (FileWriter writer = new FileWriter(filePath)) {
248+
JSONObject json = new JSONObject();
249+
json.put("data", value); // Store the response inside JSON
250+
writer.write(json.toString());
251+
writer.flush();
252+
} catch (IOException e) {
253+
return "Error writing to file: " + e.getMessage();
254+
}
255+
256+
if (value.equals("mirrorme") || value.equals("question"))
257+
return "「ミラーミー」モードが正常に有効化されました";
258+
else
259+
return "set successfully: " + theValue;
260+
261+
}
262+
263+
@GetMapping("/get")
264+
public String getValue() {
265+
System.out.println("EchoController get: " + theValue);
266+
return theValue;
267+
}
268+
270269
}

0 commit comments

Comments
 (0)