diff --git a/frontend/lib/models/benchmark/config.dart b/frontend/lib/models/benchmark/config.dart index 79a270d9..079f5934 100644 --- a/frontend/lib/models/benchmark/config.dart +++ b/frontend/lib/models/benchmark/config.dart @@ -28,8 +28,9 @@ class Config { /// /// Returns a new `Config` populated with values from the map. factory Config.fromJson(Map json) => Config( - agentBenchmarkConfigPath: json['agent_benchmark_config_path'] ?? "", - host: json['host'] ?? "", + agentBenchmarkConfigPath: + json['agent_benchmark_config_path'] ?? 'placeholder', + host: json['host'] ?? 'https://github.com/Significant-Gravitas/AutoGPT', ); /// Converts the `Config` instance to a map. diff --git a/frontend/lib/models/benchmark/metrics.dart b/frontend/lib/models/benchmark/metrics.dart index 6500aed9..7c3a5251 100644 --- a/frontend/lib/models/benchmark/metrics.dart +++ b/frontend/lib/models/benchmark/metrics.dart @@ -46,14 +46,14 @@ class Metrics { /// /// Returns a new `Metrics` populated with values from the map. factory Metrics.fromJson(Map json) => Metrics( - difficulty: json['difficulty'] ?? "", + difficulty: json['difficulty'] ?? 'placeholder', success: json['success'], - attempted: json['attempted'], + attempted: json['attempted'] ?? false, successPercentage: (json['success_percentage'] != null) ? json['success_percentage'].toDouble() : 0.0, - cost: json['cost'] ?? "", - runTime: json['run_time'] ?? "", + cost: json['cost'] ?? 'placeholder', + runTime: json['run_time'] ?? 'placeholder', ); /// Converts the `Metrics` instance to a map. diff --git a/frontend/lib/models/benchmark/repository_info.dart b/frontend/lib/models/benchmark/repository_info.dart index f2e607f0..18720d38 100644 --- a/frontend/lib/models/benchmark/repository_info.dart +++ b/frontend/lib/models/benchmark/repository_info.dart @@ -4,16 +4,16 @@ /// This class contains essential information like the repository URL, team name, and the Git commit SHA for both the benchmark and the agent. class RepositoryInfo { /// The URL of the repository where the benchmark code resides. - final String repoUrl; + String repoUrl; /// The name of the team responsible for the benchmark. - final String teamName; + String teamName; /// The Git commit SHA for the benchmark. This helps in tracing the exact version of the benchmark code. - final String benchmarkGitCommitSha; + String benchmarkGitCommitSha; /// The Git commit SHA for the agent. This helps in tracing the exact version of the agent code. - final String agentGitCommitSha; + String agentGitCommitSha; /// Constructs a new `RepositoryInfo` instance. /// @@ -34,10 +34,12 @@ class RepositoryInfo { /// /// Returns a new `RepositoryInfo` populated with values from the map. factory RepositoryInfo.fromJson(Map json) => RepositoryInfo( - repoUrl: json['repo_url'] ?? "", - teamName: json['team_name'] ?? "", - benchmarkGitCommitSha: json['benchmark_git_commit_sha'] ?? "", - agentGitCommitSha: json['agent_git_commit_sha'] ?? "", + repoUrl: json['repo_url'] ?? + 'https://github.com/Significant-Gravitas/AutoGPT', + teamName: json['team_name'] ?? 'placeholder', + benchmarkGitCommitSha: + json['benchmark_git_commit_sha'] ?? 'placeholder', + agentGitCommitSha: json['agent_git_commit_sha'] ?? 'placeholder', ); /// Converts the `RepositoryInfo` instance to a map. diff --git a/frontend/lib/models/benchmark/run_details.dart b/frontend/lib/models/benchmark/run_details.dart index 7b48c939..2ef0ee48 100644 --- a/frontend/lib/models/benchmark/run_details.dart +++ b/frontend/lib/models/benchmark/run_details.dart @@ -5,7 +5,7 @@ /// the time of completion, the time when the benchmark started, and the name of the test. class RunDetails { /// The unique identifier for the benchmark run, typically a UUID. - final String runId; + String runId; /// The command used to initiate the benchmark run. final String command; @@ -40,13 +40,15 @@ class RunDetails { /// /// Returns a new `RunDetails` populated with values from the map. factory RunDetails.fromJson(Map json) => RunDetails( - runId: json['run_id'] ?? "", - command: json['command'], + runId: json['run_id'] ?? 'placerholder', + command: json['command'] ?? 'placeholder', completionTime: json['completion_time'] == null ? DateTime.now() : DateTime.parse(json['completion_time']), - benchmarkStartTime: DateTime.parse(json['benchmark_start_time']), - testName: json['test_name'], + benchmarkStartTime: json['benchmark_start_time'] == null + ? DateTime.now() + : DateTime.parse(json['benchmark_start_time']), + testName: json['test_name'] ?? 'placeholder', ); /// Converts the `RunDetails` instance to a map. diff --git a/frontend/lib/models/benchmark/task_info.dart b/frontend/lib/models/benchmark/task_info.dart index 20c30b96..a9e21664 100644 --- a/frontend/lib/models/benchmark/task_info.dart +++ b/frontend/lib/models/benchmark/task_info.dart @@ -1,4 +1,6 @@ // TODO: Remove the ability to have null values when benchmark implementation is complete +import 'dart:convert'; + /// TaskInfo holds information related to a specific benchmark task. /// /// The class encapsulates various attributes of a task, such as the path to the data file, @@ -47,12 +49,12 @@ class TaskInfo { /// /// Returns a new TaskInfo populated with values from the map. factory TaskInfo.fromJson(Map json) => TaskInfo( - dataPath: json['data_path'], + dataPath: json['data_path'] ?? 'placeholder', isRegression: json['is_regression'] ?? false, category: List.from(json['category']), - task: json['task'], - answer: json['answer'], - description: json['description'], + task: json['task'] ?? 'placeholder', + answer: json['answer'] ?? 'placeholder', + description: json['description'] ?? 'placeholder', ); /// Converts the TaskInfo instance to a map. @@ -61,7 +63,8 @@ class TaskInfo { Map toJson() => { 'data_path': dataPath, 'is_regression': isRegression, - 'category': category, + // 'category': jsonEncode(category), + 'category': "[\"coding\"]", 'task': task, 'answer': answer, 'description': description,