mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 02:39:19 +08:00
feat: move generation buttons to dashbot
This commit is contained in:
@@ -93,23 +93,37 @@ class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
if (currentRequest?.httpResponseModel?.statusCode != null &&
|
||||||
),
|
currentRequest?.httpResponseModel?.statusCode == 200) ...[
|
||||||
if (currentRequest?.httpResponseModel?.statusCode != null &&
|
HomeScreenTaskButton(
|
||||||
currentRequest?.httpResponseModel?.statusCode == 200) ...[
|
label: "🛠️ Generate Tool",
|
||||||
const SizedBox(height: 12),
|
onPressed: () {
|
||||||
Row(
|
GenerateToolDialog.show(context, ref);
|
||||||
children: const [
|
},
|
||||||
Expanded(
|
|
||||||
child: GenerateToolButton(),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 8),
|
HomeScreenTaskButton(
|
||||||
Expanded(
|
label: "📱 Generate UI",
|
||||||
child: AIGenerateUIButton(),
|
onPressed: () {
|
||||||
|
final model = ref.watch(selectedRequestModelProvider
|
||||||
|
.select((value) => value?.httpResponseModel));
|
||||||
|
if (model == null) return;
|
||||||
|
|
||||||
|
String data = "";
|
||||||
|
if (model.sseOutput != null) {
|
||||||
|
data = model.sseOutput!.join('');
|
||||||
|
} else {
|
||||||
|
data = model.formattedBody ?? "<>";
|
||||||
|
}
|
||||||
|
|
||||||
|
showCustomDialog(
|
||||||
|
context,
|
||||||
|
GenerateUIDialog(content: data),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import 'package:apidash/consts.dart';
|
|
||||||
import 'package:apidash/providers/collection_providers.dart';
|
|
||||||
import 'package:apidash/services/agentic_services/apidash_agent_calls.dart';
|
import 'package:apidash/services/agentic_services/apidash_agent_calls.dart';
|
||||||
import 'package:apidash/widgets/widget_sending.dart';
|
import 'package:apidash/widgets/widget_sending.dart';
|
||||||
import 'package:apidash_design_system/apidash_design_system.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'framework_selector.dart';
|
import 'framework_selector.dart';
|
||||||
@@ -150,42 +147,3 @@ class _GenerateUIDialogState extends ConsumerState<GenerateUIDialog> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AIGenerateUIButton extends ConsumerWidget {
|
|
||||||
const AIGenerateUIButton({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
|
||||||
return FilledButton.tonalIcon(
|
|
||||||
style: FilledButton.styleFrom(
|
|
||||||
padding: kPh12,
|
|
||||||
minimumSize: const Size(44, 44),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
final model = ref.watch(selectedRequestModelProvider
|
|
||||||
.select((value) => value?.httpResponseModel));
|
|
||||||
if (model == null) return;
|
|
||||||
|
|
||||||
String data = "";
|
|
||||||
if (model.sseOutput != null) {
|
|
||||||
data = model.sseOutput!.join('');
|
|
||||||
} else {
|
|
||||||
data = model.formattedBody ?? "<>";
|
|
||||||
}
|
|
||||||
|
|
||||||
showCustomDialog(
|
|
||||||
context,
|
|
||||||
GenerateUIDialog(content: data),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.generating_tokens,
|
|
||||||
),
|
|
||||||
label: const SizedBox(
|
|
||||||
child: Text(
|
|
||||||
kLabelGenerateUI,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -9,31 +9,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||||||
import 'generated_tool_codecopy.dart';
|
import 'generated_tool_codecopy.dart';
|
||||||
import 'tool_requirements_selector.dart';
|
import 'tool_requirements_selector.dart';
|
||||||
|
|
||||||
class GenerateToolButton extends ConsumerWidget {
|
|
||||||
const GenerateToolButton({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
|
||||||
return FilledButton.tonalIcon(
|
|
||||||
style: FilledButton.styleFrom(
|
|
||||||
padding: kPh12,
|
|
||||||
minimumSize: const Size(44, 44),
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
GenerateToolDialog.show(context, ref);
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.token_outlined,
|
|
||||||
),
|
|
||||||
label: const SizedBox(
|
|
||||||
child: Text(
|
|
||||||
"Generate Tool",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class GenerateToolDialog extends ConsumerStatefulWidget {
|
class GenerateToolDialog extends ConsumerStatefulWidget {
|
||||||
final APIDashRequestDescription requestDesc;
|
final APIDashRequestDescription requestDesc;
|
||||||
const GenerateToolDialog({
|
const GenerateToolDialog({
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import 'package:apidash/screens/common_widgets/agentic_ui_features/ai_ui_designer/generate_ui_dialog.dart';
|
|
||||||
import 'package:apidash/screens/common_widgets/agentic_ui_features/tool_generation/generate_tool_dialog.dart';
|
|
||||||
import 'package:apidash_core/apidash_core.dart';
|
import 'package:apidash_core/apidash_core.dart';
|
||||||
import 'package:apidash_design_system/apidash_design_system.dart';
|
import 'package:apidash_design_system/apidash_design_system.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
@@ -65,15 +63,6 @@ class _ResponseBodySuccessState extends State<ResponseBodySuccess> {
|
|||||||
padding: kP10,
|
padding: kP10,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
if (!widget.isPartOfHistory)
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
Expanded(child: GenerateToolButton()),
|
|
||||||
SizedBox(width: 10),
|
|
||||||
Expanded(child: AIGenerateUIButton()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
kVSpacer10,
|
kVSpacer10,
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
Reference in New Issue
Block a user