|
|
@@ -154,6 +154,9 @@ class TemplateRender
|
|
|
case 'dict-pref':
|
|
|
$result = $this->render_dict_pref();
|
|
|
break;
|
|
|
+ case 'ai':
|
|
|
+ $result = $this->render_ai();
|
|
|
+ break;
|
|
|
default:
|
|
|
# code...
|
|
|
$result = [
|
|
|
@@ -1359,6 +1362,43 @@ class TemplateRender
|
|
|
}
|
|
|
return $output;
|
|
|
}
|
|
|
+
|
|
|
+ private function render_ai()
|
|
|
+ {
|
|
|
+ $model = $this->get_param($this->param, "model", 1, 1);
|
|
|
+
|
|
|
+ $props = [
|
|
|
+ "model" => $model,
|
|
|
+ ];
|
|
|
+
|
|
|
+ switch ($this->format) {
|
|
|
+ case 'react':
|
|
|
+ $output = [
|
|
|
+ 'props' => base64_encode(\json_encode($props)),
|
|
|
+ 'html' => "",
|
|
|
+ 'text' => '',
|
|
|
+ 'tag' => 'div',
|
|
|
+ 'tpl' => 'ai',
|
|
|
+ ];
|
|
|
+ break;
|
|
|
+ case 'unity':
|
|
|
+ $output = [
|
|
|
+ 'props' => base64_encode(\json_encode($props)),
|
|
|
+ 'tpl' => 'ai',
|
|
|
+ ];
|
|
|
+ break;
|
|
|
+ case 'text':
|
|
|
+ $output = 'ai';
|
|
|
+ break;
|
|
|
+ case 'prompt':
|
|
|
+ $output = '';
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $output = 'ai';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return $output;
|
|
|
+ }
|
|
|
private function get_param(array $param, string $name, int $id, string $default = '')
|
|
|
{
|
|
|
if (isset($param[$name])) {
|