isServerAvailable method
Checks if the Gemma API server is available.
Returns true
if the server responds with a status code of 200, false
otherwise.
Implementation
Future<bool> isServerAvailable() async {
try {
final response = await http
.get(Uri.parse('$baseUrl/health'))
.timeout(Duration(seconds: 5));
return response.statusCode == 200;
} catch (e) {
return false;
}
}