feat(workspace): 桌面工作区、主题与交互更新,发布 0.1.2
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
This commit was merged in pull request #13.
This commit is contained in:
1 parent
aa5255d1e4
commit
abc1868550
260 files changed
+43964
-5591
No files matched your search
@@ -5,12 +5,14 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../integrations/editor_tools.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
|
||||
import '../../integrations/mcp/mcp_settings.dart';
|
||||
import 'settings_layout.dart';
|
||||
import '../../settings/settings_operation.dart';
|
||||
import '../../shared/widgets/error_notification_host.dart';
|
||||
|
||||
class McpSettingsPanel extends ConsumerStatefulWidget {
|
||||
const McpSettingsPanel({super.key, this.workspace});
|
||||
@@ -53,38 +55,42 @@ class _McpSettingsPanelState extends ConsumerState<McpSettingsPanel> {
|
||||
final settings = ref.watch(mcpSettingsProvider);
|
||||
final value = settings.asData?.value;
|
||||
final ids = widget.workspace;
|
||||
final connection = ids == null
|
||||
? null
|
||||
: ref.watch(editorMcpConnectionProvider(ids.$1, ids.$2));
|
||||
final status = value?.enabled != true
|
||||
? context.l10n.disabled
|
||||
: ids == null
|
||||
? context.l10n.waitingForProject
|
||||
: connection!.hasError
|
||||
? context.l10n.startFailed
|
||||
: connection.isLoading
|
||||
? context.l10n.starting
|
||||
: context.l10n.running;
|
||||
return SettingsPageSection(
|
||||
title: 'MCP',
|
||||
icon: Icons.terminal_outlined,
|
||||
icon: AppIcons.terminal,
|
||||
children: [
|
||||
AppField(
|
||||
label: context.l10n.mcpService,
|
||||
description: settings.isLoading
|
||||
? context.l10n.loadingSettings
|
||||
: status,
|
||||
orientation: AppFieldOrientation.horizontal,
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: AppSwitch(
|
||||
semanticLabel: context.l10n.mcpService,
|
||||
value: value?.enabled ?? false,
|
||||
onChanged: value == null || operation.isLoading
|
||||
? null
|
||||
: (enabled) => _toggle(enabled, value),
|
||||
),
|
||||
),
|
||||
Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final connection = ids == null
|
||||
? null
|
||||
: ref.watch(editorMcpConnectionProvider(ids.$1, ids.$2));
|
||||
final status = value?.enabled != true
|
||||
? context.l10n.disabled
|
||||
: ids == null
|
||||
? context.l10n.waitingForProject
|
||||
: connection!.hasError
|
||||
? context.l10n.startFailed
|
||||
: connection.isLoading
|
||||
? context.l10n.starting
|
||||
: context.l10n.running;
|
||||
return AppField(
|
||||
label: context.l10n.mcpService,
|
||||
description: settings.isLoading
|
||||
? context.l10n.loadingSettings
|
||||
: status,
|
||||
orientation: AppFieldOrientation.horizontal,
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: AppSwitch(
|
||||
semanticLabel: context.l10n.mcpService,
|
||||
value: value?.enabled ?? false,
|
||||
onChanged: value == null || operation.isLoading
|
||||
? null
|
||||
: (enabled) => _toggle(enabled, value),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (value != null) ...[
|
||||
AppField(
|
||||
@@ -95,6 +101,7 @@ class _McpSettingsPanelState extends ConsumerState<McpSettingsPanel> {
|
||||
child: TextFormField(
|
||||
style: AppTheme.inputTextStyle(context),
|
||||
cursorHeight: AppTheme.inputCursorHeight(context),
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
initialValue: '${value.port}',
|
||||
enabled: !value.enabled && !operation.isLoading,
|
||||
keyboardType: TextInputType.number,
|
||||
@@ -111,13 +118,13 @@ class _McpSettingsPanelState extends ConsumerState<McpSettingsPanel> {
|
||||
label: context.l10n.accessToken,
|
||||
child: IconButton(
|
||||
tooltip: context.l10n.copyAccessToken,
|
||||
icon: const Icon(Icons.copy_outlined),
|
||||
icon: const Icon(AppIcons.copy),
|
||||
onPressed: () async {
|
||||
await Clipboard.setData(ClipboardData(text: value.token));
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(context.l10n.accessTokenCopied)),
|
||||
);
|
||||
ErrorNotificationHost.of(
|
||||
context,
|
||||
).showMessage(content: Text(context.l10n.accessTokenCopied));
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -128,22 +135,35 @@ class _McpSettingsPanelState extends ConsumerState<McpSettingsPanel> {
|
||||
onPressed: () => ref.invalidate(mcpSettingsProvider),
|
||||
child: Text(context.l10n.loadMcpFailed),
|
||||
),
|
||||
if (value?.enabled == true && connection?.hasError == true) ...[
|
||||
Text(
|
||||
context.l10n.mcpStartError(
|
||||
context.l10n.errorMessage(connection!.error!),
|
||||
),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: operation.isLoading
|
||||
Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final connection = ids == null
|
||||
? null
|
||||
: () => ref.invalidate(
|
||||
editorMcpConnectionProvider(ids!.$1, ids.$2),
|
||||
: ref.watch(editorMcpConnectionProvider(ids.$1, ids.$2));
|
||||
if (value?.enabled != true || connection?.hasError != true) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
context.l10n.mcpStartError(
|
||||
context.l10n.errorMessage(connection!.error!),
|
||||
),
|
||||
child: Text(context.l10n.retryStart),
|
||||
),
|
||||
],
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: operation.isLoading
|
||||
? null
|
||||
: () => ref.invalidate(
|
||||
editorMcpConnectionProvider(ids!.$1, ids.$2),
|
||||
),
|
||||
child: Text(context.l10n.retryStart),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
if (error != null)
|
||||
Text(
|
||||
error,
|
||||
|
||||
Reference in new issue
Block a user