@@ -244,16 +244,39 @@ public function enqueue_styles_admin() {
244244 $ asset_file = include FEEDZY_ABSPATH . '/build/action-popup/index.asset.php ' ;
245245 wp_enqueue_script ( $ this ->plugin_name . '_action_popup ' , FEEDZY_ABSURL . 'build/action-popup/index.js ' , array_merge ( $ asset_file ['dependencies ' ], array ( 'wp-editor ' , 'wp-api ' ) ), $ asset_file ['version ' ], true );
246246
247+ $ openai_model = '' ;
248+ $ open_router_model = '' ;
249+ $ integration_settings = get_option ( 'feedzy-rss-feeds-settings ' , array () );
250+
251+ $ all_open_ai_models = apply_filters ( 'feedzy_openai_models ' , array () );
252+ $ deprecated_open_ai_models = apply_filters ( 'feedzy_openai_deprecated_models ' , array () );
253+ $ active_open_ai_models = array_values ( array_diff ( $ all_open_ai_models , $ deprecated_open_ai_models ) );
254+
255+ if ( ! empty ( $ integration_settings ['openai_api_model ' ] ) ) {
256+ $ openai_model = $ integration_settings ['openai_api_model ' ];
257+ }
258+
259+ if ( ! empty ( $ integration_settings ['openrouter_api_model ' ] ) ) {
260+ $ open_router_model = $ integration_settings ['openrouter_api_model ' ];
261+ }
262+
247263 wp_localize_script (
248264 $ this ->plugin_name . '_action_popup ' ,
249265 'feedzyData ' ,
250266 array (
251- 'isPro ' => feedzy_is_pro (),
252- 'isBusinessPlan ' => apply_filters ( 'feedzy_is_license_of_type ' , false , 'business ' ),
253- 'isAgencyPlan ' => apply_filters ( 'feedzy_is_license_of_type ' , false , 'agency ' ),
254- 'apiLicenseStatus ' => $ this ->api_license_status (),
255- 'isHighPrivileges ' => current_user_can ( 'manage_options ' ),
256- 'languageList ' => $ this ->get_lang_list (),
267+ 'isPro ' => feedzy_is_pro (),
268+ 'isBusinessPlan ' => apply_filters ( 'feedzy_is_license_of_type ' , false , 'business ' ),
269+ 'isAgencyPlan ' => apply_filters ( 'feedzy_is_license_of_type ' , false , 'agency ' ),
270+ 'apiLicenseStatus ' => $ this ->api_license_status (),
271+ 'isHighPrivileges ' => current_user_can ( 'manage_options ' ),
272+ 'languageList ' => $ this ->get_lang_list (),
273+ 'integrationSettings ' => get_option ( 'feedzy-rss-feeds-settings ' ),
274+ 'integrations ' => array (
275+ 'openAIModel ' => $ openai_model ,
276+ 'openRouterModel ' => $ open_router_model ,
277+ ),
278+ 'activeOpenAIModels ' => $ active_open_ai_models ,
279+ 'deprecatedOpenAIModels ' => $ deprecated_open_ai_models ,
257280 )
258281 );
259282
0 commit comments