Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public class AudioSpeechRequest extends CommonRequest implements ClientRequest<M
*/
private String responseFormat;

/**
* 需要流式返回的音频编码格式
*/
private String encodeFormat;

/**
* 敏感词检测控制
*/
Expand All @@ -58,6 +63,7 @@ public Map<String, Object> getOptions() {
paramsMap.put("stream", this.isStream());
paramsMap.put("voice", this.getVoice());
paramsMap.put("response_format", this.getResponseFormat());
paramsMap.put("encode_format", this.getEncodeFormat());
paramsMap.put("sensitive_word_check", this.getSensitiveWordCheck());
if(this.getExtraJson() !=null){
paramsMap.putAll(this.getExtraJson());
Expand Down
7 changes: 4 additions & 3 deletions src/test/java/com/zhipu/oapi/V4Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class V4Test {
private static final String API_BASE_URL = Constants.getBaseUrl();


private static final ClientV4 client = new ClientV4.Builder(API_BASE_URL,API_SECRET_KEY)
private static final ClientV4 client = new ClientV4.Builder(API_BASE_URL, API_SECRET_KEY)
.enableTokenCache()
.networkConfig(300, 100, 100, 100, TimeUnit.SECONDS)
.connectionPool(new okhttp3.ConnectionPool(8, 1, TimeUnit.SECONDS))
Expand Down Expand Up @@ -673,8 +673,9 @@ public void testAudioSpeechStreaming() throws IOException {
AudioSpeechRequest audioSpeechRequest =
AudioSpeechRequest.builder()
.model(Constants.ModelTTS)
.input("智谱,你好呀")
.voice("tongtong")
.encodeFormat("base64")
.input("你好,欢迎来到智谱开放平台")
.voice("female")
.stream(Boolean.TRUE)
.responseFormat("wav")
.build();
Expand Down