| 1 |
<div class="wpforo-ai-helper<?php echo $wpf_ai_assistant_open ? ' wpf-ai-open' : ''; ?>" data-ai-preferences="<?php echo esc_attr( wp_json_encode( $wpf_ai_preferences ) ); ?>"> |
| 2 |
<div class="wpf-ai-helper-content"<?php echo $wpf_ai_assistant_open ? ' style="display: block;"' : ''; ?>> |
| 3 |
<div class="wpf-ai-helper-inner"> |
| 4 |
<!-- Tabs Navigation --> |
| 5 |
<?php if ( $wpf_ai_chatbot_enabled || ( $wpf_ai_show_preferences && $wpf_ai_is_logged_in ) ) : ?> |
| 6 |
<div class="wpf-ai-tabs"> |
| 7 |
<?php if ( $wpf_ai_search_enabled ) : ?> |
| 8 |
<div class="wpf-ai-tab wpf-ai-tab-active" data-tab="ai-search"> |
| 9 |
<i class="fas fa-search"></i> |
| 10 |
<span><?php wpforo_phrase('Search') ?></span> |
| 11 |
</div> |
| 12 |
<?php endif; ?> |
| 13 |
<?php if ( $wpf_ai_chatbot_enabled ) : ?> |
| 14 |
<div class="wpf-ai-tab<?php echo ! $wpf_ai_search_enabled ? ' wpf-ai-tab-active' : ''; ?>" data-tab="ai-chat"> |
| 15 |
<i class="fas fa-comments"></i> |
| 16 |
<span><?php wpforo_phrase('Chat') ?></span> |
| 17 |
</div> |
| 18 |
<?php endif; ?> |
| 19 |
<?php if ( $wpf_ai_show_preferences && $wpf_ai_is_logged_in ) : ?> |
| 20 |
<div class="wpf-ai-tab<?php echo ! $wpf_ai_search_enabled && ! $wpf_ai_chatbot_enabled ? ' wpf-ai-tab-active' : ''; ?>" data-tab="preferences"> |
| 21 |
<i class="fas fa-cog"></i> |
| 22 |
<span><?php wpforo_phrase('Preferences') ?></span> |
| 23 |
</div> |
| 24 |
<?php endif; ?> |
| 25 |
<?php if ( ! $wpf_ai_assistant_open ) : ?> |
| 26 |
<div class="wpf-ai-tab-close"> |
| 27 |
<i class="fas fa-times"></i> |
| 28 |
<span><?php wpforo_phrase('Close') ?></span> |
| 29 |
</div> |
| 30 |
<?php endif; ?> |
| 31 |
</div> |
| 32 |
<?php endif; ?> |
| 33 |
|
| 34 |
<!-- Tab Content: AI Search --> |
| 35 |
<?php if ( $wpf_ai_search_enabled ) : ?> |
| 36 |
<div class="wpf-ai-tab-content wpf-ai-tab-content-active" data-tab-content="ai-search"> |
| 37 |
<!-- Search Mode Toggle --> |
| 38 |
<?php if ( $wpf_ai_classic_search ) : ?> |
| 39 |
<div class="wpf-ai-search-toggle"> |
| 40 |
<div class="wpf-ai-search-mode wpf-ai-search-mode-active" data-mode="ai"> |
| 41 |
<?php wpforo_phrase('AI Search') ?> |
| 42 |
</div> |
| 43 |
<div class="wpf-ai-search-mode" data-mode="classic"> |
| 44 |
<?php wpforo_phrase('Classic Search') ?> |
| 45 |
</div> |
| 46 |
</div> |
| 47 |
<?php endif; ?> |
| 48 |
|
| 49 |
<!-- AI Search Form --> |
| 50 |
<div class="wpf-ai-search-form wpf-ai-search-form-active" data-search-form="ai"> |
| 51 |
<form class="wpf-ai-form" method="post"> |
| 52 |
<div class="wpf-ai-input-wrap"> |
| 53 |
<div class="wpf-ai-input-icon wpf-ai-icon-left"> |
| 54 |
<svg xmlns="http://www.w3.org/2000/svg" height="55px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l1.912 5.813a2 2 0 0 0 1.275 1.275L21 12l-5.813 1.912a2 2 0 0 0-1.275 1.275L12 21l-1.912-5.813a2 2 0 0 0-1.275-1.275L3 12l5.813-1.912a2 2 0 0 0 1.275-1.275L12 3z"></path><path d="M5 3v4"></path><path d="M3 5h4"></path><path d="M19 17v4"></path><path d="M17 19h4"></path></svg> |
| 55 |
</div> |
| 56 |
<input type="text" name="wpf_ai_query" class="wpf-ai-input" placeholder="<?php wpforo_phrase('Describe what you\'re looking for...') ?>" autocomplete="off" /> |
| 57 |
<button type="submit" class="wpf-ai-submit"> |
| 58 |
<i class="fas fa-search"></i> |
| 59 |
</button> |
| 60 |
</div> |
| 61 |
</form> |
| 62 |
<!-- AI Search Results --> |
| 63 |
<div class="wpf-ai-results" style="display: none;"> |
| 64 |
<div class="wpf-ai-results-list"></div> |
| 65 |
<div class="wpf-ai-results-more" style="display: none;"> |
| 66 |
<button type="button" class="wpf-ai-more-btn"><?php wpforo_phrase('More Results') ?></button> |
| 67 |
</div> |
| 68 |
</div> |
| 69 |
</div> |
| 70 |
|
| 71 |
<!-- Classic Search Form --> |
| 72 |
<?php if ( $wpf_ai_classic_search ) : ?> |
| 73 |
<div class="wpf-ai-search-form" data-search-form="classic"> |
| 74 |
<?php wpforo_post_search_form( WPF()->current_object['args'] ?? [] ) ?> |
| 75 |
</div> |
| 76 |
<?php endif; ?> |
| 77 |
</div> |
| 78 |
<?php endif; ?> |
| 79 |
|
| 80 |
<!-- Tab Content: AI Chat --> |
| 81 |
<?php if ( $wpf_ai_chatbot_enabled ) : ?> |
| 82 |
<div class="wpf-ai-tab-content<?php echo ! $wpf_ai_search_enabled ? ' wpf-ai-tab-content-active' : ''; ?>" data-tab-content="ai-chat"> |
| 83 |
<div class="wpf-ai-chat" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpforo_ai_chatbot' ) ); ?>"> |
| 84 |
<!-- Conversations Sidebar --> |
| 85 |
<div class="wpf-ai-chat-sidebar"> |
| 86 |
<div class="wpf-ai-chat-sidebar-header"> |
| 87 |
<h4><?php wpforo_phrase('Conversations') ?></h4> |
| 88 |
<button type="button" class="wpf-ai-chat-new" title="<?php wpforo_phrase('New Conversation') ?>"> |
| 89 |
<i class="fas fa-plus"></i> |
| 90 |
</button> |
| 91 |
</div> |
| 92 |
<div class="wpf-ai-chat-conversations"> |
| 93 |
<!-- Conversations list will be loaded here --> |
| 94 |
<div class="wpf-ai-chat-loading"> |
| 95 |
<i class="fas fa-spinner fa-spin"></i> |
| 96 |
</div> |
| 97 |
</div> |
| 98 |
</div> |
| 99 |
<!-- Chat Main Area --> |
| 100 |
<div class="wpf-ai-chat-main"> |
| 101 |
<div class="wpf-ai-chat-messages"> |
| 102 |
<!-- Messages will be loaded here --> |
| 103 |
<div class="wpf-ai-chat-welcome"> |
| 104 |
<div class="wpf-ai-chat-welcome-icon"> |
| 105 |
<svg viewBox="0 0 24 24" fill="currentColor" width="48" height="48"> |
| 106 |
<path d="M9.5 2l1.5 4.5L15.5 8l-4.5 1.5L9.5 14l-1.5-4.5L3.5 8l4.5-1.5L9.5 2z"/> |
| 107 |
<path d="M18 12l1 3 3 1-3 1-1 3-1-3-3-1 3-1 1-3z"/> |
| 108 |
</svg> |
| 109 |
</div> |
| 110 |
<p class="wpf-ai-chat-welcome-text"><?php wpforo_phrase('Start a new conversation or select an existing one') ?></p> |
| 111 |
</div> |
| 112 |
</div> |
| 113 |
<div class="wpf-ai-chat-input-wrap" style="display: none;"> |
| 114 |
<form class="wpf-ai-chat-form" method="post"> |
| 115 |
<input type="hidden" name="conversation_id" value="" /> |
| 116 |
<div class="wpf-ai-chat-input-container"> |
| 117 |
<textarea name="message" class="wpf-ai-chat-input" placeholder="<?php wpforo_phrase('Type your message...') ?>" rows="1"></textarea> |
| 118 |
<button type="submit" class="wpf-ai-chat-send" disabled> |
| 119 |
<i class="fas fa-paper-plane"></i> |
| 120 |
</button> |
| 121 |
</div> |
| 122 |
</form> |
| 123 |
</div> |
| 124 |
</div> |
| 125 |
</div> |
| 126 |
</div> |
| 127 |
<?php endif; ?> |
| 128 |
|
| 129 |
<!-- Tab Content: Preferences --> |
| 130 |
<?php if ( $wpf_ai_show_preferences && $wpf_ai_is_logged_in ) : ?> |
| 131 |
<div class="wpf-ai-tab-content<?php echo ! $wpf_ai_search_enabled && ! $wpf_ai_chatbot_enabled ? ' wpf-ai-tab-content-active' : ''; ?>" data-tab-content="preferences"> |
| 132 |
<div class="wpf-ai-preferences"> |
| 133 |
<form class="wpf-ai-preferences-form" method="post"> |
| 134 |
<?php wp_nonce_field( 'wpforo_ai_preferences', 'wpf_ai_pref_nonce' ); ?> |
| 135 |
|
| 136 |
<div class="wpf-ai-pref-section"> |
| 137 |
<h4 class="wpf-ai-pref-title"><?php wpforo_phrase('AI Features Preferences') ?></h4> |
| 138 |
|
| 139 |
<div class="wpf-ai-pref-field"> |
| 140 |
<label for="wpf-ai-pref-language"><?php wpforo_phrase('AI Features Response Language') ?></label> |
| 141 |
<select id="wpf-ai-pref-language" name="wpf_ai_language" class="wpf-ai-pref-select"> |
| 142 |
<?php |
| 143 |
$current_lang = $wpf_ai_preferences['language']; |
| 144 |
foreach ( $wpf_ai_languages as $code => $name ) : |
| 145 |
$selected = ( $current_lang === $code ) ? 'selected' : ''; |
| 146 |
?> |
| 147 |
<option value="<?php echo esc_attr( $code ); ?>" <?php echo $selected; ?>><?php echo esc_html( $name ); ?></option> |
| 148 |
<?php endforeach; ?> |
| 149 |
</select> |
| 150 |
<p class="wpf-ai-pref-desc"><?php wpforo_phrase('AI will generate responses in this language') ?></p> |
| 151 |
</div> |
| 152 |
|
| 153 |
<div class="wpf-ai-pref-field"> |
| 154 |
<label for="wpf-ai-pref-max-results"><?php wpforo_phrase('Maximum Number of Search Results') ?></label> |
| 155 |
<input type="number" id="wpf-ai-pref-max-results" name="wpf_ai_max_results" class="wpf-ai-pref-input" value="<?php echo esc_attr( $wpf_ai_preferences['max_results'] ); ?>" min="1" max="10" /> |
| 156 |
<p class="wpf-ai-pref-desc"><?php wpforo_phrase('Number of search results to display (1-10)') ?></p> |
| 157 |
</div> |
| 158 |
</div> |
| 159 |
|
| 160 |
<div class="wpf-ai-pref-actions"> |
| 161 |
<button type="submit" class="wpf-ai-pref-save"><?php wpforo_phrase('Save Preferences') ?></button> |
| 162 |
<span class="wpf-ai-pref-status"></span> |
| 163 |
</div> |
| 164 |
</form> |
| 165 |
</div> |
| 166 |
</div> |
| 167 |
<?php endif; ?> |
| 168 |
</div> |
| 169 |
</div> |
| 170 |
<div class="wpf-ai-helper-bar"> |
| 171 |
<div class="wpf-ai-helper-toggle<?php echo ( $wpf_ai_assistant_highlight && ! $wpf_ai_assistant_open ) ? ' wpf-ai-highlight' : ''; ?>"> |
| 172 |
<?php if ( ! empty( $wpf_ai_assistant_icon ) ) : ?> |
| 173 |
<?php |
| 174 |
$wpf_ai_icon_clean = preg_replace( '/\s*(width|height)\s*=\s*"[^"]*"/i', '', $wpf_ai_assistant_icon ); |
| 175 |
$wpf_ai_icon_clean = preg_replace( '/<svg\b/i', '<svg class="wpf-ai-sparkle-icon"', $wpf_ai_icon_clean ); |
| 176 |
echo wp_kses( $wpf_ai_icon_clean, array( 'svg' => array( 'class' => true, 'viewbox' => true, 'fill' => true, 'xmlns' => true ), 'path' => array( 'd' => true, 'fill' => true ), 'circle' => array( 'cx' => true, 'cy' => true, 'r' => true, 'fill' => true ), 'rect' => array( 'x' => true, 'y' => true, 'width' => true, 'height' => true, 'rx' => true, 'fill' => true ), 'line' => array( 'x1' => true, 'y1' => true, 'x2' => true, 'y2' => true, 'stroke' => true ), 'polyline' => array( 'points' => true, 'fill' => true ), 'polygon' => array( 'points' => true, 'fill' => true ), 'g' => array( 'fill' => true, 'transform' => true ) ) ); |
| 177 |
?> |
| 178 |
<?php else : ?> |
| 179 |
<svg class="wpf-ai-sparkle-icon" xmlns="http://www.w3.org/2000/svg" height="55px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l1.912 5.813a2 2 0 0 0 1.275 1.275L21 12l-5.813 1.912a2 2 0 0 0-1.275 1.275L12 21l-1.912-5.813a2 2 0 0 0-1.275-1.275L3 12l5.813-1.912a2 2 0 0 0 1.275-1.275L12 3z"></path><path d="M5 3v4"></path><path d="M3 5h4"></path><path d="M19 17v4"></path><path d="M17 19h4"></path></svg> |
| 180 |
<?php endif; ?> |
| 181 |
<span><?php wpforo_phrase('AI Assistant') ?></span> |
| 182 |
<i class="fas fa-chevron-down wpf-ai-toggle-icon"></i> |
| 183 |
</div> |
| 184 |
</div> |
| 185 |
</div> |
| 186 |
|