* add create role template and dynamic refresh the role template list.

This commit is contained in:
Chenjianyu
2023-08-01 16:45:12 +08:00
parent bf0f7dde55
commit 22e5f8234f
6 changed files with 126 additions and 18 deletions
+26
View File
@@ -548,4 +548,30 @@ class ai extends control
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success'));
}
/**
* Return html element for the role template list.
* This is used in prompt designing step 2.
* Return html will deserialize in the front end js and replace the original role template list.
*
* @access public
* @return void
*/
public function roleTemplates()
{
if($_POST)
{
$data = fixer::input('post')->get();
$method = $data->method;
switch($method)
{
case 'create':
$this->ai->createRoleTemplate($data->role, $data->characterization);
break;
}
}
$this->view->roleTemplates = $this->ai->getRoleTemplates();
$this->display();
}
}