|
@@ -29,14 +29,9 @@ $tagsmenu = Yii::$app->cache->getOrSet("tagsmenu",function () use($tmodel){
|
|
return $tmodel->find()->rightJoin(['m'=>Tagsfilter::find()], 'm.id = tags.id')->orderBy('sort')->All();
|
|
return $tmodel->find()->rightJoin(['m'=>Tagsfilter::find()], 'm.id = tags.id')->orderBy('sort')->All();
|
|
});
|
|
});
|
|
|
|
|
|
-$key = 'AI_time_mid';
|
|
|
|
|
|
+$key = 'AI_time_midnv#aiprogress0';
|
|
$AI_time_mid = $cache->get($key);
|
|
$AI_time_mid = $cache->get($key);
|
|
-if( $AI_time_mid == false ){
|
|
|
|
- $AI_time_mid = 100;
|
|
|
|
-}else{
|
|
|
|
- $AI_time_mid = $AI_time_mid/1000000000;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
+if( !$AI_time_mid ) $AI_time_mid = 50;
|
|
?>
|
|
?>
|
|
|
|
|
|
<ul class="nav nav-tabs">
|
|
<ul class="nav nav-tabs">
|
|
@@ -259,7 +254,7 @@ echo $form->field($news, 'title')->textInput([
|
|
<div class="row">
|
|
<div class="row">
|
|
<input type="text" maxlength="<?=$tcount?>" id="news-title" class="form-control js-word-count-input col-sm-10 ml-2" name="News[title]" placeholder="Заголовок новости" aria-required="true" value='<?=str_replace("'", ''', $news->title)?>'>
|
|
<input type="text" maxlength="<?=$tcount?>" id="news-title" class="form-control js-word-count-input col-sm-10 ml-2" name="News[title]" placeholder="Заголовок новости" aria-required="true" value='<?=str_replace("'", ''', $news->title)?>'>
|
|
<span class="input-group-append">
|
|
<span class="input-group-append">
|
|
- <span type="button" class="btn btn-outline-primary btn-block btn-sm aiget" style="width: fit-content;" id="aititle" data-pb="aiprogress0" data-preprompt="Подскажи привлекательный заголовок для статьи"><i class="fa fa-robot"></i> Гена</span>
|
|
|
|
|
|
+ <span type="button" class="btn btn-outline-primary btn-block btn-sm aiget" style="width: fit-content;" id="aititle" data-pb="aiprogress0" data-preprompt="Подскажи привлекательный заголовок для статьи" title="Сгенерировать нейросетью, время гениратции примерно <?=round($AI_time_mid)?>сек."><i class="fa fa-robot"></i> Гена</span>
|
|
</span>
|
|
</span>
|
|
<div class="help-block px-lg-2"><div class="news__input-word-count"><span class="badge badge-info" id="title_count"></span></div></div>
|
|
<div class="help-block px-lg-2"><div class="news__input-word-count"><span class="badge badge-info" id="title_count"></span></div></div>
|
|
<a class="btn btn-primary px-lg-2" data-toggle="collapse" href="#collapseSEOTitle" role="button" aria-expanded="false" aria-controls="collapseSEOTitle">SEO title</a>
|
|
<a class="btn btn-primary px-lg-2" data-toggle="collapse" href="#collapseSEOTitle" role="button" aria-expanded="false" aria-controls="collapseSEOTitle">SEO title</a>
|
|
@@ -274,7 +269,7 @@ echo $form->field($news, 'title')->textInput([
|
|
<div class="card card-body py-1">
|
|
<div class="card card-body py-1">
|
|
<span class="input-group-append">
|
|
<span class="input-group-append">
|
|
<input type="text" name="News[meta_title]" maxlength="<?=$tcount?>" value="<?=htmlentities($news->meta_title)?>" placeholder="SEO Title" class="form-control js-word-count-input col-sm-10 ml-1 py-0">
|
|
<input type="text" name="News[meta_title]" maxlength="<?=$tcount?>" value="<?=htmlentities($news->meta_title)?>" placeholder="SEO Title" class="form-control js-word-count-input col-sm-10 ml-1 py-0">
|
|
- <span type="button" class="btn btn-outline-primary btn-block btn-sm aiget" style="width: fit-content;" id="aistitle" data-pb="saiprogressx" data-preprompt="Подскажи SEO заголовок для статьи"><i class="fa fa-robot"></i> Гена</span>
|
|
|
|
|
|
+ <span type="button" class="btn btn-outline-primary btn-block btn-sm aiget" style="width: fit-content;" id="aistitle" data-pb="saiprogressx" data-preprompt="Подскажи SEO заголовок для статьи" title="Сгенерировать нейросетью, время гениратции примерно <?=round($AI_time_mid)?>сек."><i class="fa fa-robot"></i> Гена</span>
|
|
</span>
|
|
</span>
|
|
<div class="help-block">Поле для альтернативного SEO Title заголовка, если не заполнять совпадёт с основным заголовком</div>
|
|
<div class="help-block">Поле для альтернативного SEO Title заголовка, если не заполнять совпадёт с основным заголовком</div>
|
|
<div class="progress progress-sm active hidden" id="saiprogress">
|
|
<div class="progress progress-sm active hidden" id="saiprogress">
|
|
@@ -324,7 +319,10 @@ echo $form->field($news, 'title')->textInput([
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group field-js_news_content required">
|
|
<div class="form-group field-js_news_content required">
|
|
- <label class="control-label" for="js_news_content">Контент</label>
|
|
|
|
|
|
+ <label class="control-label" for="js_news_content">Контент <span type="button" class="btn btn-outline-primary btn-block btn-sm aiget ml-4" style="width: fit-content;float: right;" id="acont" data-pb="aiprogressb" data-preprompt="Улучши статью, добавь факты, мнения экспертов, цитаты и источники, написать литературным языком" title="Сгенерировать нейросетью, время гениратции примерно <?=round($AI_time_mid)?>сек."><i class="fa fa-robot"></i> Гена</span></label>
|
|
|
|
+ <div class="progress progress-sm active hidden">
|
|
|
|
+ <div class="progress-bar bg-success progress-bar-striped" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%" id="aiprogressb"><span class="sr-only">40</span></div>
|
|
|
|
+ </div>
|
|
<textarea id="js_news_content" class="form-control" name="News[text]" rows="12" aria-required="true"><?=htmlentities($news->text)?></textarea>
|
|
<textarea id="js_news_content" class="form-control" name="News[text]" rows="12" aria-required="true"><?=htmlentities($news->text)?></textarea>
|
|
</div>
|
|
</div>
|
|
<blockquote class="quote-info mt-0">
|
|
<blockquote class="quote-info mt-0">
|
|
@@ -869,6 +867,7 @@ if (jQuery('#dt_pub').data('datetimepicker')) { jQuery('#dt_pub').datetimepicker
|
|
$(function() {
|
|
$(function() {
|
|
window.varsubmit = false;
|
|
window.varsubmit = false;
|
|
window.robotr = false;
|
|
window.robotr = false;
|
|
|
|
+ AItime=<?=$AI_time_mid?>;
|
|
$("input[id='news-title']").keyup(function count(){
|
|
$("input[id='news-title']").keyup(function count(){
|
|
number = $("input[id='news-title']").val().length;
|
|
number = $("input[id='news-title']").val().length;
|
|
$("#title_count").html(number);
|
|
$("#title_count").html(number);
|
|
@@ -950,8 +949,17 @@ $(function() {
|
|
$(pbar).attr('aria-valuenow', 100);
|
|
$(pbar).attr('aria-valuenow', 100);
|
|
$(pbar).css('width','100%');
|
|
$(pbar).css('width','100%');
|
|
let data = { timer : null };
|
|
let data = { timer : null };
|
|
|
|
+
|
|
|
|
+ $.post("/manager/ai/ajax-time", {AI:'nv', progress: pbar}, function( data ) {
|
|
|
|
+ if( data.status == 'ok' ){
|
|
|
|
+ AItime = data.time;
|
|
|
|
+ if( !AItime ) AItime = <?=$AI_time_mid?>;
|
|
|
|
+ console.log(AItime);
|
|
|
|
+ }
|
|
|
|
+ }, "json");
|
|
|
|
+
|
|
data.timer = setInterval(countprogress, 1000, pbar, data);
|
|
data.timer = setInterval(countprogress, 1000, pbar, data);
|
|
- $.post("/manager/ai/ajax-get-title", {AI:'ollama',text:text, progress: pbar}, function( data ) {
|
|
|
|
|
|
+ $.post("/manager/ai/ajax-get-title", {AI:'nv',text:text, progress: pbar}, function( data ) {
|
|
if( data.status == 'ok' ){
|
|
if( data.status == 'ok' ){
|
|
var data_all = data.data;
|
|
var data_all = data.data;
|
|
$("#AItext").html(data_all);
|
|
$("#AItext").html(data_all);
|
|
@@ -969,8 +977,8 @@ $(function() {
|
|
});
|
|
});
|
|
function countprogress(pbar, data){
|
|
function countprogress(pbar, data){
|
|
val = $(pbar).attr('aria-valuenow');
|
|
val = $(pbar).attr('aria-valuenow');
|
|
- d = 100/<?=$AI_time_mid?>;
|
|
|
|
- console.log(100/d);
|
|
|
|
|
|
+ d = 100/(AItime);
|
|
|
|
+ console.log(d);
|
|
val = val - d;
|
|
val = val - d;
|
|
if( val <=0 ) clearTimeout(data.timer);
|
|
if( val <=0 ) clearTimeout(data.timer);
|
|
$(pbar).attr('aria-valuenow', val);
|
|
$(pbar).attr('aria-valuenow', val);
|
|
@@ -1038,7 +1046,7 @@ window.onbeforeunload = function(e) {
|
|
|
|
|
|
?>
|
|
?>
|
|
<div class="modal" tabindex="-1" data-show="true" id="AI">
|
|
<div class="modal" tabindex="-1" data-show="true" id="AI">
|
|
- <div class="modal-dialog">
|
|
|
|
|
|
+ <div class="modal-dialog modal-dialog-scrollable modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Генератор текстов от Гены</h5>
|
|
<h5 class="modal-title">Генератор текстов от Гены</h5>
|