Skip to content

Commit 51f6bcb

Browse files
committed
Merge remote-tracking branch 'origin-private/main'
2 parents 83d80e0 + fc389dc commit 51f6bcb

File tree

17 files changed

+1030
-185
lines changed

17 files changed

+1030
-185
lines changed

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,42 @@
11
# 变更日志
2+
## [2.7.60] - 2025-06-11
3+
4+
### 新功能
5+
- Merge pull request #96 from vritser/main
6+
- feat(tts): support minimax t2a
7+
8+
### 修复
9+
- fix:修复阿里语音合成多余参数,删除
10+
- fix(tts): tts service factory
11+
12+
### 其他变更
13+
- chore: update version to 2.7.60 [skip ci]
14+
- docs: update changelog for v2.7.59 [skip ci]
15+
- chore: update version to 2.7.59 [skip ci]
16+
- refactor(tts): add default implements
17+
- docs: update changelog for v2.7.58 [skip ci]
18+
- chore: update version to 2.7.58 [skip ci]
19+
20+
## [2.7.59] - 2025-06-11
21+
22+
### 新功能
23+
- Merge pull request #96 from vritser/main
24+
- feat(tts): support minimax t2a
25+
26+
### 修复
27+
- fix(tts): tts service factory
28+
29+
### 其他变更
30+
- chore: update version to 2.7.59 [skip ci]
31+
- refactor(tts): add default implements
32+
- docs: update changelog for v2.7.58 [skip ci]
33+
- chore: update version to 2.7.58 [skip ci]
34+
35+
## [2.7.58] - 2025-06-09
36+
37+
### 其他变更
38+
- chore: update version to 2.7.58 [skip ci]
39+
240
## [2.7.57] - 2025-06-09
341

442

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,16 @@ Xiaozhi ESP32 Server Java 是基于 [Xiaozhi ESP32](https://github.com/78/xiaozh
225225

226226
---
227227

228+
## 免责声明 ⚠️
229+
230+
本项目仅提供音乐和绘本播放的技术实现代码,不提供任何媒体内容。用户在使用相关功能时应确保拥有合法的使用权或版权许可,并遵守所在地区的版权法律法规。
231+
232+
项目中可能涉及的示例内容或资源均来自网络或由用户投稿提供,仅用于功能演示和技术测试。如有任何内容侵犯了您的权益,请立即联系我们,我们将在核实后立即采取删除等处理措施。
233+
234+
本项目开发者不对用户使用本项目代码获取或播放的任何内容承担法律责任。使用本项目即表示您同意自行承担使用过程中的全部法律风险和责任。
235+
236+
---
237+
228238
## Star History 📈
229239

230240
<a href="https://www.star-history.com/#joey-zhou/xiaozhi-esp32-server-java&Date">

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</parent>
1010
<groupId>com.xiaozhi.server</groupId>
1111
<artifactId>xiaozhi.server</artifactId>
12-
<version>2.7.57</version>
12+
<version>2.7.60</version>
1313
<name>xiaozhi-server</name>
1414
<description></description>
1515

src/main/java/com/xiaozhi/communication/common/MessageHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public void handleUnboundDevice(String sessionId, SysDevice device) {
211211
if (device.getDeviceName() != null && device.getModelId() == null) {
212212
String message = "设备未配置对话模型,请到配置页面完成配置后开始对话";
213213

214-
String audioFilePath = ttsService.getTtsService().textToSpeech(message);
214+
String audioFilePath = ttsService.getDefaultTtsService().textToSpeech(message);
215215
audioService.sendAudioMessage(chatSession, new DialogueService.Sentence(message, audioFilePath), true,
216216
true);
217217

@@ -231,7 +231,7 @@ public void handleUnboundDevice(String sessionId, SysDevice device) {
231231
String audioFilePath;
232232
if (!StringUtils.hasText(codeResult.getAudioPath())) {
233233
String codeMessage = "请到设备管理页面添加设备,输入验证码" + codeResult.getCode();
234-
audioFilePath = ttsService.getTtsService().textToSpeech(codeMessage);
234+
audioFilePath = ttsService.getDefaultTtsService().textToSpeech(codeMessage);
235235
codeResult.setDeviceId(deviceId);
236236
codeResult.setSessionId(sessionId);
237237
codeResult.setAudioPath(audioFilePath);
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.xiaozhi.dialogue.llm.tool.function;
2+
3+
import cn.hutool.core.map.MapUtil;
4+
import cn.hutool.core.util.RandomUtil;
5+
import com.xiaozhi.communication.common.ChatSession;
6+
import com.xiaozhi.dialogue.llm.ChatService;
7+
import com.xiaozhi.dialogue.llm.tool.ToolCallStringResultConverter;
8+
import com.xiaozhi.dialogue.llm.tool.ToolsGlobalRegistry;
9+
import com.xiaozhi.dialogue.service.HuiBenService;
10+
import jakarta.annotation.Resource;
11+
import org.slf4j.Logger;
12+
import org.slf4j.LoggerFactory;
13+
import org.springframework.ai.chat.model.ToolContext;
14+
import org.springframework.ai.tool.ToolCallback;
15+
import org.springframework.ai.tool.function.FunctionToolCallback;
16+
import org.springframework.ai.tool.metadata.ToolMetadata;
17+
import org.springframework.stereotype.Component;
18+
19+
import java.util.Map;
20+
21+
@Component
22+
public class PlayHuiBenFunction implements ToolsGlobalRegistry.GlobalFunction {
23+
private static final Logger logger = LoggerFactory.getLogger(PlayHuiBenFunction.class);
24+
25+
@Resource
26+
private HuiBenService huiBenService;
27+
28+
ToolCallback toolCallback = FunctionToolCallback
29+
.builder("func_playHuiBen", (Map<String, String> params, ToolContext toolContext) -> {
30+
ChatSession chatSession = (ChatSession) toolContext.getContext().get(ChatService.TOOL_CONTEXT_SESSION_KEY);
31+
Integer num = MapUtil.getInt(params, "num");
32+
try {
33+
if (num == null || num < 5 || num > 1100) {
34+
num = RandomUtil.randomInt(5, 1100);
35+
}
36+
huiBenService.playHuiBen(chatSession, num);
37+
return "尝试播放绘本《" + num + "》";
38+
39+
} catch (Exception e) {
40+
logger.error("播放绘本异常,绘本编号: {}", num, e);
41+
return "绘本播放失败";
42+
}
43+
})
44+
.toolMetadata(ToolMetadata.builder().returnDirect(true).build())
45+
.description("绘本播放助手,需要用户提供绘本数字编号")
46+
.inputSchema("""
47+
{
48+
"type": "object",
49+
"properties": {
50+
"num": {
51+
"type": "integer",
52+
"description": "要播放的绘本数字编号"
53+
}
54+
},
55+
"required": ["num"]
56+
}
57+
""")
58+
.inputType(Map.class)
59+
.toolCallResultConverter(ToolCallStringResultConverter.INSTANCE)
60+
.build();
61+
62+
@Override
63+
public ToolCallback getFunctionCallTool(ChatSession chatSession) {
64+
return toolCallback;
65+
}
66+
}

0 commit comments

Comments
 (0)