From de679172ea6e58ca93f606f982397c01b83e4208 Mon Sep 17 00:00:00 2001
From: LiuZhengYu <2777920394@qq.com>
Date: Mon, 27 Apr 2026 09:17:37 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=85=B3=E9=94=AE=E8=AF=8D?=
=?UTF-8?q?=E7=AE=A1=E7=90=86=E5=B8=83=E5=B1=80=EF=BC=8C=E5=AE=9E=E7=8E=B0?=
=?UTF-8?q?AI=E5=89=94=E9=99=A4=E5=92=8C=E8=81=94=E6=83=B3=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/admin/www/keywordManage.html | 101 ++++++++++--
web/admin/www/keywordManage.php | 257 ++++++++++++++++++++-----------
2 files changed, 256 insertions(+), 102 deletions(-)
diff --git a/web/admin/www/keywordManage.html b/web/admin/www/keywordManage.html
index 189b285..3f9eb09 100644
--- a/web/admin/www/keywordManage.html
+++ b/web/admin/www/keywordManage.html
@@ -33,20 +33,27 @@
-
+
-
预览生成关键词
+
预览交叉生成关键词
-
+
+
+
预览AI联想生成关键词
+
+
+
+
+
Loading...
@@ -120,26 +127,40 @@
// 保存编辑后的关键词入库
function saveEditKeywords(){
- let text = $5('[id=editKeywordText]').val().trim();
+ let text = '';
+ var aiBox = document.getElementById('AI_editBox');
+ var editBox = document.getElementById('editBox');
+ var currentCateid = $5('[id=cross_cateid_select]').val().trim();
+ if(aiBox.style.display !== 'none'){
+ text = document.getElementById('AI_editKeywordText').value.trim();
+ console.log("AI:"+text);
+
+ } else {
+ text = document.getElementById('editKeywordText').value.trim();
+ console.log("normal:"+text);
+ }
+
if(!text){
ciyfn.toast('没有需要保存的关键词');
return;
}
ciyfn.callfunc('ConfirmSaveKeywords',{
- cateid:currentCateid,
- text:text
+ cateid: currentCateid,
+ text: text
},function(res){
if(res.code === 1){
ciyfn.toast(res.msg);
- $5('[id=editBox]').hide();
- $5('[id=editKeywordText]').val('');
+ editBox.style.display = 'none';
+ aiBox.style.display = 'none';
+ document.getElementById('editKeywordText').value = '';
+ document.getElementById('AI_editKeywordText').value = '';
}else{
ciyfn.toast(res.errmsg);
}
});
}
- // 原有批量添加不变
+ //批量添加不变
function BatchAdd() {
var cateid = $5('[id=cross_cateid_select]').val();
var names = $5('[name=cross_dim2]').val().trim();
@@ -164,6 +185,66 @@
}
});
}
-
+
+ //AI相关功能
+ function AIFunction(param) {
+ let text = '';
+ if(param === '修改'){
+ text = $5('[id=editKeywordText]').val().trim();
+ if (!text) {
+ ciyfn.toast('请先生成关键词再使用AI修改');
+ return;
+ }
+ ciyfn.toast('AI正在处理中...', 9999);
+ ciyfn.callfunc('AIFunction', {
+ content: text,
+ param: param
+ }, function (res) {
+ if (res.code === 1) {
+ $5('[id=editKeywordText]').val(res.data);
+ $5('[id=editBox]').show();
+ $5('[id=AI_editBox]').hide();
+ ciyfn.toast('AI ' + param + ' 完成');
+ } else {
+ ciyfn.toast('AI ' + param + ' 失败:' + res.errmsg);
+ }
+ });
+ }else{
+ var cateid = $5('[id=cross_cateid_select]').val();
+ var dim1 = $5('[name=cross_dim1]').val().trim();
+ var dim2 = $5('[name=cross_dim2]').val().trim();
+ var dim3 = $5('[name=cross_dim3]').val().trim();
+ if(!cateid){
+ ciyfn.toast('请选择所属栏目');
+ return;
+ }
+
+ if (!dim2) {
+ ciyfn.toast('请填写核心词');
+ return;
+ }
+
+ ciyfn.toast('AI联想中...', 9999);
+ ciyfn.callfunc('AIFunction', {
+ cateid: cateid,
+ dim1: dim1,
+ dim2: dim2,
+ dim3: dim3,
+ param: param
+ }, function (res) {
+ if (res.code === 1) {
+ $5('[id=AI_editKeywordText]').val(res.data);
+ $5('[id=AI_editBox]').show();
+ $5('[id=editBox]').hide();
+ ciyfn.toast('AI ' + param + ' 完成');
+ } else {
+ ciyfn.toast('AI ' + param + ' 失败:' + res.errmsg);
+ }
+ });
+
+ }
+
+ }
+