* add prompt audit toolbar for testcase edit.

This commit is contained in:
Chenjianyu
2023-07-26 13:26:20 +08:00
parent 5c86e63077
commit c3296487ae
+18
View File
@@ -31,6 +31,20 @@
<span class='label label-id'><?php echo $case->id;?></span>
<?php echo html::a($this->createLink('testcase', 'view', "caseID=$case->id"), $case->title, '', 'class="case-title"');?>
</h2>
<?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;
?>
<div class="pull-right btn-toolbar">
<?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;?>
</div>
<?php endif;?>
</div>
<form method='post' enctype='multipart/form-data' target='hiddenwin' id='dataform'>
<div class='main-row'>
@@ -144,8 +158,12 @@
</div>
</div>
<div class='text-center detail form-actions'>
<?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::hidden('lastEditedDate', $case->lastEditedDate);?>
<?php echo html::submitButton(). html::backButton();;?>
<?php endif;?>
</div>
<?php include '../../common/view/action.html.php';?>
</div>