feat(ai): 打通 SEO 闭环与投稿写作辅助

对齐 Zibll 的 AI 生成 SEO 流程:统一 WP AI Client/主题 Provider 双后端、文章/分类 SEO 框与生成回填、投稿摘要/标签建议,并收敛扩展页为连接配置。
This commit is contained in:
kate522 committed 2026-07-12 15:36:04 +08:00
1 parent a4cd5276e2
commit b36186da65
14 files changed
+1243 -330

No files matched your search

+23 -5
View File
@@ -127,7 +127,10 @@ $current_thumb = $edit_post ? get_the_post_thumbnail_url($edit_post->ID, 'larg
<?php if (!empty($submit_settings['allow_excerpt'])) : ?>
<div class="aksrt-form-group">
<label for="submit-excerpt"><?php esc_html_e('摘要', 'aksrt'); ?></label>
<label for="submit-excerpt">
<?php esc_html_e('摘要', 'aksrt'); ?>
<button type="button" class="aksrt-ai-assist-btn" data-ai-action="summary" hidden><?php esc_html_e('AI 生成摘要', 'aksrt'); ?></button>
</label>
<textarea id="submit-excerpt" name="excerpt" class="aksrt-form-input" rows="3" maxlength="300" placeholder="<?php esc_attr_e('可选:文章摘要', 'aksrt'); ?>"><?php echo esc_textarea($current_excerpt); ?></textarea>
</div>
<?php endif; ?>
@@ -147,7 +150,10 @@ $current_thumb = $edit_post ? get_the_post_thumbnail_url($edit_post->ID, 'larg
<?php if (!empty($submit_settings['allow_tags'])) : ?>
<div class="aksrt-form-group aksrt-submit-form__col">
<label for="submit-tags"><?php esc_html_e('标签', 'aksrt'); ?></label>
<label for="submit-tags">
<?php esc_html_e('标签', 'aksrt'); ?>
<button type="button" class="aksrt-ai-assist-btn" data-ai-action="tags" hidden><?php esc_html_e('AI 建议标签', 'aksrt'); ?></button>
</label>
<input type="text" id="submit-tags" name="tags" class="aksrt-form-input" placeholder="<?php esc_attr_e('多个标签用逗号分隔', 'aksrt'); ?>" value="<?php echo esc_attr($current_tags); ?>">
</div>
<?php endif; ?>
@@ -274,10 +280,18 @@ if (file_exists($front_submit_path)) {
(string) filemtime($front_submit_path),
true
);
$ai_available = class_exists('AKSRT_AI') && AKSRT_AI::get_instance()->is_available();
wp_localize_script('aksrt-front-submit', 'aksrtSubmitData', [
'ajaxUrl' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('aksrt_submit_nonce'),
'i18n' => [
'ajaxUrl' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('aksrt_submit_nonce'),
'restUrl' => esc_url_raw(rest_url('aksrt/v1')),
'restNonce' => wp_create_nonce('wp_rest'),
'ai' => [
'available' => $ai_available,
'summary' => $ai_available,
'tags' => $ai_available,
],
'i18n' => [
'confirmLeave' => __('你有未保存的更改,确定要离开吗?', 'aksrt'),
'saving' => __('保存中...', 'aksrt'),
'saved' => __('草稿已保存', 'aksrt'),
@@ -285,6 +299,10 @@ if (file_exists($front_submit_path)) {
'submitted' => __('投稿已提交', 'aksrt'),
'error' => __('操作失败,请重试', 'aksrt'),
'confirmDelete' => __('确定要删除这个草稿吗?', 'aksrt'),
'aiGenerating' => __('生成中…', 'aksrt'),
'aiFailed' => __('AI 生成失败', 'aksrt'),
'needContent' => __('请先填写正文内容', 'aksrt'),
'aiFilled' => __('已填入,可继续编辑', 'aksrt'),
],
]);
}