Integrate TaskQueueViewModel throughout application
parent
a7e27d1a64
commit
51ebe2407d
|
@ -1,5 +1,6 @@
|
|||
import 'package:auto_gpt_flutter_client/services/leaderboard_service.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/settings_viewmodel.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/task_queue_viewmodel.dart';
|
||||
import 'package:auto_gpt_flutter_client/views/auth/firebase_auth_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'views/main_layout.dart';
|
||||
|
@ -97,7 +98,9 @@ class MyApp extends StatelessWidget {
|
|||
create: (context) => TaskViewModel(
|
||||
Provider.of<TaskService>(context, listen: false))),
|
||||
ChangeNotifierProvider(
|
||||
create: (context) => SkillTreeViewModel(
|
||||
create: (context) => SkillTreeViewModel()),
|
||||
ChangeNotifierProvider(
|
||||
create: (context) => TaskQueueViewModel(
|
||||
Provider.of<BenchmarkService>(context, listen: false),
|
||||
Provider.of<LeaderboardService>(context, listen: false)),
|
||||
),
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// TODO: Put more thought into task status vs. benchmark task status
|
||||
enum BenchmarkTaskStatus {
|
||||
notStarted,
|
||||
inProgress,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:auto_gpt_flutter_client/models/message_type.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/settings_viewmodel.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/skill_tree_viewmodel.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/task_queue_viewmodel.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/task_viewmodel.dart';
|
||||
import 'package:auto_gpt_flutter_client/views/chat/agent_message_tile.dart';
|
||||
import 'package:auto_gpt_flutter_client/views/chat/chat_input_field.dart';
|
||||
|
@ -103,7 +104,7 @@ class _ChatViewState extends State<ChatView> {
|
|||
),
|
||||
const SizedBox(height: 10),
|
||||
LoadingIndicator(
|
||||
isLoading: Provider.of<SkillTreeViewModel>(context, listen: true)
|
||||
isLoading: Provider.of<TaskQueueViewModel>(context, listen: true)
|
||||
.isBenchmarkRunning ||
|
||||
widget.viewModel.isWaitingForAgentResponse),
|
||||
const SizedBox(height: 10),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:auto_gpt_flutter_client/viewmodels/settings_viewmodel.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/skill_tree_viewmodel.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/task_queue_viewmodel.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
@ -22,8 +22,8 @@ class SideBarView extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: should we pass this in as a dependency?
|
||||
final skillTreeViewModel =
|
||||
Provider.of<SkillTreeViewModel>(context, listen: true);
|
||||
final taskQueueViewModel =
|
||||
Provider.of<TaskQueueViewModel>(context, listen: true);
|
||||
return Material(
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable: selectedViewNotifier,
|
||||
|
@ -40,7 +40,7 @@ class SideBarView extends StatelessWidget {
|
|||
? Colors.blue
|
||||
: Colors.black,
|
||||
icon: const Icon(Icons.chat),
|
||||
onPressed: skillTreeViewModel.isBenchmarkRunning
|
||||
onPressed: taskQueueViewModel.isBenchmarkRunning
|
||||
? null
|
||||
: () => selectedViewNotifier.value = 'TaskView',
|
||||
),
|
||||
|
@ -52,7 +52,7 @@ class SideBarView extends StatelessWidget {
|
|||
? Colors.blue
|
||||
: Colors.black,
|
||||
icon: const Icon(Icons.emoji_events),
|
||||
onPressed: skillTreeViewModel.isBenchmarkRunning
|
||||
onPressed: taskQueueViewModel.isBenchmarkRunning
|
||||
? null
|
||||
: () =>
|
||||
selectedViewNotifier.value = 'SkillTreeView',
|
||||
|
@ -74,9 +74,10 @@ class SideBarView extends StatelessWidget {
|
|||
IconButton(
|
||||
splashRadius: 0.1,
|
||||
iconSize: 25,
|
||||
icon: Icon(Icons.book, color: Color.fromRGBO(50, 120, 123, 1)),
|
||||
onPressed: () =>
|
||||
_launchURL('https://aiedge.medium.com/autogpt-forge-e3de53cc58ec'),
|
||||
icon: Icon(Icons.book,
|
||||
color: Color.fromRGBO(50, 120, 123, 1)),
|
||||
onPressed: () => _launchURL(
|
||||
'https://aiedge.medium.com/autogpt-forge-e3de53cc58ec'),
|
||||
tooltip: 'Learn how to build your own Agent',
|
||||
),
|
||||
IconButton(
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:auto_gpt_flutter_client/models/skill_tree/skill_tree_node.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/skill_tree_viewmodel.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/task_queue_viewmodel.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
@ -21,8 +22,18 @@ class _TreeNodeViewState extends State<TreeNodeView> {
|
|||
return GestureDetector(
|
||||
onTap: () {
|
||||
print('Node ${widget.node.id} clicked');
|
||||
Provider.of<SkillTreeViewModel>(context, listen: false)
|
||||
.toggleNodeSelection(widget.node.id);
|
||||
final taskQueueViewModel =
|
||||
Provider.of<TaskQueueViewModel>(context, listen: false);
|
||||
if (!taskQueueViewModel.isBenchmarkRunning) {
|
||||
final skillTreeViewModel =
|
||||
Provider.of<SkillTreeViewModel>(context, listen: false);
|
||||
skillTreeViewModel.toggleNodeSelection(widget.node.id);
|
||||
taskQueueViewModel.updateSelectedNodeHierarchyBasedOnOption(
|
||||
taskQueueViewModel.selectedOption,
|
||||
skillTreeViewModel.selectedNode,
|
||||
skillTreeViewModel.skillTreeNodes,
|
||||
skillTreeViewModel.skillTreeEdges);
|
||||
}
|
||||
},
|
||||
child: MouseRegion(
|
||||
onEnter: (_) => setState(() => _isHovering = true),
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
import 'package:auto_gpt_flutter_client/models/benchmark/benchmark_task_status.dart';
|
||||
import 'package:auto_gpt_flutter_client/models/test_option.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/chat_viewmodel.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/skill_tree_viewmodel.dart';
|
||||
import 'package:auto_gpt_flutter_client/viewmodels/task_queue_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';
|
||||
|
||||
class TaskQueueView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final viewModel = Provider.of<SkillTreeViewModel>(context);
|
||||
final viewModel = Provider.of<TaskQueueViewModel>(context);
|
||||
|
||||
// Node hierarchy
|
||||
final nodeHierarchy = viewModel.selectedNodeHierarchy ?? [];
|
||||
|
@ -102,8 +103,13 @@ class TaskQueueView extends StatelessWidget {
|
|||
selectedOptionString: viewModel.selectedOption.description,
|
||||
onOptionSelected: (selectedOption) {
|
||||
print('Option Selected: $selectedOption');
|
||||
final skillTreeViewModel =
|
||||
Provider.of<SkillTreeViewModel>(context, listen: false);
|
||||
viewModel.updateSelectedNodeHierarchyBasedOnOption(
|
||||
TestOptionExtension.fromDescription(selectedOption)!);
|
||||
TestOptionExtension.fromDescription(selectedOption)!,
|
||||
skillTreeViewModel.selectedNode,
|
||||
skillTreeViewModel.skillTreeNodes,
|
||||
skillTreeViewModel.skillTreeEdges);
|
||||
},
|
||||
onPlayPressed: (selectedOption) {
|
||||
print('Starting benchmark with option: $selectedOption');
|
||||
|
|
Loading…
Reference in New Issue