canUseLlmProxy method
Implementation
Future<bool> canUseLlmProxy(String projectId) async {
final encodedProjectId = Uri.encodeComponent(projectId);
final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/role');
final response = await httpClient.get(uri);
if (response.statusCode == 403) {
throw ForbiddenException('User does not have access to this project. Status code: ${response.statusCode}, body: ${response.body}');
}
if (response.statusCode >= 400) {
throw MeshagentException('Failed to check llm proxy access. Status code: ${response.statusCode}, body: ${response.body}');
}
final canUseLlmProxy = (jsonDecode(response.body) as Map<String, dynamic>)["can_use_llm_proxy"] ?? false;
return canUseLlmProxy;
}