(Context context)
| 64 | private static final int SCALE2PIXELS = 1440; // medium |
| 65 | |
| 66 | static boolean isAvailable(Context context) { |
| 67 | if (TextUtils.isEmpty(BuildConfig.OPENAI_ENDPOINT)) |
| 68 | return false; |
| 69 | |
| 70 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); |
| 71 | boolean enabled = prefs.getBoolean("openai_enabled", false); |
| 72 | String apikey = prefs.getString("openai_apikey", null); |
| 73 | |
| 74 | return (enabled && |
| 75 | (!TextUtils.isEmpty(apikey) || !Objects.equals(getUri(context), BuildConfig.OPENAI_ENDPOINT))); |
| 76 | } |
| 77 | |
| 78 | static void checkModeration(Context context, String text) throws JSONException, IOException { |
| 79 | // https://platform.openai.com/docs/api-reference/moderations/create |
no test coverage detected