You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.7 KiB
54 lines
1.7 KiB
package marusia.entities;
|
|
|
|
import marusia.enums.AudioType;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
public class MarusiaRequest extends BaseRequest {
|
|
public Map createTextResponse(String text, String tts) {
|
|
return Map.of(
|
|
"response", Map.of(
|
|
"text", text,
|
|
"tts", tts,
|
|
"end_session", false
|
|
),
|
|
"session", getSessionInfo(),
|
|
"version", getVersion()
|
|
);
|
|
}
|
|
|
|
public Map createTextResponse(String text) {
|
|
return createTextResponse(text, text);
|
|
}
|
|
|
|
public Map createTTSResponse(String tts) {
|
|
return Map.of(
|
|
"response", Map.of(
|
|
"tts", tts,
|
|
"end_session", false
|
|
),
|
|
"session", getSessionInfo(),
|
|
"version", getVersion()
|
|
);
|
|
}
|
|
|
|
public Map createAudioResponse(AudioType audioType, String source) {
|
|
return Map.of(
|
|
"session", getSessionInfo(),
|
|
"version", getVersion(),
|
|
"response", Map.of("audio_player", Map.of(
|
|
"seek_track", 0,
|
|
"seek_second", 0,
|
|
"playlist", List.of(
|
|
Map.of("stream", Map.of(
|
|
"source_type", audioType.name(),
|
|
"source", source,
|
|
"track_id", source
|
|
))
|
|
)
|
|
), "end_session", false
|
|
)
|
|
);
|
|
}
|
|
}
|
|
|