mirror of
https://github.com/jie65535/JChatGPT.git
synced 2026-06-23 00:49:31 +08:00
Upgrade TTS to qwen3-tts-instruct-flash with instruction control
Adds an optional instructions parameter to sendVoiceMessage so the model can describe tone, pace and emotion in natural language. Defaults the TTS model to qwen3-tts-instruct-flash; Chelsie voice is unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -95,8 +95,8 @@ dashScopeApiKey: ''
|
|||||||
imageModel: 'qwen-image-2.0'
|
imageModel: 'qwen-image-2.0'
|
||||||
# 是否在生成图片右下角添加 Qwen-Image 水印
|
# 是否在生成图片右下角添加 Qwen-Image 水印
|
||||||
imageWatermark: false
|
imageWatermark: false
|
||||||
# 百炼平台TTS模型
|
# 百炼平台TTS模型,qwen3-tts-instruct-flash 支持 instructions 指令控制语气
|
||||||
ttsModel: 'qwen-tts'
|
ttsModel: 'qwen3-tts-instruct-flash'
|
||||||
# Jina API Key
|
# Jina API Key
|
||||||
jinaApiKey: ''
|
jinaApiKey: ''
|
||||||
# SearXNG 搜索引擎地址,如 http://127.0.0.1:8080/search 必须启用允许json格式返回
|
# SearXNG 搜索引擎地址,如 http://127.0.0.1:8080/search 必须启用允许json格式返回
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ object PluginConfig : AutoSavePluginConfig("Config") {
|
|||||||
@ValueDescription("是否在生成的图片右下角添加 Qwen-Image 水印")
|
@ValueDescription("是否在生成的图片右下角添加 Qwen-Image 水印")
|
||||||
val imageWatermark: Boolean by value(false)
|
val imageWatermark: Boolean by value(false)
|
||||||
|
|
||||||
@ValueDescription("百炼平台TTS模型")
|
@ValueDescription("百炼平台TTS模型。qwen3-tts-instruct-flash 支持 instructions 指令控制;纯发音可用 qwen3-tts-flash 或 qwen-tts")
|
||||||
val ttsModel: String by value("qwen-tts")
|
val ttsModel: String by value("qwen3-tts-instruct-flash")
|
||||||
|
|
||||||
@ValueDescription("Jina API Key")
|
@ValueDescription("Jina API Key")
|
||||||
val jinaApiKey by value("")
|
val jinaApiKey by value("")
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import kotlin.time.measureTime
|
|||||||
class SendVoiceMessage : BaseAgent(
|
class SendVoiceMessage : BaseAgent(
|
||||||
tool = Tool.function(
|
tool = Tool.function(
|
||||||
name = "sendVoiceMessage",
|
name = "sendVoiceMessage",
|
||||||
description = "发送一条文本转语音消息。",
|
description = "发送一条文本转语音消息。可选传入 instructions 用自然语言指令控制语气、语速、情感等表达方式,让语音更贴合当前对话氛围。",
|
||||||
parameters = Parameters.buildJsonObject {
|
parameters = Parameters.buildJsonObject {
|
||||||
put("type", "object")
|
put("type", "object")
|
||||||
putJsonObject("properties") {
|
putJsonObject("properties") {
|
||||||
@@ -29,6 +29,10 @@ class SendVoiceMessage : BaseAgent(
|
|||||||
put("type", "string")
|
put("type", "string")
|
||||||
put("description", "语音消息文本内容")
|
put("description", "语音消息文本内容")
|
||||||
}
|
}
|
||||||
|
putJsonObject("instructions") {
|
||||||
|
put("type", "string")
|
||||||
|
put("description", "可选。自然语言描述本句话的表达方式,例如\"语速较快,带有明显的上扬语调\"或\"温柔知性,语调平和\"。仅支持中英文。")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
putJsonArray("required") {
|
putJsonArray("required") {
|
||||||
add("content")
|
add("content")
|
||||||
@@ -52,6 +56,7 @@ class SendVoiceMessage : BaseAgent(
|
|||||||
if (event.subject !is AudioSupported) return "当前聊天环境不支持发送语音!"
|
if (event.subject !is AudioSupported) return "当前聊天环境不支持发送语音!"
|
||||||
|
|
||||||
val content = args.getValue("content").jsonPrimitive.content
|
val content = args.getValue("content").jsonPrimitive.content
|
||||||
|
val instructions = args["instructions"]?.jsonPrimitive?.content?.takeIf { it.isNotBlank() }
|
||||||
|
|
||||||
// https://help.aliyun.com/zh/model-studio/qwen-tts
|
// https://help.aliyun.com/zh/model-studio/qwen-tts
|
||||||
val response = httpClient.post(API_URL) {
|
val response = httpClient.post(API_URL) {
|
||||||
@@ -62,6 +67,10 @@ class SendVoiceMessage : BaseAgent(
|
|||||||
putJsonObject("input") {
|
putJsonObject("input") {
|
||||||
put("text", content)
|
put("text", content)
|
||||||
put("voice", "Chelsie") // Chelsie(女) Cherry(女) Ethan(男) Serena(女)
|
put("voice", "Chelsie") // Chelsie(女) Cherry(女) Ethan(男) Serena(女)
|
||||||
|
if (instructions != null) {
|
||||||
|
put("instructions", instructions)
|
||||||
|
put("optimize_instructions", true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.toString())
|
}.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user