refactor: cleanup
This commit is contained in:
@@ -198,10 +198,10 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
|
||||
String _pretty(dynamic v, {int max = 1200}) {
|
||||
try {
|
||||
final pretty = const JsonEncoder.withIndent(' ').convert(v);
|
||||
return pretty.length > max ? pretty.substring(0, max) + '\n…' : pretty;
|
||||
return pretty.length > max ? '${pretty.substring(0, max)}\n…' : pretty;
|
||||
} catch (_) {
|
||||
final s = v?.toString() ?? '';
|
||||
return s.length > max ? s.substring(0, max) + '…' : s;
|
||||
return s.length > max ? '${s.substring(0, max)}…' : s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1164,11 +1164,9 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
|
||||
_textSub?.cancel();
|
||||
_textSub = stream.listen(
|
||||
(text) async {
|
||||
final updated =
|
||||
(_baseTextAtStart.isEmpty
|
||||
? ''
|
||||
: (_baseTextAtStart.trimRight() + ' ')) +
|
||||
text;
|
||||
final updated = _baseTextAtStart.isEmpty
|
||||
? text
|
||||
: '${_baseTextAtStart.trimRight()} $text';
|
||||
_controller.value = TextEditingValue(
|
||||
text: updated,
|
||||
selection: TextSelection.collapsed(offset: updated.length),
|
||||
|
||||
Reference in New Issue
Block a user