mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 14:04:27 +01:00
Extend RestApiUtility to Support Leaderboard Base URL
This commit extends the `RestApiUtility` class to include support for a new leaderboard base URL. A new `ApiType` enum value `ApiType.leaderboard` has been added, and the `_getEffectiveBaseUrl` method has been updated to handle this new type. The leaderboard base URL is "https://leaderboard.vercel.app/".
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:http/http.dart' as http;
|
||||
class RestApiUtility {
|
||||
String _agentBaseUrl;
|
||||
final String _benchmarkBaseUrl = "http://127.0.0.1:8080/ap/v1";
|
||||
final String _leaderboardBaseUrl = "https://leaderboard.vercel.app/";
|
||||
|
||||
RestApiUtility(this._agentBaseUrl);
|
||||
|
||||
@@ -14,7 +15,16 @@ class RestApiUtility {
|
||||
}
|
||||
|
||||
String _getEffectiveBaseUrl(ApiType apiType) {
|
||||
return apiType == ApiType.agent ? _agentBaseUrl : _benchmarkBaseUrl;
|
||||
switch (apiType) {
|
||||
case ApiType.agent:
|
||||
return _agentBaseUrl;
|
||||
case ApiType.benchmark:
|
||||
return _benchmarkBaseUrl;
|
||||
case ApiType.leaderboard:
|
||||
return _leaderboardBaseUrl;
|
||||
default:
|
||||
return _agentBaseUrl;
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> get(String endpoint,
|
||||
|
||||
Reference in New Issue
Block a user