Merge branch 'feature/oneapp-0812-ds' into feature/oneapp-0812

# Conflicts:
#	lib/services/chat_sse_service.dart
This commit is contained in:
Chen Li
2025-08-21 14:43:53 +08:00
5 changed files with 19 additions and 7 deletions

BIN
assets/images/ai0_hd_en.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
assets/images/ai1_hd_en.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@@ -67,12 +67,12 @@ class _FullScreenState extends State<FullScreen> {
_scrollToBottom();
});
if (messageService.messages.isEmpty) {
// Future.delayed(const Duration(milliseconds: 500), () {
Future.delayed(const Duration(milliseconds: 500), () {
String text = Intl.getCurrentLocale().startsWith('zh')
? "您好,我是众众,请问有什么可以帮您?"
: "Hi, I'm Zhongzhong, may I help you ? ";
messageService.addMessage(text, false, MessageStatus.normal);
// });
});
}
return ChatBox(
scrollController: _scrollController,

View File

@@ -59,8 +59,7 @@ class ChatSseService {
txt = txt.substring(0, imgStart) + txt.substring(imgEnd + 1);
imgStart = txt.indexOf('![');
}
// 彻底移除 markdown 有序/无序列表序号(如 1.、2.、-、*、+
txt = txt.replaceAll(RegExp(r'(^|\n)[ \t]*[0-9]+\.[ \t]*'), '\n');
txt = txt.replaceAll(RegExp(r'(^|\n)[ \t]*[-\*\+][ \t]+'), '\n');
// 分句符
RegExp enders = isChinese ? zhEnders : enEnders;
@@ -77,8 +76,14 @@ class ChatSseService {
}
// 只在达到完整句子时调用 TtsUtil.send
for (final s in sentences) {
String ttsStr=CommonUtil.cleanText(s, true);
// print("发送数据到TTS: $ttsStr");
String ttsStr=CommonUtil.cleanText(s, true)+"\n";
ttsStr = ttsStr.replaceAllMapped(
RegExp(r'(?<!\s)(\d+)(?!\s)'),
(m) => ' ${m.group(1)} ',
);
print("发送数据到TTS: $ttsStr");
TtsUtil.send(ttsStr);
}
// 缓存剩余不完整部分

View File

@@ -5,6 +5,7 @@ import '../screens/full_screen.dart';
import '../screens/part_screen.dart';
import 'floating_icon_with_wave.dart';
import 'dart:async'; // 添加此行
import 'package:basic_intl/intl.dart';
class FloatingIcon extends StatefulWidget {
const FloatingIcon({super.key});
@@ -27,6 +28,11 @@ class _FloatingIconState extends State<FloatingIcon>
'assets/images/ai1_hd.png',
'assets/images/ai0_hd.png',
];
late final List<String> _iconImagesEn = [
'assets/images/ai1_hd_en.png',
'assets/images/ai0_hd_en.png',
];
Timer? _imageTimer; // 用于定时切换图片
@override
@@ -130,7 +136,8 @@ class _FloatingIconState extends State<FloatingIcon>
waveColor: Colors.white,
)
: Image.asset(
_iconImages[_imageIndex],
Intl.getCurrentLocale().startsWith('zh')
? _iconImages[_imageIndex]:_iconImagesEn[_imageIndex],
width: iconSize,
height: iconSize,
),