| @@ -1,6 +1,9 @@ | |||
| # 更新记录 | |||
| 通过访问 https://www.dedebiz.com/git 获取完整更新记录 | |||
| # V6.5.0 | |||
| - 增加AI助手,可自动化构建站点内容; | |||
| # V6.3.2 | |||
| - 重做后台管理,手机端更好访问后台; | |||
| - 增加流量统计列表功能,方便了解网站流量; | |||
| @@ -0,0 +1,32 @@ | |||
| <?php | |||
| /** | |||
| * 添加大模型 | |||
| * | |||
| * @version $id:ai_add.php 2025 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| * @copyright Copyright (c) 2025 DedeBIZ.COM | |||
| * @license GNU GPL v2 (https://www.dedebiz.com/license) | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require(dirname(__FILE__)."/config.php"); | |||
| if (empty($dopost)) $dopost = ''; | |||
| if ($dopost == "add") { | |||
| $title = isset($title)? HtmlReplace($title, -1) : ''; | |||
| $description = isset($description)? HtmlReplace($description, -1) : ''; | |||
| $company = isset($company)? HtmlReplace($company, -1) : ''; | |||
| $website = isset($website)? HtmlReplace($website, -1) : ''; | |||
| $apikey = isset($apikey)? HtmlReplace($apikey, -1) : ''; | |||
| $baseurl = isset($baseurl)? HtmlReplace($baseurl, -1) : ''; | |||
| $query = "INSERT INTO `#@__ai` (title,description,company,website,apikey,baseurl) VALUES ('$title','$description','$company','$website','$apikey','$baseurl'); "; | |||
| $rs = $dsql->ExecuteNoneQuery($query); | |||
| $burl = empty($_COOKIE['ENV_GOBACK_URL']) ? "ai_main.php" : $_COOKIE['ENV_GOBACK_URL']; | |||
| if ($rs) { | |||
| ShowMsg("成功添加一个大模型", $burl); | |||
| exit(); | |||
| } else { | |||
| ShowMsg("添加大模型时出错,原因:".$dsql->GetError(), "javascript:;"); | |||
| exit(); | |||
| } | |||
| } | |||
| include DedeInclude('templets/ai_add.htm'); | |||
| ?> | |||
| @@ -0,0 +1,47 @@ | |||
| <?php | |||
| /** | |||
| * 修改大模型 | |||
| * | |||
| * @version $id:ai_edit.php 2025 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| * @copyright Copyright (c) 2025 DedeBIZ.COM | |||
| * @license GNU GPL v2 (https://www.dedebiz.com/license) | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require_once(dirname(__FILE__)."/config.php"); | |||
| $ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? 'ai_main.php' : $_COOKIE['ENV_GOBACK_URL']; | |||
| if (empty($dopost)) $dopost = ''; | |||
| $id = isset($id)? intval($id) : 0; | |||
| if (isset($allid)) { | |||
| $aids = explode(',', $allid); | |||
| if (count($aids) == 1) { | |||
| $id = intval($aids[0]); | |||
| $dopost = "delete"; | |||
| } | |||
| } | |||
| if ($dopost == "delete") { | |||
| $dsql->ExecuteNoneQuery("DELETE FROM `#@__ai` WHERE id='$id'"); | |||
| ShowMsg("成功删除一个大模型", $ENV_GOBACK_URL); | |||
| exit(); | |||
| } else if ($dopost == "saveedit") { | |||
| $title = isset($title)? HtmlReplace($title, -1) : ''; | |||
| $description = isset($description)? HtmlReplace($description, -1) : ''; | |||
| $company = isset($company)? HtmlReplace($company, -1) : ''; | |||
| $website = isset($website)? HtmlReplace($website, -1) : ''; | |||
| $apikey = isset($apikey)? HtmlReplace($apikey, -1) : ''; | |||
| $baseurl = isset($baseurl)? HtmlReplace($baseurl, -1) : ''; | |||
| $query = "UPDATE `#@__ai` SET title='$title',description='$description',company='$company',website='$website',apikey='$apikey', baseurl='$baseurl' WHERE id='$id' "; | |||
| $dsql->ExecuteNoneQuery($query); | |||
| ShowMsg("成功修改一个大模型", $ENV_GOBACK_URL); | |||
| exit(); | |||
| } | |||
| $myAI = $dsql->GetOne("SELECT * FROM `#@__ai` WHERE id=$id"); | |||
| $sql = "SELECT * FROM `#@__ai_model` WHERE aiid=$id ORDER BY id DESC"; | |||
| $dlist = new DataListCP(); | |||
| $dlist->SetTemplet(DEDEADMIN.'/templets/ai_edit.htm'); | |||
| $dlist->SetSource($sql); | |||
| $dlist->display(); | |||
| // include DedeInclude('templets/ai_edit.htm'); | |||
| ?> | |||
| @@ -0,0 +1,42 @@ | |||
| <?php | |||
| /** | |||
| * 调用日志管理 | |||
| * | |||
| * @version $id:ai_log_main.php 2025 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| * @copyright Copyright (c) 2025 DedeBIZ.COM | |||
| * @license GNU GPL v2 (https://www.dedebiz.com/license) | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require_once(dirname(__FILE__)."/config.php"); | |||
| CheckPurview('sys_Log'); | |||
| require_once(DEDEINC."/datalistcp.class.php"); | |||
| require_once(DEDEINC."/common.func.php"); | |||
| DedeSetCookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/"); | |||
| $sql = $where = ''; | |||
| if (empty($adminid)) $adminid = 0; | |||
| if (empty($cip)) $cip = ''; | |||
| if (empty($dtime)) $dtime = 0; | |||
| if ($adminid > 0) $where .= " AND `#@__log`.adminid='$adminid' "; | |||
| if ($cip != "") $where .= " AND `#@__log`.cip LIKE '%$cip%' "; | |||
| if ($dtime > 0) { | |||
| $nowtime = time(); | |||
| $starttime = $nowtime - ($dtime * 24 * 3600); | |||
| $where .= " AND `#@__log`.dtime>'$starttime' "; | |||
| } | |||
| $sql = "SELECT `#@__ai_log`.*,`#@__admin`.userid FROM `#@__ai_log` LEFT JOIN `#@__admin` ON `#@__admin`.id=`#@__ai_log`.adminid WHERE 1=1 $where ORDER BY `#@__ai_log`.lid DESC"; | |||
| $adminlist = ''; | |||
| $dsql->SetQuery("SELECT id,uname FROM `#@__admin`"); | |||
| $dsql->Execute('admin'); | |||
| while ($myrow = $dsql->GetObject('admin')) { | |||
| $adminlist .= "<option value='{$myrow->id}'>{$myrow->uname}</option>\r\n"; | |||
| } | |||
| $dlist = new DataListCP(); | |||
| $dlist->pagesize = 30; | |||
| $dlist->SetParameter("adminid", $adminid); | |||
| $dlist->SetParameter("cip", $cip); | |||
| $dlist->SetParameter("dtime", $dtime); | |||
| $dlist->SetTemplate(DEDEADMIN."/templets/ai_log_main.htm"); | |||
| $dlist->SetSource($sql); | |||
| $dlist->Display(); | |||
| ?> | |||
| @@ -0,0 +1,20 @@ | |||
| <?php | |||
| /** | |||
| * 大模型管理 | |||
| * | |||
| * @version $id:ai_main.php 2025 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| * @copyright Copyright (c) 2025 DedeBIZ.COM | |||
| * @license GNU GPL v2 (https://www.dedebiz.com/license) | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require_once(dirname(__FILE__).'/config.php'); | |||
| require_once(DEDEINC.'/datalistcp.class.php'); | |||
| DedeSetCookie('ENV_GOBACK_URL', $dedeNowurl, time() + 3600, '/'); | |||
| $sql = "SELECT * FROM `#@__ai` ORDER BY id DESC"; | |||
| $dlist = new DataListCP(); | |||
| $dlist->SetTemplet(DEDEADMIN.'/templets/ai_main.htm'); | |||
| $dlist->SetSource($sql); | |||
| $dlist->display(); | |||
| ?> | |||
| @@ -0,0 +1,33 @@ | |||
| <?php | |||
| /** | |||
| * 添加模型版本 | |||
| * | |||
| * @version $id:ai_model_add.php 2025 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| * @copyright Copyright (c) 2025 DedeBIZ.COM | |||
| * @license GNU GPL v2 (https://www.dedebiz.com/license) | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require(dirname(__FILE__)."/config.php"); | |||
| if (empty($dopost)) $dopost = ''; | |||
| $aiid = isset($aiid) ? intval($aiid) : 0; | |||
| if ($dopost == "add") { | |||
| $model = isset($model)? HtmlReplace($model, -1) : ''; | |||
| $title = isset($title)? HtmlReplace($title, -1) : ''; | |||
| $description = isset($description)? HtmlReplace($description, -1) : ''; | |||
| $query = "INSERT INTO `#@__ai_model` (aiid,title,model,description) VALUES ('$aiid','$title','$model','$description'); "; | |||
| $rs = $dsql->ExecuteNoneQuery($query); | |||
| $burl = "ai_edit.php?id=".$aiid; | |||
| if ($rs) { | |||
| ShowMsg("成功添加一个模型版本", $burl); | |||
| exit(); | |||
| } else { | |||
| ShowMsg("添加模型版本时出错,原因:".$dsql->GetError(), "javascript:;"); | |||
| exit(); | |||
| } | |||
| } | |||
| if($aiid > 0) { | |||
| $ai = $dsql->GetOne("SELECT * FROM `#@__ai` WHERE id=$aiid"); | |||
| } | |||
| include DedeInclude('templets/ai_model_add.htm'); | |||
| ?> | |||
| @@ -0,0 +1,30 @@ | |||
| <?php | |||
| /** | |||
| * 修改模型版本 | |||
| * | |||
| * @version $id:ai_model_edit.php 2025 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| * @copyright Copyright (c) 2025 DedeBIZ.COM | |||
| * @license GNU GPL v2 (https://www.dedebiz.com/license) | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require_once(dirname(__FILE__)."/config.php"); | |||
| if (empty($dopost)) $dopost = ''; | |||
| $id = isset($id)? intval($id) : 0; | |||
| $myModel = $dsql->GetOne("SELECT * FROM `#@__ai_model` WHERE id=$id"); | |||
| if ($dopost == "delete") { | |||
| $dsql->ExecuteNoneQuery("DELETE FROM `#@__ai_model` WHERE id='$id'"); | |||
| ShowMsg("成功删除一个模型版本", "ai_edit.php?id={$myModel['aiid']}&dopost=getedit"); | |||
| exit(); | |||
| } else if ($dopost == "saveedit") { | |||
| $title = isset($title)? HtmlReplace($title, -1) : ''; | |||
| $description = isset($description)? HtmlReplace($description, -1) : ''; | |||
| $model = isset($model)? HtmlReplace($model, -1) : ''; | |||
| $query = "UPDATE `#@__ai_model` SET title='$title',description='$description',model='$model' WHERE id='$id' "; | |||
| $dsql->ExecuteNoneQuery($query); | |||
| ShowMsg("成功修改一个模型版本", "ai_edit.php?id={$myModel['aiid']}&dopost=getedit"); | |||
| exit(); | |||
| } | |||
| $ai = $dsql->GetOne("SELECT * FROM `#@__ai` WHERE id=".$myModel['aiid']); | |||
| include DedeInclude('templets/ai_model_edit.htm'); | |||
| ?> | |||
| @@ -0,0 +1,20 @@ | |||
| <?php | |||
| /** | |||
| * 模型版本管理 | |||
| * | |||
| * @version $id:ai_model_main.php 2025 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| * @copyright Copyright (c) 2025 DedeBIZ.COM | |||
| * @license GNU GPL v2 (https://www.dedebiz.com/license) | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require_once(dirname(__FILE__).'/config.php'); | |||
| require_once(DEDEINC.'/datalistcp.class.php'); | |||
| DedeSetCookie('ENV_GOBACK_URL', $dedeNowurl, time() + 3600, '/'); | |||
| $sql = "SELECT AM.*,A.title as aititle FROM `#@__ai_model` AM LEFT JOIN `#@__ai` A ON A.id = AM.aiid ORDER BY AM.id DESC"; | |||
| $dlist = new DataListCP(); | |||
| $dlist->SetTemplet(DEDEADMIN.'/templets/ai_model_main.htm'); | |||
| $dlist->SetSource($sql); | |||
| $dlist->display(); | |||
| ?> | |||
| @@ -0,0 +1,32 @@ | |||
| <?php | |||
| /** | |||
| * 添加提示词 | |||
| * | |||
| * @version $id:ai_prompt_add.php 2025 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| * @copyright Copyright (c) 2025 DedeBIZ.COM | |||
| * @license GNU GPL v2 (https://www.dedebiz.com/license) | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require(dirname(__FILE__)."/config.php"); | |||
| if (empty($dopost)) $dopost = ''; | |||
| $id = isset($id) ? intval($id) : 0; | |||
| if ($dopost == "add") { | |||
| $pname = isset($pname)? HtmlReplace($pname, -1) : ''; | |||
| $title = isset($title)? HtmlReplace($title, -1) : ''; | |||
| $description = isset($description)? HtmlReplace($description, -1) : ''; | |||
| $prompt = isset($prompt)? $prompt : ''; | |||
| $dfprompt = isset($dfprompt)? $dfprompt : ''; | |||
| $query = "INSERT INTO `#@__ai_prompt` (pname,title,prompt,description,dfprompt) VALUES ('$pname','$title','$prompt','$description','$dfprompt');"; | |||
| $rs = $dsql->ExecuteNoneQuery($query); | |||
| $burl = "ai_prompt_main.php"; | |||
| if ($rs) { | |||
| ShowMsg("成功添加一个提示词", $burl); | |||
| exit(); | |||
| } else { | |||
| ShowMsg("添加提示词时出错,原因:".$dsql->GetError(), "javascript:;"); | |||
| exit(); | |||
| } | |||
| } | |||
| include DedeInclude('templets/ai_prompt_add.htm'); | |||
| ?> | |||
| @@ -0,0 +1,30 @@ | |||
| <?php | |||
| /** | |||
| * 修改提示词 | |||
| * | |||
| * @version $id:ai_prompt_edit.php 2025 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| * @copyright Copyright (c) 2025 DedeBIZ.COM | |||
| * @license GNU GPL v2 (https://www.dedebiz.com/license) | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require_once(dirname(__FILE__)."/config.php"); | |||
| if (empty($dopost)) $dopost = ''; | |||
| $id = isset($id)? intval($id) : 0; | |||
| $myPrompt = $dsql->GetOne("SELECT * FROM `#@__ai_prompt` WHERE id=$id"); | |||
| if ($dopost == "delete") { | |||
| $dsql->ExecuteNoneQuery("DELETE FROM `#@__ai_prompt` WHERE id='$id'"); | |||
| ShowMsg("成功删除一个提示词", "ai_prompt_main.php"); | |||
| exit(); | |||
| } else if ($dopost == "saveedit") { | |||
| $title = isset($title)? HtmlReplace($title, -1) : ''; | |||
| $description = isset($description)? HtmlReplace($description, -1) : ''; | |||
| $prompt = isset($prompt)? $prompt : ''; | |||
| $dfprompt = isset($dfprompt)? $dfprompt : ''; | |||
| $query = "UPDATE `#@__ai_prompt` SET title='$title',description='$description',prompt='$prompt',dfprompt='$dfprompt' WHERE id='$id' "; | |||
| $dsql->ExecuteNoneQuery($query); | |||
| ShowMsg("成功修改一个提示词", "ai_prompt_edit.php?id={$myPrompt['id']}"); | |||
| exit(); | |||
| } | |||
| include DedeInclude('templets/ai_prompt_edit.htm'); | |||
| ?> | |||
| @@ -0,0 +1,20 @@ | |||
| <?php | |||
| /** | |||
| * 提示词管理 | |||
| * | |||
| * @version $id:ai_prompt_main.php 2025 tianya $ | |||
| * @package DedeBIZ.Administrator | |||
| * @copyright Copyright (c) 2025 DedeBIZ.COM | |||
| * @license GNU GPL v2 (https://www.dedebiz.com/license) | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require_once(dirname(__FILE__).'/config.php'); | |||
| require_once(DEDEINC.'/datalistcp.class.php'); | |||
| DedeSetCookie('ENV_GOBACK_URL', $dedeNowurl, time() + 3600, '/'); | |||
| $sql = "SELECT * FROM `#@__ai_prompt` ORDER BY id DESC"; | |||
| $dlist = new DataListCP(); | |||
| $dlist->SetTemplet(DEDEADMIN.'/templets/ai_prompt_main.htm'); | |||
| $dlist->SetSource($sql); | |||
| $dlist->display(); | |||
| ?> | |||
| @@ -4,4 +4,5 @@ | |||
| 4,会员设置 | |||
| 5,互动设置 | |||
| 6,性能选项 | |||
| 8,智能设置 | |||
| 7,其它选项 | |||
| @@ -54,6 +54,11 @@ if ($cuserLogin->getUserType() >= 10) { | |||
| <m:item name='积分产品分类' link='cards_type.php' rank='sys_Data' target='main' /> | |||
| <m:item name='支付接口设置' link='sys_payment.php' .php' rank='sys_Data' target='main' /> | |||
| </m:top> | |||
| <m:top item='10_' name='智能管理' rank='sys_Data' icon='fa fa-gg'> | |||
| <m:item name='大模型管理' link='ai_main.php' rank='sys_Data' target='main' /> | |||
| <m:item name='提示词管理' link='ai_prompt_main.php' rank='sys_Data' target='main' /> | |||
| <m:item name='调用日志管理' link='ai_log_main.php' rank='sys_Data' target='main' /> | |||
| </m:top> | |||
| <m:top item='12_' name='系统设置' rank='sys_User,sys_Group,sys_Edit,sys_Log,sys_Data' icon='fa fa-cog'> | |||
| <m:item name='系统设置' link='sys_info.php' rank='sys_Edit' target='main' /> | |||
| <m:item name='日志管理' link='log_list.php' rank='sys_Log' target='main' /> | |||
| @@ -0,0 +1,67 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"> | |||
| <title>添加大模型</title> | |||
| <link rel="stylesheet" href="/static/web/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/admin.css"> | |||
| <script src="/static/web/js/jquery.min.js"></script> | |||
| <script src="/static/web/js/bootstrap.min.js"></script> | |||
| <script src="/static/web/js/admin.main.js"></script> | |||
| </head> | |||
| <body> | |||
| <div class="container-fluid"> | |||
| <ol class="breadcrumb"> | |||
| <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li> | |||
| <li class="breadcrumb-item"><a href="ai_main.php">大模型管理</a></li> | |||
| <li class="breadcrumb-item active">添加大模型</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">添加大模型</div> | |||
| <div class="card-body"> | |||
| <form name="form1" action="ai_add.php" method="post" enctype="multipart/form-data"> | |||
| <input type="hidden" name="dopost" value="add"> | |||
| <div class="table-responsive"> | |||
| <table class="table table-borderless"> | |||
| <tbody> | |||
| <tr> | |||
| <td width="260">名称</td> | |||
| <td><input type="text" name="title" id="title" value="" class="admin-input-lg" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td>描述</td> | |||
| <td><textarea name="description" id="description" class="admin-textarea-sm"></textarea></td> | |||
| </tr> | |||
| <tr> | |||
| <td>公司名称</td> | |||
| <td><input type="text" name="company" id="company" class="admin-input-lg" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td>官方网址</td> | |||
| <td><input type="text" name="website" id="website" class="admin-input-lg"></td> | |||
| </tr> | |||
| <tr> | |||
| <td>API Key</td> | |||
| <td><input type="text" name="apikey" id="apikey" class="admin-input-lg" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td>接口地址</td> | |||
| <td><input type="text" name="baseurl" id="baseurl" class="admin-input-lg" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td colspan="2" align="center"> | |||
| <button type="submit" class="btn btn-success btn-sm">保存</button> | |||
| <button type="reset" class="btn btn-outline-success btn-sm">重置</button> | |||
| </td> | |||
| </tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| @@ -0,0 +1,99 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"> | |||
| <title>修改友情链接</title> | |||
| <link rel="stylesheet" href="/static/web/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/admin.css"> | |||
| </head> | |||
| <body> | |||
| <div class="container-fluid"> | |||
| <ol class="breadcrumb"> | |||
| <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li> | |||
| <li class="breadcrumb-item"><a href="ai_main.php">大模型管理</a></li> | |||
| <li class="breadcrumb-item active">修改大模型</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">修改大模型</div> | |||
| <div class="card-body"> | |||
| <form action="ai_edit.php" method="post" enctype="multipart/form-data" name="form1"> | |||
| <input type="hidden" name="id" value="<?php echo $myAI['id']?>"> | |||
| <input type="hidden" name="dopost" value="saveedit"> | |||
| <div class="table-responsive"> | |||
| <table class="table table-borderless"> | |||
| <tbody> | |||
| <tr> | |||
| <td width="260">名称</td> | |||
| <td><input type="text" name="title" id="title" value="<?php echo $myAI['title']?>" class="admin-input-lg" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td>描述</td> | |||
| <td><textarea name="description" id="description" class="admin-textarea-sm"><?php echo $myAI['description']?></textarea></td> | |||
| </tr> | |||
| <tr> | |||
| <td>公司名称</td> | |||
| <td><input type="text" name="company" id="company" class="admin-input-lg" value="<?php echo $myAI['company']?>" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td>官方网址</td> | |||
| <td><input type="text" name="website" id="website" class="admin-input-lg" value="<?php echo $myAI['website']?>"></td> | |||
| </tr> | |||
| <tr> | |||
| <td>API Key</td> | |||
| <td><input type="text" name="apikey" id="apikey" class="admin-input-lg" value="<?php echo $myAI['apikey']?>" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td>接口地址</td> | |||
| <td><input type="text" name="baseurl" id="baseurl" class="admin-input-lg" value="<?php echo $myAI['baseurl']?>" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td colspan="2"> | |||
| <div class="table-responsive"> | |||
| <p> | |||
| 模型版本 <a href="ai_model_add.php?aiid=<?php echo $myAI['id']?>" class="btn btn-success btn-sm">添加模型版本</a> | |||
| </p><hr> | |||
| <table class="table table-borderless table-hover"> | |||
| <thead> | |||
| <tr> | |||
| <td scope="col">ID</td> | |||
| <td scope="col">Model</td> | |||
| <td scope="col">名称</td> | |||
| <td scope="col" width="30%">描述</td> | |||
| <td scope="col">操作</td> | |||
| </tr> | |||
| </thead> | |||
| <tbody> | |||
| {dede:datalist} | |||
| <tr> | |||
| <td>{dede:field.id/}</td> | |||
| <td>{dede:field.model function='dede_htmlspecialchars(@me)'/}</td> | |||
| <td>{dede:field.title function='dede_htmlspecialchars(@me)'/}</td> | |||
| <td>{dede:field.description/}</td> | |||
| <td> | |||
| <a href="ai_model_edit.php?id={dede:field.id/}" class="btn btn-light btn-sm"><i class="fa fa-pencil-square" title="修改"></i></a> | |||
| <a href="ai_model_edit.php?id={dede:field.id/}&dopost=delete" class="btn btn-danger btn-sm"><i class="fa fa-trash" title="删除"></i></a> | |||
| </td> | |||
| </tr> | |||
| {/dede:datalist} | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td colspan="2" align="center"> | |||
| <button type="submit" class="btn btn-success btn-sm">保存</button> | |||
| <button type="reset" class="btn btn-outline-success btn-sm">重置</button> | |||
| </td> | |||
| </tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| @@ -0,0 +1,119 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"> | |||
| <title>调用日志列表</title> | |||
| <link rel="stylesheet" href="/static/web/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/admin.css"> | |||
| </head> | |||
| <body> | |||
| <div class="container-fluid"> | |||
| <ol class="breadcrumb"> | |||
| <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li> | |||
| <li class="breadcrumb-item active">调用日志列表</li> | |||
| </ol> | |||
| <div class="card shadow-sm mb-3"> | |||
| <div class="card-body"> | |||
| <form name="formsearch"> | |||
| <input type="text" name="cip" id="cip" placeholder="请输入ip地址" class="admin-input-lg mr-2"> | |||
| <select name="adminid" id="adminid" class="admin-input-sm mr-2"> | |||
| <option value="0" selected>全部</option> | |||
| <?php echo $adminlist?> | |||
| </select> | |||
| <select name="dtime" id="dtime" class="admin-input-sm"> | |||
| <option value="0" selected>全部</option> | |||
| <option value="7">一周内</option> | |||
| <option value="15">15天内</option> | |||
| <option value="30">30天以内</option> | |||
| <option value="60">60天以内</option> | |||
| </select> | |||
| <button type="submit"class="btn btn-success btn-sm">搜索</button> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">调用日志列表</div> | |||
| <div class="card-body"> | |||
| <form name="form1"> | |||
| <div class="table-responsive"> | |||
| <table class="table table-borderless table-hover"> | |||
| <thead> | |||
| <tr> | |||
| <td scope="col">选择</td> | |||
| <td scope="col">管理员</td> | |||
| <td scope="col">标识</td> | |||
| <td scope="col">模型版本</td> | |||
| <td scope="col">提示词</td> | |||
| <td scope="col">地址</td> | |||
| <td scope="col">时间</td> | |||
| <td scope="col">消耗</td> | |||
| </tr> | |||
| <thead> | |||
| <tbody> | |||
| {dede:datalist} | |||
| <tr> | |||
| <td><input type="checkbox" name="logs" id="logs" value="{dede:field.lid/}"></td> | |||
| <td>{dede:field.userid/}</td> | |||
| <td>{dede:field.pname/}</td> | |||
| <td>{dede:field.model/}</td> | |||
| <td><input type="text" name="t0" value="{dede:field.prompt/}" class="admin-input-lg"></td> | |||
| <td>{dede:field.cip/}</td> | |||
| <td>{dede:field.dtime function="MyDate('y/m/d H:i:s',@me)"/}</td> | |||
| <td> | |||
| 提示:{dede:field.prompt_tokens/} <br/> | |||
| 对话:{dede:field.completion_tokens/} <br/> | |||
| 总计:{dede:field.total_tokens/} | |||
| </td> | |||
| </tr> | |||
| {/dede:datalist} | |||
| <tr> | |||
| <td colspan="7"> | |||
| <a href="javascript:ReSel();" class="btn btn-success btn-sm">反选</a> | |||
| <a href="javascript:DelSel();" class="btn btn-danger btn-sm">删除</a> | |||
| <a href="javascript:ClearLog();" class="btn btn-danger btn-sm">清空</a> | |||
| </td> | |||
| </tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </form> | |||
| {dede:pagelist listsize='6'/} | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <script> | |||
| function getCheckboxItem() { | |||
| var allSel = ''; | |||
| if (document.form1.logs.value) return document.form1.logs.value; | |||
| for (i = 0; i < document.form1.logs.length; i++) { | |||
| if (document.form1.logs[i].checked) { | |||
| if (allSel == "") | |||
| allSel = document.form1.logs[i].value; | |||
| else | |||
| allSel = allSel + "`" + document.form1.logs[i].value; | |||
| } | |||
| } | |||
| return allSel; | |||
| } | |||
| function ReSel() { | |||
| for (i = 0; i < document.form1.logs.length; i++) { | |||
| if (document.form1.logs[i].checked) document.form1.logs[i].checked = false; | |||
| else document.form1.logs[i].checked = true; | |||
| } | |||
| } | |||
| function DelSel() { | |||
| var nid = getCheckboxItem(); | |||
| if (nid == "") { | |||
| alert("请选择项目"); | |||
| return; | |||
| } | |||
| location.href = "log_edit.php?dopost=del&ids=" + nid; | |||
| } | |||
| function ClearLog() { | |||
| location.href = "log_edit.php?dopost=clear"; | |||
| } | |||
| </script> | |||
| </body> | |||
| </html> | |||
| @@ -0,0 +1,72 @@ | |||
| {dede:config.pagesize value='30'/} | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"> | |||
| <title>大模型管理</title> | |||
| <link rel="stylesheet" href="/static/web/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/admin.css"> | |||
| <script src="/static/web/js/jquery.min.js"></script> | |||
| <script src="/static/web/js/bootstrap.min.js"></script> | |||
| <script src="/static/web/js/admin.main.js"></script> | |||
| </head> | |||
| <body> | |||
| <div class="container-fluid"> | |||
| <ol class="breadcrumb"> | |||
| <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li> | |||
| <li class="breadcrumb-item active">大模型管理</li> | |||
| </ol> | |||
| <div class="card shadow-sm mb-3"> | |||
| <div class="card-body"> | |||
| <a href="ai_add.php" class="btn btn-success btn-sm">添加大模型</a> | |||
| <a href="ai_model_main.php" class="btn btn-outline-success btn-sm">模型版本</a> | |||
| </div> | |||
| </div> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">大模型管理</div> | |||
| <div class="card-body"> | |||
| <form name="form1" method="post" action="ai_edit.php"> | |||
| <input type="hidden" name="dopost" value="delall"> | |||
| <input type="hidden" name="allid"> | |||
| <div class="table-responsive"> | |||
| <table class="table table-borderless table-hover"> | |||
| <thead> | |||
| <tr> | |||
| <td scope="col">名称</td> | |||
| <td width="30%">描述</td> | |||
| <td scope="col">隶属公司</td> | |||
| <td scope="col">官网</td> | |||
| <td scope="col">操作</td> | |||
| </tr> | |||
| </thead> | |||
| <tbody> | |||
| {dede:datalist} | |||
| <tr> | |||
| <td>{dede:field.title function='dede_htmlspecialchars(@me)'/}</td> | |||
| <td>{dede:field.description function='dede_htmlspecialchars(@me)'/}</td> | |||
| <td>{dede:field.company/}</td> | |||
| <td>{dede:field.website/}</td> | |||
| <td> | |||
| <a href="ai_edit.php?id={dede:field.id/}&dopost=getedit" | |||
| class="btn btn-light btn-sm"><i class="fa fa-pencil-square" | |||
| title="修改"></i></a> | |||
| <a href="ai_edit.php?id={dede:field.id/}&dopost=delete" | |||
| class="btn btn-danger btn-sm"><i class="fa fa-trash" title="删除"></i></a> | |||
| </td> | |||
| </tr> | |||
| {/dede:datalist} | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </form> | |||
| {dede:pagelist listsize='6'/} | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| @@ -0,0 +1,78 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"> | |||
| <title>添加模型版本</title> | |||
| <link rel="stylesheet" href="/static/web/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/admin.css"> | |||
| <script src="/static/web/js/jquery.min.js"></script> | |||
| <script src="/static/web/js/bootstrap.min.js"></script> | |||
| <script src="/static/web/js/admin.main.js"></script> | |||
| </head> | |||
| <body> | |||
| <div class="container-fluid"> | |||
| <ol class="breadcrumb"> | |||
| <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li> | |||
| <li class="breadcrumb-item"><a href="ai_main.php">大模型管理</a></li> | |||
| <?php if($aiid > 0) { ;?><li class="breadcrumb-item"><a href="ai_edit.php?id=<?php echo $ai['id'];?>"><?php echo $ai['title'];?></a></li><?php }?> | |||
| <li class="breadcrumb-item active">添加模型版本</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">添加模型版本</div> | |||
| <div class="card-body"> | |||
| <form name="form1" action="ai_model_add.php" method="post" enctype="multipart/form-data"> | |||
| <input type="hidden" name="dopost" value="add"> | |||
| <input type="hidden" name="aiid" value="<?php echo $ai['id'];?>"> | |||
| <div class="table-responsive"> | |||
| <table class="table table-borderless"> | |||
| <tbody> | |||
| <tr> | |||
| <td width="260">隶属模型</td> | |||
| <td> | |||
| <?php if($aiid > 0) { ;?> | |||
| id:<?php echo $ai['id'];?> <?php echo $ai['title'];?> | |||
| <?php } else { ?> | |||
| <select id="modelid" class="admin-input-sm"> | |||
| <?php | |||
| $dsql->SetQuery("SELECT * FROM `#@__ai` ORDER BY id"); | |||
| $dsql->Execute(); | |||
| while ($row = $dsql->GetObject()) { | |||
| ?> | |||
| <option value="<?php echo $row->id;?>"><?php echo $row->title;?></option> | |||
| <?php | |||
| } | |||
| ?> | |||
| </select> | |||
| <?php } ?> | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td width="260">Model</td> | |||
| <td><input type="text" name="model" id="model" value="" class="admin-input-lg" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td>名称</td> | |||
| <td><input type="text" name="title" id="title" class="admin-input-lg" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td>描述</td> | |||
| <td><textarea name="description" id="description" class="admin-textarea-sm"></textarea></td> | |||
| </tr> | |||
| <tr> | |||
| <td colspan="2" align="center"> | |||
| <button type="submit" class="btn btn-success btn-sm">保存</button> | |||
| <button type="reset" class="btn btn-outline-success btn-sm">重置</button> | |||
| <button type="button" class="btn btn-outline-success btn-sm" onclick="history.back()">返回</button> | |||
| </td> | |||
| </tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| @@ -0,0 +1,63 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"> | |||
| <title>修改模型版本</title> | |||
| <link rel="stylesheet" href="/static/web/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/admin.css"> | |||
| <script src="/static/web/js/jquery.min.js"></script> | |||
| <script src="/static/web/js/bootstrap.min.js"></script> | |||
| <script src="/static/web/js/admin.main.js"></script> | |||
| </head> | |||
| <body> | |||
| <div class="container-fluid"> | |||
| <ol class="breadcrumb"> | |||
| <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li> | |||
| <li class="breadcrumb-item"><a href="ai_main.php">大模型管理</a></li> | |||
| <li class="breadcrumb-item"><a href="ai_edit.php?id=<?php echo $ai['id'];?>"><?php echo $ai['title'];?></a></li> | |||
| <li class="breadcrumb-item active">修改模型版本</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">修改模型版本</div> | |||
| <div class="card-body"> | |||
| <form name="form1" action="ai_model_edit.php" method="post" enctype="multipart/form-data"> | |||
| <input type="hidden" name="dopost" value="saveedit"> | |||
| <input type="hidden" name="aiid" value="<?php echo $myModel['aiid']?>"> | |||
| <input type="hidden" name="id" value="<?php echo $myModel['id']?>"> | |||
| <div class="table-responsive"> | |||
| <table class="table table-borderless"> | |||
| <tbody> | |||
| <tr> | |||
| <td width="260">隶属模型</td> | |||
| <td>id:<?php echo $ai['id'];?> <?php echo $ai['title'];?></td> | |||
| </tr> | |||
| <tr> | |||
| <td width="260">Model</td> | |||
| <td><input type="text" name="model" id="model" value="<?php echo $myModel['model']?>" class="admin-input-lg" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td>名称</td> | |||
| <td><input type="text" name="title" id="title" value="<?php echo $myModel['title']?>" class="admin-input-lg" required></td> | |||
| </tr> | |||
| <tr> | |||
| <td>描述</td> | |||
| <td><textarea name="description" id="description" class="admin-textarea-sm"><?php echo $myModel['description']?></textarea></td> | |||
| </tr> | |||
| <tr> | |||
| <td colspan="2" align="center"> | |||
| <button type="submit" class="btn btn-success btn-sm">保存</button> | |||
| <button type="reset" class="btn btn-outline-success btn-sm">重置</button> | |||
| <button type="button" class="btn btn-outline-success btn-sm" onclick="history.back()">返回</button> | |||
| </td> | |||
| </tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| @@ -0,0 +1,66 @@ | |||
| {dede:config.pagesize value='30'/} | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"> | |||
| <title>模型版本管理</title> | |||
| <link rel="stylesheet" href="/static/web/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/admin.css"> | |||
| <script src="/static/web/js/jquery.min.js"></script> | |||
| <script src="/static/web/js/bootstrap.min.js"></script> | |||
| <script src="/static/web/js/admin.main.js"></script> | |||
| </head> | |||
| <body> | |||
| <div class="container-fluid"> | |||
| <ol class="breadcrumb"> | |||
| <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li> | |||
| <li class="breadcrumb-item"><a href="ai_main.php">大模型管理</a></li> | |||
| <li class="breadcrumb-item active">模型版本管理</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header d-flex justify-content-between align-items-center">模型版本管理 <a href="ai_model_add.php" class="btn btn-success btn-sm">添加模型版本</a></div> | |||
| <div class="card-body"> | |||
| <form name="form1" method="post" action="ai_model_edit.php"> | |||
| <input type="hidden" name="dopost" value="delall"> | |||
| <input type="hidden" name="allid"> | |||
| <div class="table-responsive"> | |||
| <table class="table table-borderless table-hover"> | |||
| <thead> | |||
| <tr> | |||
| <td scope="col">ID</td> | |||
| <td scope="col">Model</td> | |||
| <td scope="col">名称</td> | |||
| <td scope="col">大模型</td> | |||
| <td scope="col" width="30%">描述</td> | |||
| <td scope="col">操作</td> | |||
| </tr> | |||
| </thead> | |||
| <tbody> | |||
| {dede:datalist} | |||
| <tr> | |||
| <td>{dede:field.id/}</td> | |||
| <td>{dede:field.model function='dede_htmlspecialchars(@me)'/}</td> | |||
| <td>{dede:field.title function='dede_htmlspecialchars(@me)'/}</td> | |||
| <td>{dede:field.aititle/}</td> | |||
| <td>{dede:field.description/}</td> | |||
| <td> | |||
| <a href="ai_model_edit.php?id={dede:field.id/}" class="btn btn-light btn-sm"><i class="fa fa-pencil-square" title="修改"></i></a> | |||
| <a href="ai_model_edit.php?id={dede:field.id/}&dopost=delete" class="btn btn-danger btn-sm"><i class="fa fa-trash" title="删除"></i></a> | |||
| </td> | |||
| </tr> | |||
| {/dede:datalist} | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </form> | |||
| {dede:pagelist listsize='6'/} | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| @@ -0,0 +1,75 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"> | |||
| <title>添加提示词</title> | |||
| <link rel="stylesheet" href="/static/web/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/admin.css"> | |||
| <script src="/static/web/js/jquery.min.js"></script> | |||
| <script src="/static/web/js/bootstrap.min.js"></script> | |||
| <script src="/static/web/js/admin.main.js"></script> | |||
| </head> | |||
| <body> | |||
| <div class="container-fluid"> | |||
| <ol class="breadcrumb"> | |||
| <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li> | |||
| <li class="breadcrumb-item"><a href="ai_prompt_main.php">提示词管理</a></li> | |||
| <li class="breadcrumb-item active">添加提示词</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">添加提示词</div> | |||
| <div class="card-body"> | |||
| <form name="form1" action="ai_prompt_add.php" method="post" enctype="multipart/form-data"> | |||
| <input type="hidden" name="dopost" value="add"> | |||
| <div class="table-responsive"> | |||
| <table class="table table-borderless"> | |||
| <tbody> | |||
| <tr> | |||
| <td width="260">标识</td> | |||
| <td> | |||
| <input name="pname" id="pname" class="admin-input-lg" | |||
| required>(英文数字组成) | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td width="260">名称</td> | |||
| <td> | |||
| <input name="title" id="title" class="admin-input-lg" | |||
| required> | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td>描述</td> | |||
| <td><textarea name="description" id="description" | |||
| class="admin-textarea-sm"></textarea></td> | |||
| </tr> | |||
| <tr> | |||
| <td>提示词规则</td> | |||
| <td> | |||
| <textarea name="prompt" id="prompt" class="admin-textarea-sm" style="height: 200px;"></textarea>(AI系统提示词) | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td>默认提示词</td> | |||
| <td><textarea name="dfprompt" id="dfprompt" class="admin-textarea-sm"></textarea>(用户不提交内容,默认采用的提示词)</td> | |||
| </tr> | |||
| <tr> | |||
| <td colspan="2" align="center"> | |||
| <button type="submit" class="btn btn-success btn-sm">保存</button> | |||
| <button type="reset" class="btn btn-outline-success btn-sm">重置</button> | |||
| <a href="ai_prompt_main.php" class="btn btn-outline-success btn-sm">返回</a> | |||
| </td> | |||
| </tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| @@ -0,0 +1,82 @@ | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"> | |||
| <title>修改提示词</title> | |||
| <link rel="stylesheet" href="/static/web/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/admin.css"> | |||
| <script src="/static/web/js/jquery.min.js"></script> | |||
| <script src="/static/web/js/bootstrap.min.js"></script> | |||
| <script src="/static/web/js/admin.main.js"></script> | |||
| </head> | |||
| <body> | |||
| <div class="container-fluid"> | |||
| <ol class="breadcrumb"> | |||
| <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li> | |||
| <li class="breadcrumb-item"><a href="ai_prompt_main.php">提示词管理</a></li> | |||
| <li class="breadcrumb-item active">修改提示词</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">修改提示词</div> | |||
| <div class="card-body"> | |||
| <form name="form1" action="ai_prompt_edit.php" method="post" enctype="multipart/form-data"> | |||
| <input type="hidden" name="dopost" value="saveedit"> | |||
| <input type="hidden" name="id" value="<?php echo $myPrompt['id']?>"> | |||
| <div class="table-responsive"> | |||
| <?php | |||
| if(!empty($myPrompt['info'])){ | |||
| ?> | |||
| <div class="alert alert-warning"> | |||
| <?php echo $myPrompt['info']?> | |||
| </div> | |||
| <?php | |||
| } | |||
| ?> | |||
| <table class="table table-borderless"> | |||
| <tbody> | |||
| <tr> | |||
| <td width="260">标识</td> | |||
| <td> | |||
| <?php echo $myPrompt['pname']?> | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td width="260">名称</td> | |||
| <td> | |||
| <input name="title" id="title" value="<?php echo $myPrompt['title']?>" class="admin-input-lg" | |||
| required> | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td>描述</td> | |||
| <td><textarea name="description" id="description" | |||
| class="admin-textarea-sm"><?php echo $myPrompt['description']?></textarea></td> | |||
| </tr> | |||
| <tr> | |||
| <td>提示词规则</td> | |||
| <td> | |||
| <textarea name="prompt" id="prompt" class="admin-textarea-sm" style="height: 200px;"><?php echo $myPrompt['prompt']?></textarea> | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td>默认提示词</td> | |||
| <td><textarea name="dfprompt" id="dfprompt" class="admin-textarea-sm"><?php echo $myPrompt['dfprompt']?></textarea></td> | |||
| </tr> | |||
| <tr> | |||
| <td colspan="2" align="center"> | |||
| <button type="submit" class="btn btn-success btn-sm">保存</button> | |||
| <button type="reset" class="btn btn-outline-success btn-sm">重置</button> | |||
| <a href="ai_prompt_main.php" class="btn btn-outline-success btn-sm">返回</a> | |||
| </td> | |||
| </tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| @@ -0,0 +1,75 @@ | |||
| {dede:config.pagesize value='30'/} | |||
| <!DOCTYPE html> | |||
| <html> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"> | |||
| <title>提示词管理</title> | |||
| <link rel="stylesheet" href="/static/web/css/font-awesome.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/bootstrap.min.css"> | |||
| <link rel="stylesheet" href="/static/web/css/admin.css"> | |||
| <script src="/static/web/js/jquery.min.js"></script> | |||
| <script src="/static/web/js/bootstrap.min.js"></script> | |||
| <script src="/static/web/js/admin.main.js"></script> | |||
| </head> | |||
| <body> | |||
| <div class="container-fluid"> | |||
| <ol class="breadcrumb"> | |||
| <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li> | |||
| <li class="breadcrumb-item active">提示词管理</li> | |||
| </ol> | |||
| <div class="card shadow-sm mb-3"> | |||
| <div class="card-body"> | |||
| <a href="ai_prompt_add.php" class="btn btn-success btn-sm">添加提示词</a> | |||
| </div> | |||
| </div> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">提示词管理</div> | |||
| <div class="card-body"> | |||
| <form name="form1" method="post" action="ai_edit.php"> | |||
| <input type="hidden" name="dopost" value="delall"> | |||
| <input type="hidden" name="allid"> | |||
| <div class="table-responsive"> | |||
| <table class="table table-borderless table-hover"> | |||
| <thead> | |||
| <tr> | |||
| <td scope="col">ID</td> | |||
| <td scope="col">标识</td> | |||
| <td scope="col">名称</td> | |||
| <td scope="col">系统</td> | |||
| <td scope="col">描述</td> | |||
| <td scope="col">操作</td> | |||
| </tr> | |||
| </thead> | |||
| <tbody> | |||
| {dede:datalist} | |||
| <tr> | |||
| <td>{dede:field.id/}</td> | |||
| <td>{dede:field.pname/}</td> | |||
| <td>{dede:field.title function='dede_htmlspecialchars(@me)'/}</td> | |||
| <td><?php echo $fields['issystem']==0?'否' : '是';?></td> | |||
| <td>{dede:field.description function='dede_htmlspecialchars(@me)'/}</td> | |||
| <td> | |||
| <a href="ai_prompt_edit.php?id={dede:field.id/}&dopost=getedit" | |||
| class="btn btn-light btn-sm"><i class="fa fa-pencil-square" | |||
| title="修改"></i></a> | |||
| <?php if($fields['issystem']==0) {?> | |||
| <a href="ai_prompt_edit.php?id={dede:field.id/}&dopost=delete" | |||
| class="btn btn-danger btn-sm"><i class="fa fa-trash" title="删除"></i></a> | |||
| <?php }?> | |||
| </td> | |||
| </tr> | |||
| {/dede:datalist} | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </form> | |||
| {dede:pagelist listsize='6'/} | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| @@ -26,7 +26,7 @@ | |||
| <li class="breadcrumb-item active">发布文档</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">发布文档</div> | |||
| <div class="card-header d-flex justify-content-between align-items-center">发布文档 <button type="button" id="btnAI" onclick="showAI();" class="btn btn-success btn-sm">AI发布文档</button></div> | |||
| <div class="card-body"> | |||
| <form name="form1" action="article_add.php" method="post" enctype="multipart/form-data"> | |||
| <input type="hidden" name="channelid" value="<?php echo $channelid?>"> | |||
| @@ -223,6 +223,165 @@ | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div id="mdlAI" class="modal fade" tabindex="-1" aria-hidden="true"> | |||
| <div class="modal-dialog modal-xl"> | |||
| <div class="modal-content"> | |||
| <div class="modal-header"> | |||
| <h5 class="modal-title">AI发布文档</h5> | |||
| <button type="button" class="update-close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i></button> | |||
| </div> | |||
| <div class="modal-body"> | |||
| <form> | |||
| <div class="form-group"> | |||
| <textarea class="admin-input-sm" style="width: 100%;height: 100px;" id="prompt" placeholder="我需要写一篇介绍穆云智能科技公司的文章"></textarea><br/> | |||
| 选择模型:<select id="modelid" class="admin-input-sm" style="width: 100%;"> | |||
| <?php | |||
| $dsql->SetQuery("SELECT AM.*,A.title as aititle FROM `#@__ai_model` AM LEFT JOIN `#@__ai` A ON A.id = AM.aiid ORDER BY id"); | |||
| $dsql->Execute(); | |||
| while ($row = $dsql->GetObject()) { | |||
| ?> | |||
| <option value="<?php echo $row->id;?>"<?php echo $row->isdefault==1?' selected' : '';?>><?php echo $row->model;?>(<?php echo $row->aititle;?>)</option> | |||
| <?php | |||
| } | |||
| ?> | |||
| </select><br/> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| <div class="modal-footer"> | |||
| <button id="btnAIAction" class="btn btn-success">AI生成</button> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <script>InitPage();</script> | |||
| <script> | |||
| let eventSource; // 保存 EventSource 实例 | |||
| let modelid = 0; | |||
| function showAI() { | |||
| $("#mdlAI").modal('show'); | |||
| } | |||
| $("#btnAIAction").click(function() { | |||
| let prompt = document.getElementById("prompt").value; | |||
| let modelid = document.getElementById("modelid").value; | |||
| let eventSource = new EventSource(`<?php echo $cfg_ai_server;?>/ai/article_add?modelid=${modelid}&prompt=${prompt}`); | |||
| // 新增状态跟踪变量 | |||
| let currentKey = null; | |||
| let tagBuffer = ""; | |||
| let isClosingTag = false; | |||
| $("#mdlAI").modal('hide'); | |||
| $("#btnAI").attr("disabled", "disabled"); | |||
| prompt = ""; | |||
| let lastChar = ""; | |||
| let bodyHtml = ""; | |||
| let typeid = ""; | |||
| eventSource.onmessage = (event) => { | |||
| const chars = event.data.split(''); | |||
| chars.forEach(char => { | |||
| if (lastChar === '\\' && char === 'r') { | |||
| char = '<br>'; // 替换为 <br> 标签 | |||
| lastChar = ""; // 清空追踪字符 | |||
| } else { | |||
| lastChar = char; // 记录当前字符 | |||
| } | |||
| if (char === '\\') { | |||
| return; // 如果是反斜杠,跳过处理 | |||
| } | |||
| if (currentKey) { | |||
| if (char === '{') { | |||
| isClosingTag = true; | |||
| tagBuffer = '{'; | |||
| return; | |||
| } | |||
| if (isClosingTag) { | |||
| tagBuffer += char; | |||
| if (tagBuffer === `{/${currentKey}}`) { | |||
| if (currentKey == "body") { | |||
| CKEDITOR.instances["body"].setReadOnly(false); | |||
| bodyHtml = ""; | |||
| } else if(currentKey == "typeid"){ | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) { | |||
| $(input).val(typeid); | |||
| $(input).prop("disabled", false).removeClass("disabled"); // 恢复输入状态 | |||
| } | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) $(input).prop("disabled", false).removeClass("disabled"); // 恢复输入状态 | |||
| } | |||
| currentKey = null; | |||
| isClosingTag = false; | |||
| tagBuffer = ""; | |||
| return; | |||
| } | |||
| if (!`{/${currentKey}}`.startsWith(tagBuffer)) { | |||
| if (currentKey == "body") { | |||
| bodyHtml += tagBuffer; | |||
| CKEDITOR.instances["body"].setData(bodyHtml) | |||
| } else if(currentKey == "typeid"){ | |||
| typeid += tagBuffer; | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) input.value += tagBuffer; | |||
| } | |||
| isClosingTag = false; | |||
| tagBuffer = ""; | |||
| } | |||
| } else { | |||
| if (currentKey == "body") { | |||
| // CKEDITOR.instances["body"].insertHtml(char); | |||
| bodyHtml += char; | |||
| CKEDITOR.instances["body"].setData(bodyHtml) | |||
| } else if(currentKey == "typeid"){ | |||
| typeid += char; | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) { | |||
| input.value += char; | |||
| input.scrollTop = input.scrollHeight; // 滚动到底部 | |||
| } | |||
| } | |||
| } | |||
| } else { | |||
| if (char === '{') { | |||
| tagBuffer = '{'; | |||
| } else if (tagBuffer.startsWith('{')) { | |||
| tagBuffer += char; | |||
| if (char === '}') { | |||
| const match = tagBuffer.match(/{([^>]+)}/); | |||
| if (match) { | |||
| currentKey = match[1]; | |||
| if (currentKey == "body") { | |||
| CKEDITOR.instances["body"].setReadOnly(true); | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) { | |||
| $(input).prop("disabled", true).addClass("disabled"); // 仅禁用当前输入框 | |||
| input.value = ""; | |||
| } | |||
| } | |||
| } | |||
| tagBuffer = ""; | |||
| } | |||
| } | |||
| } | |||
| }); | |||
| }; | |||
| eventSource.onerror = (error) => { | |||
| console.log("连接已关闭"); | |||
| $("#btnAI").prop("disabled", false); | |||
| eventSource.close(); | |||
| }; | |||
| }); | |||
| </script> | |||
| </body> | |||
| </html> | |||
| @@ -26,7 +26,7 @@ | |||
| <li class="breadcrumb-item active">修改文档</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">修改<?php echo $arcRow['title'];?>文档</div> | |||
| <div class="card-header d-flex justify-content-between align-items-center">修改<?php echo $arcRow['title'];?>文档 <button type="button" id="btnAI" onclick="showAI();" class="btn btn-success btn-sm">AI修改文档</button></div> | |||
| <div class="card-body"> | |||
| <form name="form1" action="article_edit.php" method="post" enctype="multipart/form-data"> | |||
| <input type="hidden" name="dopost" value="save"> | |||
| @@ -218,6 +218,165 @@ | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div id="mdlAI" class="modal fade" tabindex="-1" aria-hidden="true"> | |||
| <div class="modal-dialog modal-xl"> | |||
| <div class="modal-content"> | |||
| <div class="modal-header"> | |||
| <h5 class="modal-title">AI修改文档</h5> | |||
| <button type="button" class="update-close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i></button> | |||
| </div> | |||
| <div class="modal-body"> | |||
| <form> | |||
| <div class="form-group"> | |||
| <textarea class="admin-input-sm" style="width: 100%;height: 100px;" id="prompt" placeholder="填写您需要对当前的内容进行怎样的优化,例如:我需要对当前文章就行润色,内容轻松活泼些,不要出现错别字"></textarea><br/> | |||
| 选择模型:<select id="modelid" class="admin-input-sm" style="width: 100%;"> | |||
| <?php | |||
| $dsql->SetQuery("SELECT AM.*,A.title as aititle FROM `#@__ai_model` AM LEFT JOIN `#@__ai` A ON A.id = AM.aiid ORDER BY id"); | |||
| $dsql->Execute(); | |||
| while ($row = $dsql->GetObject()) { | |||
| ?> | |||
| <option value="<?php echo $row->id;?>"<?php echo $row->isdefault==1?' selected' : '';?>><?php echo $row->model;?>(<?php echo $row->aititle;?>)</option> | |||
| <?php | |||
| } | |||
| ?> | |||
| </select><br/> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| <div class="modal-footer"> | |||
| <button id="btnAIAction" class="btn btn-success">AI生成</button> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <script>InitPage();</script> | |||
| <script> | |||
| let eventSource; // 保存 EventSource 实例 | |||
| let modelid = 0; | |||
| function showAI() { | |||
| $("#mdlAI").modal('show'); | |||
| } | |||
| $("#btnAIAction").click(function() { | |||
| let prompt = document.getElementById("prompt").value; | |||
| let modelid = document.getElementById("modelid").value; | |||
| let eventSource = new EventSource(`<?php echo $cfg_ai_server;?>/ai/article_edit?aid=<?php echo $aid?>&modelid=${modelid}&prompt=${prompt}`); | |||
| // 新增状态跟踪变量 | |||
| let currentKey = null; | |||
| let tagBuffer = ""; | |||
| let isClosingTag = false; | |||
| $("#mdlAI").modal('hide'); | |||
| $("#btnAI").attr("disabled", "disabled"); | |||
| prompt = ""; | |||
| let lastChar = ""; | |||
| let bodyHtml = ""; | |||
| let typeid = ""; | |||
| eventSource.onmessage = (event) => { | |||
| const chars = event.data.split(''); | |||
| chars.forEach(char => { | |||
| if (lastChar === '\\' && char === 'r') { | |||
| char = '<br>'; // 替换为 <br> 标签 | |||
| lastChar = ""; // 清空追踪字符 | |||
| } else { | |||
| lastChar = char; // 记录当前字符 | |||
| } | |||
| if (char === '\\') { | |||
| return; // 如果是反斜杠,跳过处理 | |||
| } | |||
| if (currentKey) { | |||
| if (char === '{') { | |||
| isClosingTag = true; | |||
| tagBuffer = '{'; | |||
| return; | |||
| } | |||
| if (isClosingTag) { | |||
| tagBuffer += char; | |||
| if (tagBuffer === `{/${currentKey}}`) { | |||
| if (currentKey == "body") { | |||
| CKEDITOR.instances["body"].setReadOnly(false); | |||
| bodyHtml = ""; | |||
| } else if(currentKey == "typeid"){ | |||
| typeid += tagBuffer; | |||
| } else if(currentKey == "typeid"){ | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| console.log("typeid=",typeid); | |||
| if (input) { | |||
| $(input).val(typeid); | |||
| $(input).prop("disabled", false).removeClass("disabled"); // 恢复输入状态 | |||
| } | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) $(input).prop("disabled", false).removeClass("disabled"); // 恢复输入状态 | |||
| } | |||
| currentKey = null; | |||
| isClosingTag = false; | |||
| tagBuffer = ""; | |||
| return; | |||
| } | |||
| if (!`{/${currentKey}}`.startsWith(tagBuffer)) { | |||
| if (currentKey == "body") { | |||
| bodyHtml += tagBuffer; | |||
| CKEDITOR.instances["body"].setData(bodyHtml) | |||
| } else if(currentKey == "typeid"){ | |||
| typeid += char; | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) input.value += tagBuffer; | |||
| } | |||
| isClosingTag = false; | |||
| tagBuffer = ""; | |||
| } | |||
| } else { | |||
| if (currentKey == "body") { | |||
| // CKEDITOR.instances["body"].insertHtml(char); | |||
| bodyHtml += char; | |||
| CKEDITOR.instances["body"].setData(bodyHtml) | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) { | |||
| input.value += char; | |||
| input.scrollTop = input.scrollHeight; // 滚动到底部 | |||
| } | |||
| } | |||
| } | |||
| } else { | |||
| if (char === '{') { | |||
| tagBuffer = '{'; | |||
| } else if (tagBuffer.startsWith('{')) { | |||
| tagBuffer += char; | |||
| if (char === '}') { | |||
| const match = tagBuffer.match(/{([^>]+)}/); | |||
| if (match) { | |||
| currentKey = match[1]; | |||
| if (currentKey == "body") { | |||
| CKEDITOR.instances["body"].setReadOnly(true); | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) { | |||
| $(input).prop("disabled", true).addClass("disabled"); // 仅禁用当前输入框 | |||
| input.value = ""; | |||
| } | |||
| } | |||
| } | |||
| tagBuffer = ""; | |||
| } | |||
| } | |||
| } | |||
| }); | |||
| }; | |||
| eventSource.onerror = (error) => { | |||
| console.log("连接已关闭"); | |||
| $("#btnAI").prop("disabled", false); | |||
| eventSource.close(); | |||
| }; | |||
| }); | |||
| </script> | |||
| </body> | |||
| </html> | |||
| @@ -19,7 +19,7 @@ | |||
| <li class="breadcrumb-item active">添加栏目</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">添加栏目</div> | |||
| <div class="card-header d-flex justify-content-between align-items-center">添加栏目 <button type="button" id="btnAI" onclick="showAI();" class="btn btn-success btn-sm">AI创建栏目</button></div> | |||
| <div class="card-body"> | |||
| <form name="form1" action="catalog_add.php" method="post"> | |||
| <input type="hidden" name="dopost" value="save"> | |||
| @@ -293,6 +293,38 @@ | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div id="mdlAI" class="modal fade" tabindex="-1" aria-hidden="true"> | |||
| <div class="modal-dialog modal-xl"> | |||
| <div class="modal-content"> | |||
| <div class="modal-header"> | |||
| <h5 class="modal-title">AI创建栏目</h5> | |||
| <button type="button" class="update-close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i></button> | |||
| </div> | |||
| <div class="modal-body"> | |||
| <form> | |||
| <div class="form-group"> | |||
| <textarea class="admin-input-sm" style="width: 100%;height: 100px;" id="prompt" placeholder="填写您需要创建栏目的要求,例如:我需要创建一个介绍穆云智能科技公司的栏目"></textarea><br/> | |||
| 选择模型:<select id="modelid" class="admin-input-sm" style="width: 100%;"> | |||
| <?php | |||
| $dsql->SetQuery("SELECT AM.*,A.title as aititle FROM `#@__ai_model` AM LEFT JOIN `#@__ai` A ON A.id = AM.aiid ORDER BY id"); | |||
| $dsql->Execute(); | |||
| while ($row = $dsql->GetObject()) { | |||
| ?> | |||
| <option value="<?php echo $row->id;?>"<?php echo $row->isdefault==1?' selected' : '';?>><?php echo $row->model;?>(<?php echo $row->aititle;?>)</option> | |||
| <?php | |||
| } | |||
| ?> | |||
| </select><br/> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| <div class="modal-footer"> | |||
| <button id="btnAIAction" class="btn btn-success">AI生成</button> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <script> | |||
| var channelArray = new Array(); | |||
| <?php | |||
| @@ -375,6 +407,120 @@ | |||
| jQuery("#apikey").val(data); | |||
| }); | |||
| } | |||
| let eventSource; // 保存 EventSource 实例 | |||
| let modelid = 0; | |||
| function showAI() { | |||
| $("#mdlAI").modal('show'); | |||
| } | |||
| $("#btnAIAction").click(function() { | |||
| let prompt = document.getElementById("prompt").value; | |||
| let modelid = document.getElementById("modelid").value; | |||
| let eventSource = new EventSource(`<?php echo $cfg_ai_server;?>/ai/catalog_add?modelid=${modelid}&prompt=${prompt}`); | |||
| // 新增状态跟踪变量 | |||
| let currentKey = null; | |||
| let tagBuffer = ""; | |||
| let isClosingTag = false; | |||
| $("#mdlAI").modal('hide'); | |||
| $("#btnAI").attr("disabled", "disabled"); | |||
| prompt = ""; | |||
| let bodyHtml = ""; | |||
| let lastChar = ""; | |||
| eventSource.onmessage = (event) => { | |||
| const chars = event.data.split(''); | |||
| chars.forEach(char => { | |||
| if (lastChar === '\\' && char === 'r') { | |||
| char = '<br>'; // 替换为 <br> 标签 | |||
| lastChar = ""; // 清空追踪字符 | |||
| } else { | |||
| lastChar = char; // 记录当前字符 | |||
| } | |||
| if (char === '\\') { | |||
| return; // 如果是反斜杠,跳过处理 | |||
| } | |||
| if (currentKey) { | |||
| if (char === '{') { | |||
| isClosingTag = true; | |||
| tagBuffer = '{'; | |||
| return; | |||
| } | |||
| if (isClosingTag) { | |||
| tagBuffer += char; | |||
| if (tagBuffer === `{/${currentKey}}`) { | |||
| if (currentKey == "content") { | |||
| CKEDITOR.instances["content"].setReadOnly(false); | |||
| bodyHtml = ""; | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) $(input).prop("disabled", false).removeClass("disabled"); // 恢复输入状态 | |||
| } | |||
| currentKey = null; | |||
| isClosingTag = false; | |||
| tagBuffer = ""; | |||
| return; | |||
| } | |||
| if (!`{/${currentKey}}`.startsWith(tagBuffer)) { | |||
| if (currentKey == "content") { | |||
| bodyHtml += tagBuffer; | |||
| console.log(bodyHtml); | |||
| CKEDITOR.instances["content"].setData(bodyHtml) | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) input.value += tagBuffer; | |||
| } | |||
| isClosingTag = false; | |||
| tagBuffer = ""; | |||
| } | |||
| } else { | |||
| if (currentKey == "content") { | |||
| bodyHtml += char; | |||
| CKEDITOR.instances["content"].setData(bodyHtml) | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) { | |||
| input.value += char; | |||
| input.scrollTop = input.scrollHeight; // 滚动到底部 | |||
| } | |||
| } | |||
| } | |||
| } else { | |||
| if (char === '{') { | |||
| tagBuffer = '{'; | |||
| } else if (tagBuffer.startsWith('{')) { | |||
| tagBuffer += char; | |||
| if (char === '}') { | |||
| const match = tagBuffer.match(/{([^>]+)}/); | |||
| if (match) { | |||
| currentKey = match[1]; | |||
| if (currentKey == "content") { | |||
| CKEDITOR.instances["content"].setReadOnly(true); | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) { | |||
| $(input).prop("disabled", true).addClass("disabled"); // 仅禁用当前输入框 | |||
| input.value = ""; | |||
| } | |||
| } | |||
| } | |||
| tagBuffer = ""; | |||
| } | |||
| } | |||
| } | |||
| }); | |||
| }; | |||
| eventSource.onerror = (error) => { | |||
| console.log("连接已关闭"); | |||
| $("#btnAI").prop("disabled", false); | |||
| eventSource.close(); | |||
| }; | |||
| }); | |||
| </script> | |||
| </body> | |||
| </html> | |||
| @@ -19,7 +19,7 @@ | |||
| <li class="breadcrumb-item active">批量添加栏目</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">批量添加栏目</div> | |||
| <div class="card-header d-flex justify-content-between align-items-center">批量添加栏目<button type="button" id="btnAI" onclick="showAI();" class="btn btn-success btn-sm">AI批量创建</button></div> | |||
| <div class="card-body"> | |||
| <form name="form1" action="catalog_add.php" method="post"> | |||
| <input type="hidden" name="dopost" value="savequick"> | |||
| @@ -190,6 +190,38 @@ | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div id="mdlAI" class="modal fade" tabindex="-1" aria-hidden="true"> | |||
| <div class="modal-dialog modal-xl"> | |||
| <div class="modal-content"> | |||
| <div class="modal-header"> | |||
| <h5 class="modal-title">AI批量创建栏目</h5> | |||
| <button type="button" class="update-close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i></button> | |||
| </div> | |||
| <div class="modal-body"> | |||
| <form> | |||
| <div class="form-group"> | |||
| <textarea class="admin-input-sm" style="width: 100%;height: 100px;" id="prompt" placeholder="填写您站点规划,AI帮您自动规划栏目,例如:我需要创建一个企业信息展示类站点"></textarea><br/> | |||
| 选择模型:<select id="modelid" class="admin-input-sm" style="width: 100%;"> | |||
| <?php | |||
| $dsql->SetQuery("SELECT AM.*,A.title as aititle FROM `#@__ai_model` AM LEFT JOIN `#@__ai` A ON A.id = AM.aiid ORDER BY id"); | |||
| $dsql->Execute(); | |||
| while ($row = $dsql->GetObject()) { | |||
| ?> | |||
| <option value="<?php echo $row->id;?>"<?php echo $row->isdefault==1?' selected' : '';?>><?php echo $row->model;?>(<?php echo $row->aititle;?>)</option> | |||
| <?php | |||
| } | |||
| ?> | |||
| </select><br/> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| <div class="modal-footer"> | |||
| <button id="btnAIAction" class="btn btn-success">AI生成</button> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <script> | |||
| var $ = jQuery; | |||
| function ShowHide(objname) { | |||
| @@ -223,7 +255,7 @@ | |||
| $(document).ready(function() { | |||
| //添加按钮事件 | |||
| $("#addQuick .add").click(function() { | |||
| var id = $("#addQuick tr").prevAll("tr").length + 1; | |||
| var id = $("#addQuick tr").prevAll("tr").length + 2; | |||
| $("#addQuick tr:eq(1)").clone(true).addClass("repeat") | |||
| .find(".rank input").attr("value", function() { | |||
| return id; | |||
| @@ -249,6 +281,115 @@ | |||
| }).end().appendTo($("#addQuickRel")); | |||
| }); | |||
| }); | |||
| function showAI() { | |||
| $("#mdlAI").modal('show'); | |||
| } | |||
| $("#btnAIAction").click(function() { | |||
| let prompt = document.getElementById("prompt").value; | |||
| let modelid = document.getElementById("modelid").value; | |||
| let eventSource = new EventSource(`<?php echo $cfg_ai_server;?>/ai/catalog_add_quick?modelid=${modelid}&prompt=${prompt}`); | |||
| // 新增状态跟踪变量 | |||
| let currentKey = null; | |||
| let tagBuffer = ""; | |||
| let isClosingTag = false; | |||
| $("#mdlAI").modal('hide'); | |||
| $("#btnAI").attr("disabled", "disabled"); | |||
| prompt = ""; | |||
| let lastChar = ""; | |||
| eventSource.onmessage = (event) => { | |||
| const chars = event.data.split(''); | |||
| chars.forEach(char => { | |||
| if (lastChar === '\\' && char === 'r') { | |||
| char = '<br>'; // 替换为 <br> 标签 | |||
| lastChar = ""; // 清空追踪字符 | |||
| } else { | |||
| lastChar = char; // 记录当前字符 | |||
| } | |||
| if (char === '\\') { | |||
| return; // 如果是反斜杠,跳过处理 | |||
| } | |||
| if (currentKey) { | |||
| if (char === '{') { | |||
| isClosingTag = true; | |||
| tagBuffer = '{'; | |||
| return; | |||
| } | |||
| if (isClosingTag) { | |||
| tagBuffer += char; | |||
| if (tagBuffer === `{/${currentKey}}`) { | |||
| if (currentKey == "content") { | |||
| // CKEDITOR.instances["content"].setReadOnly(false); | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) $(input).prop("disabled", false).removeClass("disabled"); // 恢复输入状态 | |||
| } | |||
| currentKey = null; | |||
| isClosingTag = false; | |||
| tagBuffer = ""; | |||
| return; | |||
| } | |||
| if (!`{/${currentKey}}`.startsWith(tagBuffer)) { | |||
| if (currentKey == "content") { | |||
| CKEDITOR.instances["content"].insertHtml(tagBuffer); | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) input.value += tagBuffer; | |||
| } | |||
| isClosingTag = false; | |||
| tagBuffer = ""; | |||
| } | |||
| } else { | |||
| if (currentKey == "content") { | |||
| CKEDITOR.instances["content"].insertHtml(char); | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) { | |||
| input.value += char; | |||
| input.scrollTop = input.scrollHeight; // 滚动到底部 | |||
| } | |||
| } | |||
| } | |||
| } else { | |||
| if (char === '{') { | |||
| tagBuffer = '{'; | |||
| } else if (tagBuffer.startsWith('{')) { | |||
| tagBuffer += char; | |||
| if (char === '}') { | |||
| const match = tagBuffer.match(/{([^>]+)}/); | |||
| if (match) { | |||
| currentKey = match[1]; | |||
| if (currentKey == "content") { | |||
| // CKEDITOR.instances["content"].setReadOnly(true); | |||
| CKEDITOR.instances["content"].setData("") | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) { | |||
| $(input).prop("disabled", true).addClass("disabled"); // 仅禁用当前输入框 | |||
| input.value = ""; | |||
| } | |||
| } | |||
| } | |||
| tagBuffer = ""; | |||
| } | |||
| } | |||
| } | |||
| }); | |||
| }; | |||
| eventSource.onerror = (error) => { | |||
| console.log("连接已关闭"); | |||
| $("#btnAI").prop("disabled", false); | |||
| eventSource.close(); | |||
| }; | |||
| }); | |||
| </script> | |||
| </body> | |||
| </html> | |||
| @@ -19,7 +19,7 @@ | |||
| <li class="breadcrumb-item active">修改栏目</li> | |||
| </ol> | |||
| <div class="card shadow-sm"> | |||
| <div class="card-header">修改栏目</div> | |||
| <div class="card-header d-flex justify-content-between align-items-center">修改栏目 <button type="button" id="btnAI" onclick="showAI();" class="btn btn-success btn-sm">AI修改栏目</button></div> | |||
| <div class="card-body"> | |||
| <form name="form1" action="catalog_edit.php" method="post"> | |||
| <input type="hidden" name="dopost" value="save"> | |||
| @@ -323,6 +323,38 @@ | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div id="mdlAI" class="modal fade" tabindex="-1" aria-hidden="true"> | |||
| <div class="modal-dialog modal-xl"> | |||
| <div class="modal-content"> | |||
| <div class="modal-header"> | |||
| <h5 class="modal-title">AI修改栏目</h5> | |||
| <button type="button" class="update-close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i></button> | |||
| </div> | |||
| <div class="modal-body"> | |||
| <form> | |||
| <div class="form-group"> | |||
| <textarea class="admin-input-sm" style="width: 100%;height: 100px;" id="prompt" placeholder="填写您需要修改栏目的要求,例如:我需要栏目信息内容更丰富一些"></textarea><br/> | |||
| 选择模型:<select id="modelid" class="admin-input-sm" style="width: 100%;"> | |||
| <?php | |||
| $dsql->SetQuery("SELECT AM.*,A.title as aititle FROM `#@__ai_model` AM LEFT JOIN `#@__ai` A ON A.id = AM.aiid ORDER BY id"); | |||
| $dsql->Execute(); | |||
| while ($row = $dsql->GetObject()) { | |||
| ?> | |||
| <option value="<?php echo $row->id;?>"<?php echo $row->isdefault==1?' selected' : '';?>><?php echo $row->model;?>(<?php echo $row->aititle;?>)</option> | |||
| <?php | |||
| } | |||
| ?> | |||
| </select><br/> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| <div class="modal-footer"> | |||
| <button id="btnAIAction" class="btn btn-success">AI生成</button> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <script> | |||
| var channelArray = new Array(); | |||
| <?php | |||
| @@ -408,6 +440,118 @@ | |||
| } | |||
| }); | |||
| } | |||
| function showAI() { | |||
| $("#mdlAI").modal('show'); | |||
| } | |||
| let bodyHtml = ""; | |||
| $("#btnAIAction").click(function() { | |||
| let prompt = document.getElementById("prompt").value; | |||
| let modelid = document.getElementById("modelid").value; | |||
| let eventSource = new EventSource(`<?php echo $cfg_ai_server;?>/ai/catalog_edit?tid=<?php echo $id;?>&modelid=${modelid}&prompt=${prompt}`); | |||
| // 新增状态跟踪变量 | |||
| let currentKey = null; | |||
| let tagBuffer = ""; | |||
| let isClosingTag = false; | |||
| $("#mdlAI").modal('hide'); | |||
| $("#btnAI").attr("disabled", "disabled"); | |||
| prompt = ""; | |||
| let lastChar = ""; | |||
| eventSource.onmessage = (event) => { | |||
| const chars = event.data.split(''); | |||
| chars.forEach(char => { | |||
| if (lastChar === '\\' && char === 'r') { | |||
| char = '<br>'; // 替换为 <br> 标签 | |||
| lastChar = ""; // 清空追踪字符 | |||
| } else { | |||
| lastChar = char; // 记录当前字符 | |||
| } | |||
| if (char === '\\') { | |||
| return; // 如果是反斜杠,跳过处理 | |||
| } | |||
| if (currentKey) { | |||
| if (char === '{') { | |||
| isClosingTag = true; | |||
| tagBuffer = '{'; | |||
| return; | |||
| } | |||
| if (isClosingTag) { | |||
| tagBuffer += char; | |||
| if (tagBuffer === `{/${currentKey}}`) { | |||
| if (currentKey == "content") { | |||
| CKEDITOR.instances["content"].setReadOnly(false); | |||
| bodyHtml = ""; | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) $(input).prop("disabled", false).removeClass("disabled"); // 恢复输入状态 | |||
| } | |||
| currentKey = null; | |||
| isClosingTag = false; | |||
| tagBuffer = ""; | |||
| return; | |||
| } | |||
| if (!`{/${currentKey}}`.startsWith(tagBuffer)) { | |||
| if (currentKey == "content") { | |||
| bodyHtml += tagBuffer; | |||
| console.log(bodyHtml); | |||
| CKEDITOR.instances["content"].setData(bodyHtml) | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) input.value += tagBuffer; | |||
| } | |||
| isClosingTag = false; | |||
| tagBuffer = ""; | |||
| } | |||
| } else { | |||
| if (currentKey == "content") { | |||
| bodyHtml += char; | |||
| CKEDITOR.instances["content"].setData(bodyHtml) | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) { | |||
| input.value += char; | |||
| input.scrollTop = input.scrollHeight; // 滚动到底部 | |||
| } | |||
| } | |||
| } | |||
| } else { | |||
| if (char === '{') { | |||
| tagBuffer = '{'; | |||
| } else if (tagBuffer.startsWith('{')) { | |||
| tagBuffer += char; | |||
| if (char === '}') { | |||
| const match = tagBuffer.match(/{([^>]+)}/); | |||
| if (match) { | |||
| currentKey = match[1]; | |||
| if (currentKey == "content") { | |||
| CKEDITOR.instances["content"].setReadOnly(true); | |||
| } else { | |||
| const input = document.querySelector(`[name="${currentKey}"]`); | |||
| if (input) { | |||
| $(input).prop("disabled", true).addClass("disabled"); // 仅禁用当前输入框 | |||
| input.value = ""; | |||
| } | |||
| } | |||
| } | |||
| tagBuffer = ""; | |||
| } | |||
| } | |||
| } | |||
| }); | |||
| }; | |||
| eventSource.onerror = (error) => { | |||
| console.log("连接已关闭"); | |||
| $("#btnAI").prop("disabled", false); | |||
| eventSource.close(); | |||
| }; | |||
| }); | |||
| </script> | |||
| </body> | |||
| </html> | |||
| @@ -48,7 +48,7 @@ input { | |||
| padding:0.25rem 0.5rem; | |||
| height:30px; | |||
| color:var(--gray); | |||
| background:var(--white); | |||
| /* background:var(--white); */ | |||
| border:1px solid var(--gray-300); | |||
| vertical-align:middle | |||
| } | |||
| @@ -59,7 +59,7 @@ input[type=file] { | |||
| } | |||
| input:focus,select:focus,textarea:focus { | |||
| color:var(--gray); | |||
| background:var(--white); | |||
| /* background:var(--white); */ | |||
| border-color:var(--blue-300); | |||
| box-shadow:0 0 0 0.25rem rgba(0,123,255,0.25); | |||
| outline:0 | |||
| @@ -89,7 +89,7 @@ option:checked { | |||
| textarea { | |||
| padding:0.25rem 0.5rem; | |||
| color:var(--gray); | |||
| background:var(--white); | |||
| /* background:var(--white); */ | |||
| border:1px solid var(--gray-300); | |||
| vertical-align:middle | |||
| } | |||
| @@ -1,6 +1,6 @@ | |||
| <?php | |||
| /** | |||
| * @version $id:common.inc.php 2024-04-15 tianya $ | |||
| * @version $id:common.inc.php 2025 tianya $ | |||
| * @package DedeBIZ.Libraries | |||
| * @copyright Copyright (c) 2022 DedeBIZ.COM | |||
| * @license GNU GPL v2 (https://www.dedebiz.com/license) | |||
| @@ -195,7 +195,7 @@ $cfg_medias_dir = $cfg_cmspath.$cfg_medias_dir; | |||
| $cfg_mediasurl = $cfg_mainsite.$cfg_medias_dir; | |||
| //程序信息摘要,请不要删除则系统无法接收升级信息 | |||
| $cfg_version = 'V6'; | |||
| $cfg_version_detail = '6.3.2';//详细版本号 | |||
| $cfg_version_detail = '6.5.0';//详细版本号 | |||
| $cfg_soft_lang = 'utf-8'; | |||
| $cfg_soft_public = 'base'; | |||
| $cfg_softname = '得德系统'; | |||