feat: 优化 Agent 运行时与聊天设置体验

This commit is contained in:
qzl
2026-03-16 18:32:09 +08:00
parent 3f79cf0df7
commit 5a34616287
41 changed files with 2603 additions and 1263 deletions
@@ -94,24 +94,28 @@ class UiSchemaRenderer {
final status = _asString(node['status']);
final style = switch (role) {
'title' => const TextStyle(
fontSize: 17,
fontSize: 22,
fontWeight: FontWeight.w700,
color: AppColors.slate900,
height: 1.25,
height: 1.2,
),
'subtitle' => const TextStyle(
fontSize: 15,
fontSize: 16,
fontWeight: FontWeight.w600,
color: AppColors.slate800,
),
'caption' => const TextStyle(fontSize: 12, color: AppColors.slate500),
'caption' => const TextStyle(
fontSize: 12,
color: AppColors.slate500,
height: 1.4,
),
'code' => const TextStyle(
fontSize: 12,
color: AppColors.slate700,
fontFamily: 'monospace',
),
_ => const TextStyle(
fontSize: 14,
fontSize: 15,
color: AppColors.slate700,
height: 1.45,
),
@@ -139,16 +143,17 @@ class UiSchemaRenderer {
final bg = _statusBackground(status);
return Container(
padding: const EdgeInsets.symmetric(
horizontal: AppSpacing.sm,
horizontal: AppSpacing.md,
vertical: AppSpacing.xs,
),
decoration: BoxDecoration(
color: bg,
borderRadius: BorderRadius.circular(AppRadius.full),
border: Border.all(color: _statusBorder(status)),
),
child: Text(
_asString(node['label']),
style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, color: fg),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w700, color: fg),
),
);
}
@@ -173,17 +178,20 @@ class UiSchemaRenderer {
style: ElevatedButton.styleFrom(
elevation: 0,
padding: const EdgeInsets.symmetric(
horizontal: AppSpacing.md,
vertical: AppSpacing.sm,
horizontal: AppSpacing.lg,
vertical: AppSpacing.md,
),
backgroundColor: style == 'primary'
? AppColors.blue600
: AppColors.homeComposerAccent,
? AppColors.authPrimaryButton
: AppColors.surfaceInfoLight,
foregroundColor: style == 'primary'
? AppColors.white
: AppColors.slate700,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppRadius.md),
borderRadius: BorderRadius.circular(AppRadius.full),
side: style == 'primary'
? BorderSide.none
: const BorderSide(color: AppColors.borderTertiary),
),
),
child: Text(
@@ -211,32 +219,43 @@ class UiSchemaRenderer {
fallback: _asString(item['key']),
);
final value = item['value']?.toString() ?? '-';
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 3,
child: Text(
label,
style: const TextStyle(
fontSize: 12,
color: AppColors.slate500,
return Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(
horizontal: AppSpacing.md,
vertical: AppSpacing.sm,
),
decoration: BoxDecoration(
color: AppColors.surfaceSecondary,
borderRadius: BorderRadius.circular(AppRadius.md),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 3,
child: Text(
label,
style: const TextStyle(
fontSize: 12,
color: AppColors.slate500,
),
),
),
),
const SizedBox(width: AppSpacing.sm),
Expanded(
flex: 5,
child: Text(
value,
style: const TextStyle(
fontSize: 13,
color: AppColors.slate800,
fontWeight: FontWeight.w500,
const SizedBox(width: AppSpacing.sm),
Expanded(
flex: 5,
child: Text(
value,
style: const TextStyle(
fontSize: 13,
color: AppColors.slate800,
fontWeight: FontWeight.w600,
),
),
),
),
],
],
),
);
}).toList(),
AppSpacing.xs,
@@ -259,7 +278,8 @@ class UiSchemaRenderer {
return child;
}
final bg = switch (appearance) {
'section' => AppColors.homeComposerInner,
'section' => AppColors.surfaceSecondary,
'card' => AppColors.white,
_ => _statusBackground(status),
};
final borderColor = switch (status) {
@@ -270,16 +290,16 @@ class UiSchemaRenderer {
};
return Container(
width: double.infinity,
padding: const EdgeInsets.all(AppSpacing.lg),
padding: const EdgeInsets.all(AppSpacing.xl),
decoration: BoxDecoration(
color: bg,
borderRadius: BorderRadius.circular(AppRadius.lg),
borderRadius: BorderRadius.circular(AppRadius.xl),
border: Border.all(color: borderColor),
boxShadow: [
BoxShadow(
color: AppColors.blue100.withValues(alpha: 0.35),
blurRadius: 18,
offset: const Offset(0, 8),
color: AppColors.slate200.withValues(alpha: 0.6),
blurRadius: 20,
offset: const Offset(0, 10),
),
],
),
@@ -325,7 +345,17 @@ class UiSchemaRenderer {
'warning' => AppColors.feedbackWarningSurface,
'error' => AppColors.feedbackErrorSurface,
'pending' => AppColors.feedbackInfoSurface,
_ => AppColors.homeConversationSurface,
_ => AppColors.surfaceSecondary,
};
}
static Color _statusBorder(String status) {
return switch (status) {
'success' => AppColors.feedbackSuccessBorder,
'warning' => AppColors.feedbackWarningBorder,
'error' => AppColors.feedbackErrorBorder,
'pending' => AppColors.feedbackInfoBorder,
_ => AppColors.borderTertiary,
};
}