');
}
$aieo_cs_out($aieo_cs_section(__('Select Embedding Engine', 'ai-eshop-optimizer'), 'aieo-card-chat-embedding-engine'));
$aieo_cs_out($aieo_cs_notice(
'You can train the same content with different embedding models to compare quality and search results. '
. 'Each model creates a separate set of embeddings. Products without embeddings for the selected model will be trained.',
'info',
array('title' => 'Multi-Engine Support:')
));
?>
__('What a taxonomy embedding holds', 'ai-eshop-optimizer')))); ?>
prefix . 'aieo_core_product_vitals';
$row = $wpdb->get_row(
"SELECT
SUM(CASE WHEN p.post_type = 'product'
AND v.product_id = v.parent_id
AND v.stock > 0
AND vp.parent_id IS NULL
THEN 1 ELSE 0 END) AS simple_in_stock,
SUM(CASE WHEN p.post_type = 'product_variation'
AND v.product_id <> v.parent_id
AND v.stock > 0
THEN 1 ELSE 0 END) AS variations_in_stock,
SUM(CASE WHEN p.post_type = 'product'
AND v.product_id = v.parent_id
AND vp.parent_id IS NOT NULL
THEN 1 ELSE 0 END) AS variable_excluded
FROM {$vitals_table_for_box} v
INNER JOIN {$wpdb->posts} p ON v.product_id = p.ID
LEFT JOIN (
SELECT DISTINCT parent_id
FROM {$vitals_table_for_box}
WHERE product_id <> parent_id
) vp ON vp.parent_id = v.product_id
WHERE p.post_status = 'publish'
AND p.post_type IN ('product', 'product_variation')",
ARRAY_A
);
$breakdown = array(
'simple_in_stock' => (int) ($row['simple_in_stock'] ?? 0),
'variations_in_stock' => (int) ($row['variations_in_stock'] ?? 0),
'variable_excluded' => (int) ($row['variable_excluded'] ?? 0),
);
set_transient($breakdown_cache_key, $breakdown, 5 * MINUTE_IN_SECONDS);
}
$simple_parents_in_stock = $breakdown['simple_in_stock'];
$variations_in_stock = $breakdown['variations_in_stock'];
$variable_parents_excluded = $breakdown['variable_excluded'];
if (($simple_parents_in_stock + $variations_in_stock) > 0):
$aieo_cs_out($aieo_cs_notice(
esc_html__('Each variation is embedded as its own retrievable unit, inheriting brand / description / category / customer-needs from the parent and adding its own attributes (shade, size, scent).', 'ai-eshop-optimizer')
. ' ' . esc_html__('Variable parents themselves are containers (not buyable on their own), so they are not embedded — the chat retrieves the specific variation a customer is looking for.', 'ai-eshop-optimizer')
. ' ' . esc_html__('Out-of-stock units are skipped to keep the embedding budget on items the customer can actually buy.', 'ai-eshop-optimizer'),
'info',
array(
'title' => sprintf(
__('Sellable units breakdown — %1$d simple products + %2$d variations (variable parents skipped: %3$d)', 'ai-eshop-optimizer'),
(int) $simple_parents_in_stock,
(int) $variations_in_stock,
(int) $variable_parents_excluded
),
)
));
endif;
?>
__('What does it hide?', 'ai-eshop-optimizer')))); ?>
' . esc_html__('Learn what these metrics mean for your business', 'ai-eshop-optimizer') . ' →';
$aieo_cs_out(\Rooster\Admin\Guidance::text(wp_strip_all_tags($aieo_cs_mx), 'guidance', array('id' => 'aieo-chat-product-priority-metric-help', 'html' => $aieo_cs_mx, 'question' => __('Which metric?', 'ai-eshop-optimizer'))));
?>
'chat-step-2-frontend',
'icon' => 'app-window',
'title' => __('Step 2: what users see', 'ai-eshop-optimizer'),
'description' => __('Which models answer visitors, and how the chat widget looks and sits on the storefront.', 'ai-eshop-optimizer'),
), 'aieo-chat-form-step-2');
$aieo_cs_out($aieo_cs_open);
$aieo_cs_out($aieo_cs_section(__('Select Active Models for Frontend', 'ai-eshop-optimizer'), 'aieo-card-chat-active-models', true));
?>
__('What the models do', 'ai-eshop-optimizer')))); ?>
prefix . 'aieo_chat_embeddings';
$trained_engines = $wpdb->get_results(
"SELECT DISTINCT engine_type, deduplicated
FROM {$table_name}
WHERE engine_type IS NOT NULL
ORDER BY engine_type, deduplicated",
ARRAY_A
);
$current_provider_embed = get_option('aieo_embedding_provider', 'voyage');
$current_voyage_embed = get_option('aieo_chat_embedding_model', 'voyage-2');
$current_openai_embed = get_option('aieo_chat_openai_embedding_model', 'text-embedding-3-large');
$current_dedup_mode = get_option('aieo_chat_deduplication_mode', 1);
$current_embed_model = ($current_provider_embed === 'openai') ? $current_openai_embed : $current_voyage_embed;
$current_selection = $current_embed_model . ':' . $current_dedup_mode;
?>
'How This Works:',
'detail' => '
' . wp_kses_post(__('Chat Model — Claude (Anthropic) handles customer conversations. Requires the Anthropic key from Step 1, or Rooster One Pro at rooster.systems for transparent access.', 'ai-eshop-optimizer')) . '
'
. '
' . wp_kses_post(__('Embedding Model — Voyage AI finds relevant products via semantic search. Must be trained in Step 2 before chat can use it.', 'ai-eshop-optimizer')) . '
',
)));
?>
__('What the tester does', 'ai-eshop-optimizer')))); ?>
__('What the metadata adds', 'ai-eshop-optimizer')))); ?>
__('Privacy Note:', 'ai-eshop-optimizer'))
));
?>
'chat-search-ranking',
'icon' => 'list-filter',
'title' => __('Search and ranking', 'ai-eshop-optimizer'),
'description' => __('How the chat orders the products it finds, with weights that raise or lower each kind.', 'ai-eshop-optimizer'),
), 'aieo-chat-form-search');
$aieo_cs_out($aieo_cs_open);
$aieo_cs_out($aieo_cs_section(__('Search Re-Ranking Weights', 'ai-eshop-optimizer'), 'aieo-card-chat-rerank-weights', true));
?>
__('How the weights work', 'ai-eshop-optimizer')))); ?>
'
. esc_html__('If search finds 1 post at 85% and 2 products at 75%, only those will display.', 'ai-eshop-optimizer') . ' '
. wp_kses_post(__('Quality over quantity! Won\'t force minimums if items don\'t meet thresholds.', 'ai-eshop-optimizer')),
'info',
array('title' => trim((string) preg_replace('/^\x{1F4A1}\s*/u', '', __('Example:', 'ai-eshop-optimizer'))))
));
?>
__('What testing mode does', 'ai-eshop-optimizer')))); ?>
__('What happens when it is on?', 'ai-eshop-optimizer')))); ?>
'chat-knowledge-base',
'icon' => 'book-open-check',
'title' => __('Step 3: business knowledge', 'ai-eshop-optimizer'),
'description' => __('The facts about your shop the chat always knows, such as locations, hours, shipping and returns.', 'ai-eshop-optimizer'),
), 'aieo-chat-form-knowledge');
$aieo_cs_out($aieo_cs_open);
$aieo_cs_out($aieo_cs_section(__('Business Knowledge Base', 'ai-eshop-optimizer'), 'aieo-card-chat-business-kb', true));
$aieo_cs_out($aieo_cs_notice(
wp_kses_post(__('Why use this? Customers often ask about store locations, opening hours, shipping costs, and return policies. This information is always included in the AI context, ensuring accurate answers without relying on embedding similarity.', 'ai-eshop-optimizer')),
'info'
));
$business_info_enabled = class_exists('AI_eShop_Chat_Business_Info_Manager');
$business_counts = array();
if ($business_info_enabled) {
$business_manager = AI_eShop_Chat_Business_Info_Manager::get_instance();
if ($business_manager->table_exists()) {
$business_counts = $business_manager->get_counts_by_type();
}
}
$total_entries = array_sum($business_counts);
?>
__('Why define the identity', 'ai-eshop-optimizer')))); ?>
'
. \Rooster\Admin\Ui::field_row(array(
'id' => 'aieo-chat-site-identity-is',
'label' => __('What this site IS:', 'ai-eshop-optimizer'),
'help' => __('Describe what your business/site actually is. This helps the AI use correct terminology.', 'ai-eshop-optimizer'),
'control' => \Rooster\Admin\Ui::textarea('aieo_chat_site_identity_is', (string) get_option('aieo_chat_site_identity_is', ''), array('id' => 'aieo-chat-site-identity-is', 'rows' => 2, 'placeholder' => __('e.g., A medical clinic specializing in dermatology, A professional photography studio, An organic food store...', 'ai-eshop-optimizer'))),
))
. \Rooster\Admin\Ui::field_row(array(
'id' => 'aieo-chat-site-identity-is-not',
'label' => __('What this site is NOT:', 'ai-eshop-optimizer'),
'help' => __('List terms the AI should NEVER use to describe your business. Prevents misidentification.', 'ai-eshop-optimizer'),
'control' => \Rooster\Admin\Ui::textarea('aieo_chat_site_identity_is_not', (string) get_option('aieo_chat_site_identity_is_not', ''), array('id' => 'aieo-chat-site-identity-is-not', 'rows' => 2, 'placeholder' => __('e.g., Not a shop, Not a restaurant, Not a retail store...', 'ai-eshop-optimizer'))),
))
. '');
?>
__('Store Location', 'ai-eshop-optimizer'),
'opening_hours' => __('Opening Hours', 'ai-eshop-optimizer'),
'shipping' => __('Shipping Information', 'ai-eshop-optimizer'),
'contact' => __('Contact Information', 'ai-eshop-optimizer'),
'returns' => __('Returns & Refunds', 'ai-eshop-optimizer'),
'faq' => __('FAQ Entry', 'ai-eshop-optimizer'),
'custom' => __('Custom Information', 'ai-eshop-optimizer'),
);
$aieo_cs_out('
'
. \Rooster\Admin\Ui::field_row(array('id' => 'aieo-business-info-type', 'label' => __('Information Type:', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::select('', $aieo_cs_info_types, 'store_location', array('id' => 'aieo-business-info-type'))))
. \Rooster\Admin\Ui::field_row(array('id' => 'aieo-business-info-title', 'label' => __('Title:', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::input('', '', array('id' => 'aieo-business-info-title', 'medium' => true, 'placeholder' => __('e.g., Athens Store, Monday Hours, Standard Shipping', 'ai-eshop-optimizer')))))
. \Rooster\Admin\Ui::field_row(array(
'id' => 'aieo-business-info-content',
'label' => __('Content:', 'ai-eshop-optimizer'),
'help' => __('Write in a natural, informative style. This text will be directly available to the AI when answering customer questions.', 'ai-eshop-optimizer'),
'control' => \Rooster\Admin\Ui::textarea('', '', array('id' => 'aieo-business-info-content', 'rows' => 4, 'placeholder' => __('Enter the information that the AI should know and share with customers...', 'ai-eshop-optimizer'))),
))
. \Rooster\Admin\Ui::field_row(array('id' => 'aieo-business-info-priority', 'label' => __('Priority:', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::select('', array(
'normal' => __('Normal', 'ai-eshop-optimizer'),
'high' => __('High (important info)', 'ai-eshop-optimizer'),
'critical' => __('Critical (always mention)', 'ai-eshop-optimizer'),
), 'normal', array('id' => 'aieo-business-info-priority'))))
. '
',
)));
?>
Postal Code Shipping Rates were found yet. Set them up under Operations → Couriers → Postal Code Shipping Rates (or install the WooCommerce Table Rate Shipping plugin) and the AI can automatically learn your shipping costs and conditions.', 'ai-eshop-optimizer')),
'warning'
));
?>
__('Adding shipping by hand', 'ai-eshop-optimizer')))); ?>
__('What to import', 'ai-eshop-optimizer')))); ?>
__('-- Select a page --', 'ai-eshop-optimizer'));
foreach (get_pages(array('sort_column' => 'post_title', 'sort_order' => 'ASC')) as $page) {
$aieo_cs_import_pages[(string) $page->ID] = $page->post_title;
}
$aieo_cs_out('
__('After the import', 'ai-eshop-optimizer')))); ?>
'chat-analytics',
'icon' => 'chart-line',
'title' => __('Chat Analytics and Database Status', 'ai-eshop-optimizer'),
'description' => __('How much the chat is used, and the state of its training data and stored conversations.', 'ai-eshop-optimizer'),
), 'aieo-chat-form-analytics');
$aieo_cs_out($aieo_cs_open);
$aieo_cs_out($aieo_cs_section(__('Chat Statistics', 'ai-eshop-optimizer'), 'aieo-card-chat-statistics', true));
?>
__('What the statistics show', 'ai-eshop-optimizer')))); ?>
__('What you manage here', 'ai-eshop-optimizer')))); ?>
0): ?>
' . \Rooster\Admin\Ui::field_row(array(
'id' => 'aieo-chat-delete-engine-filter',
'label' => __('Filter by Embedding Engine:', 'ai-eshop-optimizer'),
'help' => __('Select a specific engine+mode combination to delete only those embeddings, keeping others intact.', 'ai-eshop-optimizer'),
'control' => \Rooster\Admin\Ui::select('', array('' => __('Loading available engines...', 'ai-eshop-optimizer')), '', array('id' => 'aieo-chat-delete-engine-filter')),
)) . '
' . esc_html__('Are you sure you want to delete ALL embeddings of ALL types for ALL engines? This cannot be undone. You will need to retrain everything.', 'ai-eshop-optimizer') . '
' . esc_html__('Are you sure you want to cancel the training? Progress will be saved but remaining items will not be processed.', 'ai-eshop-optimizer') . '