@@ -214,17 +214,39 @@ public function enqueue_styles_admin() {
214214 $ asset_file = include FEEDZY_ABSPATH . '/build/action-popup/index.asset.php ' ;
215215 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 );
216216
217+ $ openai_model = '' ;
218+ $ open_router_model = '' ;
219+ $ integration_settings = get_option ( 'feedzy-rss-feeds-settings ' , array () );
220+
221+ $ all_open_ai_models = apply_filters ( 'feedzy_openai_models ' , array () );
222+ $ deprecated_open_ai_models = apply_filters ( 'feedzy_openai_deprecated_models ' , array () );
223+ $ active_open_ai_models = array_values ( array_diff ( $ all_open_ai_models , $ deprecated_open_ai_models ) );
224+
225+ if ( ! empty ( $ integration_settings ['openai_api_model ' ] ) ) {
226+ $ openai_model = $ integration_settings ['openai_api_model ' ];
227+ }
228+
229+ if ( ! empty ( $ integration_settings ['openrouter_api_model ' ] ) ) {
230+ $ open_router_model = $ integration_settings ['openrouter_api_model ' ];
231+ }
232+
217233 wp_localize_script (
218234 $ this ->plugin_name . '_action_popup ' ,
219235 'feedzyData ' ,
220236 array (
221- 'isPro ' => feedzy_is_pro (),
222- 'isBusinessPlan ' => apply_filters ( 'feedzy_is_license_of_type ' , false , 'business ' ),
223- 'isAgencyPlan ' => apply_filters ( 'feedzy_is_license_of_type ' , false , 'agency ' ),
224- 'apiLicenseStatus ' => $ this ->api_license_status (),
225- 'isHighPrivileges ' => current_user_can ( 'manage_options ' ),
226- 'languageList ' => $ this ->get_lang_list (),
227- 'integrationSettings ' => get_option ( 'feedzy-rss-feeds-settings ' ),
237+ 'isPro ' => feedzy_is_pro (),
238+ 'isBusinessPlan ' => apply_filters ( 'feedzy_is_license_of_type ' , false , 'business ' ),
239+ 'isAgencyPlan ' => apply_filters ( 'feedzy_is_license_of_type ' , false , 'agency ' ),
240+ 'apiLicenseStatus ' => $ this ->api_license_status (),
241+ 'isHighPrivileges ' => current_user_can ( 'manage_options ' ),
242+ 'languageList ' => $ this ->get_lang_list (),
243+ 'integrationSettings ' => get_option ( 'feedzy-rss-feeds-settings ' ),
244+ 'integrations ' => array (
245+ 'openAIModel ' => $ openai_model ,
246+ 'openRouterModel ' => $ open_router_model ,
247+ ),
248+ 'activeOpenAIModels ' => $ active_open_ai_models ,
249+ 'deprecatedOpenAIModels ' => $ deprecated_open_ai_models ,
228250 )
229251 );
230252
0 commit comments