diff --git a/ai-summary-query.php b/ai-summary-query.php
index 6d3465a..b548782 100644
--- a/ai-summary-query.php
+++ b/ai-summary-query.php
@@ -8,6 +8,9 @@ if (!file_exists($wp_load_path)) $wp_load_path = $_SERVER['DOCUMENT_ROOT'] . '/w
require_once($wp_load_path);
$query_code = isset($_GET['code']) ? sanitize_text_field($_GET['code']) : '';
+if (empty($query_code)) {
+ $query_code = get_query_var('code') ? sanitize_text_field(get_query_var('code')) : '';
+}
$result = null;
$error = '';
@@ -276,7 +279,7 @@ html.darkmode .ai-verify-subtitle { color: #aaa; }
-
+
@@ -284,7 +287,6 @@ html.darkmode .ai-verify-subtitle { color: #aaa; }
diff --git a/functions.php b/functions.php
index e9d163c..a6b2c21 100644
--- a/functions.php
+++ b/functions.php
@@ -4482,12 +4482,20 @@ function argon_feedback_rewrite() {
add_rewrite_rule('^feedback/?$', 'index.php?argon_feedback_view=1', 'top');
}
+// AI 查询页面 URL 重写
+add_action('init', 'argon_ai_query_rewrite');
+function argon_ai_query_rewrite() {
+ add_rewrite_rule('^ai-query/?$', 'index.php?argon_ai_query=1', 'top');
+ add_rewrite_rule('^ai-query/([A-Z0-9]{8})/?$', 'index.php?argon_ai_query=1&code=$matches[1]', 'top');
+}
+
// 主题激活或更新时刷新重写规则
add_action('after_switch_theme', 'argon_flush_rewrite_rules');
add_action('upgrader_process_complete', 'argon_flush_rewrite_rules');
function argon_flush_rewrite_rules() {
argon_friend_links_rewrite();
argon_feedback_rewrite();
+ argon_ai_query_rewrite();
flush_rewrite_rules();
}
@@ -4495,6 +4503,7 @@ add_filter('query_vars', 'argon_friend_links_query_vars');
function argon_friend_links_query_vars($vars) {
$vars[] = 'argon_friend_links';
$vars[] = 'argon_feedback_view';
+ $vars[] = 'argon_ai_query';
return $vars;
}
@@ -4515,6 +4524,15 @@ function argon_feedback_template() {
}
}
+// AI 查询页面路由
+add_action('template_redirect', 'argon_ai_query_template');
+function argon_ai_query_template() {
+ if (get_query_var('argon_ai_query')) {
+ include(get_template_directory() . '/ai-summary-query.php');
+ exit;
+ }
+}
+
//隐藏 admin 管理条
//show_admin_bar(false);
diff --git a/template-parts/ai-summary.php b/template-parts/ai-summary.php
index 72be4be..fe68810 100644
--- a/template-parts/ai-summary.php
+++ b/template-parts/ai-summary.php
@@ -76,7 +76,7 @@ $model_display = !empty($model) ? $model : __('未知模型', 'argon');
:
- :
+ :
@@ -121,7 +121,7 @@ $model_display = !empty($model) ? $model : __('未知模型', 'argon');
footerHTML += ': ' + data.data.model + '';
}
if (data.data.code) {
- footerHTML += ': ' + data.data.code + '';
+ footerHTML += ': ' + data.data.code + '';
}
footerDiv.innerHTML = footerHTML;
}