Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Update TaskQueueView with TestSuiteButton and LeaderboardSubmissionButton

hunteraraujoefe1b3e0eb8f
diff --git a/frontend/lib/views/task_queue/task_queue_view.dart b/frontend/lib/views/task_queue/task_queue_view.dart
index ed83a0e0b6..94477bda3c 100644
--- a/frontend/lib/views/task_queue/task_queue_view.dart
+++ b/frontend/lib/views/task_queue/task_queue_view.dart
@@ -1,6 +1,9 @@
import 'package:auto_gpt_flutter_client/models/benchmark/benchmark_task_status.dart';
import 'package:auto_gpt_flutter_client/viewmodels/chat_viewmodel.dart';
import 'package:auto_gpt_flutter_client/viewmodels/task_viewmodel.dart';
+import 'package:auto_gpt_flutter_client/views/task_queue/leaderboard_submission_button.dart';
+import 'package:auto_gpt_flutter_client/views/task_queue/leaderboard_submission_dialog.dart';
+import 'package:auto_gpt_flutter_client/views/task_queue/test_suite_button.dart';
import 'package:flutter/material.dart';
import 'package:auto_gpt_flutter_client/viewmodels/skill_tree_viewmodel.dart';
import 'package:provider/provider.dart';
@@ -90,56 +93,42 @@ class TaskQueueView extends StatelessWidget {
bottom: 20,
left: 20,
right: 20,
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8.0),
- border: Border.all(color: Colors.green, width: 3),
- ),
- child: ElevatedButton(
- onPressed: viewModel.isBenchmarkRunning
- ? null
- : () {
- // TODO: We should not be passing this dependency in like this
- final chatViewModel =
- Provider.of<ChatViewModel>(context, listen: false);
- final taskViewModel =
- Provider.of<TaskViewModel>(context, listen: false);
- chatViewModel.clearCurrentTaskAndChats();
- // Call runBenchmark method from SkillTreeViewModel
- viewModel.runBenchmark(chatViewModel, taskViewModel);
- },
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.center, // Center the children
- children: [
- Text(
- 'Initiate test suite',
- style: TextStyle(
- color: Colors.green, // Text color is set to green
- fontWeight: FontWeight.bold, // Make text bold
- fontSize: 16, // Increase font size
- ),
- ),
- SizedBox(width: 10), // Gap of 10 between text and icon
- Icon(
- Icons.play_arrow,
- color: Colors.green, // Icon color is set to green
- size: 24, // Increase icon size
- ),
- ],
+ child: Column(
+ children: [
+ // TestSuiteButton
+ TestSuiteButton(
+ onPressed: viewModel.isBenchmarkRunning
+ ? null
+ : () {
+ final chatViewModel = Provider.of<ChatViewModel>(
+ context,
+ listen: false);
+ final taskViewModel = Provider.of<TaskViewModel>(
+ context,
+ listen: false);
+ chatViewModel.clearCurrentTaskAndChats();
+ viewModel.runBenchmark(chatViewModel, taskViewModel);
+ },
+ isDisabled: viewModel.isBenchmarkRunning,
),
- style: ButtonStyle(
- backgroundColor: MaterialStateProperty.all(Colors.white),
- shape: MaterialStateProperty.all<RoundedRectangleBorder>(
- RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(8.0),
- ),
- ),
- minimumSize: MaterialStateProperty.all(
- Size(double.infinity, 50)), // Full width
- padding: MaterialStateProperty.all(EdgeInsets.all(0)),
+ SizedBox(height: 8), // Gap of 8 points between buttons
+ // LeaderboardSubmissionButton
+ LeaderboardSubmissionButton(
+ onPressed: viewModel.benchmarkStatusMap.isEmpty ||
+ viewModel.isBenchmarkRunning
+ ? null
+ : () {
+ showDialog(
+ context: context,
+ builder: (context) => LeaderboardSubmissionDialog(
+ onSubmit: viewModel.submitToLeaderboard,
+ ),
+ );
+ },
+ isDisabled: viewModel.isBenchmarkRunning ||
+ viewModel.benchmarkStatusMap.isEmpty,
),
- ),
+ ],
),
),
],