The-Agency/lib/ui/widgets/chat/bubbles/tools/default_tool_bubble.dart

43 lines
1.1 KiB
Dart

import "dart:convert";
import "package:shadcn_flutter/shadcn_flutter.dart";
import "tool_bubble_base.dart";
class DefaultToolBubble extends StatelessWidget {
const DefaultToolBubble({
super.key,
required this.toolName,
this.input,
this.result,
this.isPendingPermission = false,
});
final String toolName;
final Map<String, dynamic>? input;
final String? result;
final bool isPendingPermission;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return ToolBubbleBase(
toolName: toolName,
icon: LucideIcons.wrench,
result: result,
isPendingPermission: isPendingPermission,
body: input != null && input!.isNotEmpty
? Padding(
padding: const EdgeInsets.only(left: 4),
child: Text(
const JsonEncoder.withIndent(" ").convert(input),
style: theme.typography.p.copyWith(
fontSize: 12,
color: theme.colorScheme.mutedForeground,
fontFamily: "monospace",
),
),
)
: null,
);
}
}