[bugfix] chat bubble error and Pronounce ID.UNYX error
This commit is contained in:
@@ -78,6 +78,10 @@ class ChatSseService {
|
||||
break;
|
||||
}
|
||||
tempText += textChunk;
|
||||
if (tempText.contains("ID.")) {
|
||||
tempText = tempText.replaceAllMapped(
|
||||
RegExp(r'ID\.', caseSensitive: false), (m) => 'ID ');
|
||||
}
|
||||
int endIndex = _getCompleteTextEndIndex(tempText);
|
||||
String completeText = CommonUtil.cleanText(tempText.substring(0, endIndex).trim(), true);
|
||||
if (completeText.isNotEmpty) {
|
||||
@@ -136,7 +140,7 @@ class ChatSseService {
|
||||
|
||||
int _getCompleteTextEndIndex(String buffer) {
|
||||
// 支持句号、问号、感叹号和换行符作为分割依据
|
||||
final sentenceEnders = RegExp(r'[,!?:,。!?:\n]');
|
||||
final sentenceEnders = RegExp(r'[,.!?:,。!?:\n]');
|
||||
final matches = sentenceEnders.allMatches(buffer);
|
||||
return matches.isEmpty ? 0 : matches.last.end;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,15 @@ class MessageService extends ChangeNotifier {
|
||||
replaceMessage(id: _latestUserMessageId!, text: call.arguments);
|
||||
break;
|
||||
case "onAsrStop":
|
||||
int index = findMessageIndexById(_latestUserMessageId!);
|
||||
if (index == -1) {
|
||||
return;
|
||||
}
|
||||
final message = _messages[index];
|
||||
if (message.text.isEmpty) {
|
||||
removeMessageById(_latestUserMessageId!);
|
||||
return;
|
||||
}
|
||||
replaceMessage(
|
||||
id: _latestUserMessageId!, status: MessageStatus.normal);
|
||||
if (_asrCompleter != null && !_asrCompleter!.isCompleted) {
|
||||
|
||||
Reference in New Issue
Block a user