29 lines
529 B
PHP
29 lines
529 B
PHP
<?php
|
|
|
|
assert($this instanceof \Piko\View);
|
|
|
|
$this->title = 'Assistant chat';
|
|
|
|
$modelsJs = json_encode($models);
|
|
$responseUrl = $this->getUrl('site/assistant/response');
|
|
|
|
$script = <<<JS
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
new ChatApp({
|
|
target: document.getElementById('chat-app'),
|
|
props : {
|
|
proxyBaseUrl: '$responseUrl',
|
|
model_list: $modelsJs
|
|
}
|
|
});
|
|
})
|
|
JS;
|
|
|
|
$this->registerJs($script);
|
|
|
|
?>
|
|
|
|
<div id="chat-app"></div>
|
|
|
|
|