MCPcopy Create free account
hub / github.com/M66B/FairEmail / isAvailable

Method isAvailable

app/src/main/java/eu/faircode/email/Gemini.java:56–66  ·  view source on GitHub ↗
(Context context)

Source from the content-addressed store, hash-verified

54 private static final int TIMEOUT = 30; // seconds
55
56 static boolean isAvailable(Context context) {
57 if (TextUtils.isEmpty(BuildConfig.GEMINI_ENDPOINT))
58 return false;
59
60 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
61 boolean enabled = prefs.getBoolean("gemini_enabled", false);
62 String apikey = prefs.getString("gemini_apikey", null);
63
64 return (enabled &&
65 (!TextUtils.isEmpty(apikey) || !Objects.equals(getUri(context), BuildConfig.GEMINI_ENDPOINT)));
66 }
67
68 static Message[] generate(Context context, String model, Message[] messages, Float temperature, int n) throws JSONException, IOException {
69 //https://ai.google.dev/api/rest/v1beta/models/generateContent

Callers 5

isAvailableMethod · 0.95
completeChatMethod · 0.95
getDefaultPromptMethod · 0.95
getSummarizePromptMethod · 0.95
getSummaryTextMethod · 0.95

Calls 5

getUriMethod · 0.95
getBooleanMethod · 0.80
isEmptyMethod · 0.45
getStringMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected