refactor(markdown): remove deprecated stream formatter and enhance preprocessor
This commit is contained in:
@@ -18,6 +18,7 @@ import '../providers/chat_providers.dart';
|
||||
import '../../../core/utils/debug_logger.dart';
|
||||
import '../../../core/utils/user_display_name.dart';
|
||||
import '../../../core/utils/model_icon_utils.dart';
|
||||
import '../../../shared/widgets/markdown/markdown_preprocessor.dart';
|
||||
import '../../../core/utils/android_assistant_handler.dart';
|
||||
import '../widgets/modern_chat_input.dart';
|
||||
import '../widgets/user_message_bubble.dart';
|
||||
@@ -1205,36 +1206,8 @@ class _ChatPageState extends ConsumerState<ChatPage> {
|
||||
}
|
||||
|
||||
void _copyMessage(String content) {
|
||||
// Strip reasoning details from the copied content
|
||||
String cleanedContent = content;
|
||||
|
||||
// Remove <details type="reasoning"> blocks
|
||||
cleanedContent = cleanedContent.replaceAll(
|
||||
RegExp(
|
||||
r'<details\s+type="reasoning"[^>]*>[\s\S]*?<\/details>',
|
||||
multiLine: true,
|
||||
dotAll: true,
|
||||
),
|
||||
'',
|
||||
);
|
||||
|
||||
// Remove raw reasoning tags
|
||||
cleanedContent = cleanedContent.replaceAll(
|
||||
RegExp(r'<think>[\s\S]*?<\/think>', multiLine: true, dotAll: true),
|
||||
'',
|
||||
);
|
||||
cleanedContent = cleanedContent.replaceAll(
|
||||
RegExp(
|
||||
r'<reasoning>[\s\S]*?<\/reasoning>',
|
||||
multiLine: true,
|
||||
dotAll: true,
|
||||
),
|
||||
'',
|
||||
);
|
||||
|
||||
// Clean up any extra whitespace
|
||||
cleanedContent = cleanedContent.trim();
|
||||
|
||||
// Strip reasoning blocks and annotations from copied content
|
||||
final cleanedContent = ConduitMarkdownPreprocessor.sanitize(content);
|
||||
Clipboard.setData(ClipboardData(text: cleanedContent));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../../core/providers/app_providers.dart';
|
||||
import '../../../core/utils/markdown_to_text.dart';
|
||||
import '../../../shared/widgets/markdown/markdown_preprocessor.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import '../../../shared/widgets/conduit_components.dart';
|
||||
import '../providers/chat_providers.dart';
|
||||
@@ -335,7 +335,7 @@ class _VoiceCallPageState extends ConsumerState<VoiceCallPage>
|
||||
} else if (_currentState == VoiceCallState.speaking &&
|
||||
_currentResponse.isNotEmpty) {
|
||||
// Convert markdown to clean text for display
|
||||
displayText = MarkdownToText.convert(_currentResponse);
|
||||
displayText = ConduitMarkdownPreprocessor.toPlainText(_currentResponse);
|
||||
}
|
||||
|
||||
if (displayText.isEmpty) {
|
||||
|
||||
Reference in New Issue
Block a user