* add prompt audit toolbar for task create.

This commit is contained in:
Chenjianyu
2023-07-26 13:42:32 +08:00
parent eeede04fa3
commit 8aed20cd5b
+18 -2
View File
@@ -40,6 +40,18 @@ foreach(explode(',', $config->task->create->requiredFields) as $field)
<div class='main-header'>
<h2><?php echo $lang->task->create;?></h2>
<div class='btn-toolbar pull-right'>
<?php if(isset($_SESSION['aiInjectData'])): ?>
<?php
$this->app->loadLang('ai');
$prompt = $_SESSION['aiPrompt']['prompt'];
$objectId = $_SESSION['aiPrompt']['objectId'];
$isAudit = isset($_SESSION['auditPrompt']) && time() - $_SESSION['auditPrompt']['time'] < 10 * 60;
?>
<?php echo html::a(helper::createLink('ai', 'promptexecute', "promptId=$prompt->id&objectId=$objectId"), '<i class="icon icon-refresh muted"></i> ' . $lang->ai->audit->regenerate, '', 'id="promptRegenerate" class="btn btn-link"'); ?>
<?php if($isAudit): ?>
<?php echo html::a(helper::createLink('ai', 'promptaudit', "promptId=$prompt->id&objectId=$objectId"), $lang->ai->audit->designPrompt, '', 'id="promptAudit" class="btn btn-info iframe"'); ?>
<?php endif; ?>
<?php endif; ?>
<?php $customLink = $this->createLink('custom', 'ajaxSaveCustomFields', 'module=task&section=custom&key=createFields')?>
<?php include '../../common/view/customfield.html.php';?>
</div>
@@ -291,8 +303,12 @@ foreach(explode(',', $config->task->create->requiredFields) as $field)
<?php endif;?>
<tr>
<td colspan='4' class='text-center form-actions'>
<?php echo html::submitButton();?>
<?php echo $gobackLink ? html::a($gobackLink, $lang->goback, '', 'class="btn btn-wide"') : html::backButton();?>
<?php if($isAudit && $prompt->status == 'draft'): ?>
<?php echo html::commonButton($lang->ai->prompts->action->publish, "id='promptPublish' data-promptId=$prompt->id", 'btn btn-primary btn-wide'); ?>
<?php else: ?>
<?php echo html::submitButton(); ?>
<?php echo $gobackLink ? html::a($gobackLink, $lang->goback, '', 'class="btn btn-wide"') : html::backButton(); ?>
<?php endif; ?>
</td>
</tr>
</table>