Plugin Directory

Changeset 2881141


Ignore:
Timestamp:
03/16/2023 11:09:47 AM (3 years ago)
Author:
df007df
Message:

Update

Location:
moredeal-ai-writer
Files:
176 added
8 edited

Legend:

Unmodified
Added
Removed
  • moredeal-ai-writer/trunk/application/client/SeastarRestfulClient.php

    r2880924 r2881141  
    8080        error_log( 'init moredeal ai writer account request: ' . $request );
    8181
    82 //        $result          = json_decode( $this->post( '/aigc/crateInitCode', $request ), true );
    83         $result          = json_decode( $this->post( '/aigc/crateInitCode?domain=' . Plugin::current_domain(), $request ), true );
     82        $result          = json_decode( $this->post( '/aigc/crateInitCode', $request ), true );
    8483        $default_message = ErrorConstant::GET_MOREDEAL_AIGC_ACCOUNT_FAIL_MESSAGE;
    8584
     
    193192        error_log( 'token info body: ' . $request );
    194193
    195 //        $result          = json_decode( $this->post( '/aigc/codetokeninfo', $request ), true );
    196         $result          = json_decode( $this->post( '/aigc/codetokeninfo?code=' . $aigc_key ), true );
     194        $result          = json_decode( $this->post( '/aigc/codetokeninfo', $request ), true );
    197195
    198196        $default_message = ErrorConstant::GET_TOKEN_INFO_FAIL_MESSAGE;
  • moredeal-ai-writer/trunk/application/controller/TemplateApiApiController.php

    r2877588 r2881141  
    303303        }
    304304
    305         return $this->_successMessage( 'insert success', 'The template create success' );
     305        return $this->_successMessage( $insert, 'The template create success' );
    306306    }
    307307
     
    334334        }
    335335
    336         return $this->_successMessage( 'copy success', 'The template copy success' );
     336        return $this->_successMessage( $copy, 'The template copy success' );
    337337    }
    338338
     
    365365        }
    366366
    367         return $this->_successMessage( 'modify success', 'The template modify success' );
     367        return $this->_successMessage( $modify, 'The template modify success' );
    368368    }
    369369
     
    395395        }
    396396
    397         return $this->_successMessage( 'delete success', 'The template delete success' );
     397        return $this->_successMessage( $delete, 'The template delete success' );
    398398
    399399    }
  • moredeal-ai-writer/trunk/application/models/TemplateModel.php

    r2879654 r2881141  
    1717class TemplateModel extends Model {
    1818
    19     /**
    20     * 主键 ID
    21     * @var int
    22     */
    23     public $id;
    24 
    25     /**
    26     * 模版名称
    27     * @var string
    28     */
    29     public $name;
    30 
    31     /**
    32     * 模版类型
    33     * @var string
    34     */
    35     public $type;
    36 
    37     /**
    38     * 模版状态
    39     * @var int
    40     */
    41     public $status;
    42 
    43     /**
    44     * 模版描述
    45     * @var string
    46     */
    47     public $desc;
    48 
    49     /**
    50     * 模版标签
    51     * @var
    52     */
    53     public $tags;
    54 
    55     /**
    56     * 场景
    57     * @var
    58     */
    59     public $scenes;
    60 
    61     /**
    62     * 模版详细配置信息
    63     * @var string
    64     */
    65     public $info;
    66 
    67     /**
    68     * 模版创建时间
    69     * @var
    70     */
    71     public $gmt_create;
    72 
    73     /**
    74     * 模版更新时间
    75     * @var
    76     */
    77     public $gmt_modified;
    78 
    79     /**
    80     * 是否删除
    81     * @var int
    82     */
    83     public $is_delete;
    84 
    85 
    86     /**
    87     * 实例
    88     * @var TemplateModel|null
    89     */
    90     private static $instance = null;
    91 
    92     public $_variableToTips;
    93 
    94     /**
    95     * 实例
    96     *
    97     * @return TemplateModel
    98     */
    99     public static function getInstance(): TemplateModel {
     19    /**
     20    * 主键 ID
     21    * @var int
     22    */
     23    public $id;
     24
     25    /**
     26    * 模版名称
     27    * @var string
     28    */
     29    public $name;
     30
     31    /**
     32    * 模版类型
     33    * @var string
     34    */
     35    public $type;
     36
     37    /**
     38    * 模版状态
     39    * @var int
     40    */
     41    public $status;
     42
     43    /**
     44    * 模版描述
     45    * @var string
     46    */
     47    public $desc;
     48
     49    /**
     50    * 模版标签
     51    * @var
     52    */
     53    public $tags;
     54
     55    /**
     56    * 场景
     57    * @var
     58    */
     59    public $scenes;
     60
     61    /**
     62    * 模版详细配置信息
     63    * @var string
     64    */
     65    public $info;
     66
     67    /**
     68    * 模版创建时间
     69    * @var
     70    */
     71    public $gmt_create;
     72
     73    /**
     74    * 模版更新时间
     75    * @var
     76    */
     77    public $gmt_modified;
     78
     79    /**
     80    * 是否删除
     81    * @var int
     82    */
     83    public $is_delete;
     84
     85
     86    /**
     87    * 实例
     88    * @var TemplateModel|null
     89    */
     90    private static $instance = null;
     91
     92    public $_variableToTips;
     93
     94    /**
     95    * 实例
     96    *
     97    * @return TemplateModel
     98    */
     99    public static function getInstance(): TemplateModel {
    100100//      if ( self::$instance == null ) {
    101101//          self::$instance = new self;
    102102//      }
    103         self::$instance = new static();
    104 
    105         return self::$instance;
    106     }
    107 
    108     /**
    109     * 表成名
    110     * @return string
    111     */
    112     public function table_name(): string {
    113         return $this->table_prefix() . "template";
    114     }
    115 
    116     /**
    117     * 建表 SQL
    118     * @return string
    119     */
    120     public function dump_sql(): string {
    121         return "CREATE TABLE " . $this->table_name() . " (
     103        self::$instance = new static();
     104
     105        return self::$instance;
     106    }
     107
     108    /**
     109    * 表成名
     110    * @return string
     111    */
     112    public function table_name(): string {
     113        return $this->table_prefix() . "template";
     114    }
     115
     116    /**
     117    * 建表 SQL
     118    * @return string
     119    */
     120    public function dump_sql(): string {
     121        return "CREATE TABLE " . $this->table_name() . " (
    122122          `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '模版 ID',
    123123          `name` varchar(512) COLLATE utf8mb4_general_ci NOT NULL COMMENT '模版名称',
     
    132132          `is_delete` tinyint DEFAULT NULL COMMENT '是否删除: 0:正常,1:已删除',
    133133          PRIMARY KEY (`id`)
    134         ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
     134        ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;   
    135135        ";
    136136    }
     
    153153     */
    154154    public function page( array $params ): array {
    155         if ( ! isset( $params['limit'] ) ) {
    156             $params['limit'] = 10;
    157         }
    158         $limit = $params['limit'];
    159 
    160         if ( ! isset( $params['current'] ) ) {
    161             $params['current'] = 1;
    162         }
    163         $current = $params['current'];
    164         $offset  = ( $current - 1 ) * $limit;
    165 
    166         $pageSql  = 'SELECT `id`, `name`, `type`, `desc`, `status`, `tags`, `scenes`, `gmt_create`, `gmt_modified` FROM ' . $this->table_name();
    167         $whereSql = $this->preparePageWhereSql( $params );
    168         $pageSql  = $pageSql . $whereSql . " ORDER BY `gmt_modified` DESC LIMIT %d, %d";
    169         // 查询列表
    170         $list = $this->get_db()->get_results( $this->get_db()->prepare( $pageSql, $offset, $limit ) );
    171 
    172         // 查询数据为空时候,返回空数组
    173         if ( ! is_array( $list ) ) {
    174             $list = array();
    175         }
    176 
    177         if ( count( $list ) > 0 ) {
    178             foreach ( $list as $index => $item ) {
    179                 $template = self::convert( $item, false );
    180                 unset( $template->info );
    181                 unset( $template->is_delete );
    182                 $list[ $index ] = $template;
    183             }
    184             // 查询总数
    185             $total = $this->get_db()->get_var( 'SELECT COUNT(*) FROM ' . $this->table_name() . $whereSql );
    186         } else {
    187             $total = 0;
    188         }
    189 
    190         return array(
    191             'list'    => $list,
    192             'total'   => intval( $total ),
    193             'current' => $current,
    194             'limit'   => $limit
    195         );
    196     }
    197 
    198     /**
    199      * 根据 ID 获取模版详情
    200      *
    201      * @param int $tmpId 模版 ID
    202      *
    203      * @return TemplateModel|null
    204      * @throws Exception
    205      */
    206     public function templateDetail( int $tmpId ) {
    207 
    208         $sql    = "SELECT `id`, `name`, `type`, `desc`, `status`, `tags`, `scenes`, `info`, `gmt_create`, `gmt_modified` FROM " . $this->table_name() . " WHERE `id` = %d";
    209         $detail = $this->get_db()->get_row( $this->get_db()->prepare( $sql, $tmpId ) );
    210         // 详情为空事后直接返回 空数组, 避免后续报错
    211         if ( $detail == null ) {
    212             return null;
    213         }
    214 
    215         return self::convert( $detail );
    216     }
    217 
    218     /**
    219      * 新增模版
    220      *
    221      * @param $model TemplateModel 模版信息
    222      *
    223      * @return int|false 插入的行数,或出错时为 false
    224      */
    225     public function createTemplate( TemplateModel $model ) {
    226         if (isset($model->id) || property_exists($model, 'id')) {
    227             unset($model->id);
    228         }
    229         unset($model->_variableToTips);
    230 
    231         return $this->insert((array)$model);
    232     }
    233 
    234     /**
    235      * 复制模版
    236      *
    237      * @param TemplateModel $model 模版信息
    238      *
    239      * @return int|false 复制成的行数,或出错时为 false
    240      */
    241     public function copyTemplate( TemplateModel $model ) {
    242         if ( isset( $model->id ) || property_exists( $model, 'id' ) ) {
    243             unset( $model->id );
    244         }
    245         unset($model->_variableToTips);
    246 
    247         return $this->insert( (array) $model );
    248     }
    249 
    250     /**
    251      * 更新模版
    252      *
    253      * @param $model TemplateModel 模版信息
    254      *
    255      * @return int|false 更新的行数,或出错时为 false
    256      */
    257     public function modifyTemplate( TemplateModel $model ) {
    258         unset($model->_variableToTips);
    259 
    260         return $this->updateById((array)$model);
    261     }
    262 
    263     /**
    264      * 删除模版
    265      *
    266      * @param int $tmpId 模版 ID
    267      * @param bool $isTombstones 是否放入回收站, 是否为逻辑删除,默认为 true,false 时候彻底删除
    268      *
    269      * @return bool|int
    270      */
    271     public function deleteTemplate( int $tmpId, bool $isTombstones = true ) {
    272         if ( $isTombstones ) {
    273             $model            = new TemplateModel();
    274             $model->id        = $tmpId;
    275             $model->is_delete = 1;
     155        if ( ! isset( $params['limit'] ) ) {
     156            $params['limit'] = 10;
     157        }
     158        $limit = $params['limit'];
     159
     160        if ( ! isset( $params['current'] ) ) {
     161            $params['current'] = 1;
     162        }
     163        $current = $params['current'];
     164        $offset  = ( $current - 1 ) * $limit;
     165
     166        $pageSql  = 'SELECT `id`, `name`, `type`, `desc`, `status`, `tags`, `scenes`, `gmt_create`, `gmt_modified` FROM ' . $this->table_name();
     167        $whereSql = $this->preparePageWhereSql( $params );
     168        $pageSql  = $pageSql . $whereSql . " ORDER BY `gmt_modified` DESC LIMIT %d, %d";
     169        // 查询列表
     170        $list = $this->get_db()->get_results( $this->get_db()->prepare( $pageSql, $offset, $limit ) );
     171
     172        // 查询数据为空时候,返回空数组
     173        if ( ! is_array( $list ) ) {
     174            $list = array();
     175        }
     176
     177        if ( count( $list ) > 0 ) {
     178            foreach ( $list as $index => $item ) {
     179                $template = self::convert( $item, false );
     180                unset( $template->info );
     181                unset( $template->is_delete );
     182                $list[ $index ] = $template;
     183            }
     184            // 查询总数
     185            $total = $this->get_db()->get_var( 'SELECT COUNT(*) FROM ' . $this->table_name() . $whereSql );
     186        } else {
     187            $total = 0;
     188        }
     189
     190        return array(
     191            'list'    => $list,
     192            'total'   => intval( $total ),
     193            'current' => $current,
     194            'limit'   => $limit
     195        );
     196    }
     197
     198    /**
     199     * 根据 ID 获取模版详情
     200     *
     201     * @param int $tmpId 模版 ID
     202     *
     203     * @return TemplateModel|null
     204     * @throws Exception
     205     */
     206    public function templateDetail( int $tmpId ) {
     207
     208        $sql    = "SELECT `id`, `name`, `type`, `desc`, `status`, `tags`, `scenes`, `info`, `gmt_create`, `gmt_modified` FROM " . $this->table_name() . " WHERE `id` = %d";
     209        $detail = $this->get_db()->get_row( $this->get_db()->prepare( $sql, $tmpId ) );
     210        // 详情为空事后直接返回 空数组, 避免后续报错
     211        if ( $detail == null ) {
     212            return null;
     213        }
     214
     215        return self::convert( $detail );
     216    }
     217
     218    /**
     219     * 新增模版
     220     *
     221     * @param $model TemplateModel 模版信息
     222     *
     223     * @return int|false 插入成功返回自增主键 ID,或出错时为 false
     224     */
     225    public function createTemplate( TemplateModel $model ) {
     226
     227        if ( isset( $model->id ) || property_exists( $model, 'id' ) ) {
     228            unset( $model->id );
     229        }
     230
     231        if ( isset( $model->_variableToTips ) || property_exists( $model, '_variableToTips' ) ) {
    276232            unset( $model->_variableToTips );
    277             return $this->updateById( (array) $model );
    278 
    279         }
    280         return $this->deleteById( $tmpId );
    281     }
    282 
    283     /**
    284      * 获取 WHERE 查询条件
    285      *
    286      * @param array $params
    287      *
    288      * @return string
    289      */
    290     private function preparePageWhereSql( array $params ): string {
    291 
    292         $whereSql = ' WHERE `is_delete` = 0 ';
    293 
    294         // 模版状态查询
    295         if ( isset( $params['status'] ) ) {
    296             $whereSql .= " AND `status` = %d";
    297             $whereSql = $this->get_db()->prepare( $whereSql, $params['status'] );
    298         }
    299         // 模版名称模糊查询
    300         if ( isset( $params['name'] ) ) {
    301             $whereSql .= " AND `name` LIKE %s";
    302             $whereSql = $this->get_db()->prepare( $whereSql, '%' . $params['name'] . '%' );
    303         }
    304         // 模版标签查询
    305         if ( isset( $params['tags'] ) ) {
    306             $whereSql .= " AND `tags` LIKE %s";
    307             $whereSql = $this->get_db()->prepare( $whereSql, '%' . $params['tags'] . '%' );
    308         }
    309         // 模版场景查询
    310         if ( isset( $params['scenes'] ) ) {
    311             $whereSql .= " AND `scenes` LIKE %s";
    312             $whereSql = $this->get_db()->prepare( $whereSql, '%' . $params['scenes'] . '%' );
    313         }
    314 
    315         return $whereSql;
    316     }
    317 
    318     /**
    319      * 将数组或者对象转为该模型
    320      *
    321      * @param $data object
    322      * @param bool $is_parse_info 是否解析 info 字段为具体的魔板类型数据
    323      *
    324      * @return TemplateModel
    325      * @throws Exception
    326      */
    327     public static function convert( $data, bool $is_parse_info = true ): TemplateModel {
    328         $model = new self();
    329         $model = ModuleConvertUtil::convert( $model, $data );
    330         if ( is_string( $model->tags ) ) {
    331             $model->tags = explode( ',', $model->tags );
    332         }
    333         if ( is_string( $model->scenes ) ) {
    334             $model->scenes = explode( ',', $model->scenes );
    335         }
    336         $info = $model->info;
    337         if ( is_string( $info ) ) {
    338             $info = json_decode( $info );
    339         }
    340         if ( is_array( $info ) ) {
    341             $info = (object) $info;
    342         }
    343         if ( $is_parse_info ) {
    344             $info = TemplateManager::factoryByKey( $info );
    345         }
    346         $model->info = $info;
    347 
    348         return $model;
    349     }
    350 
    351     /**
    352      * @param $params string
    353      * @param $option_type int 选项类型, 1: 新增 2: 复制, 3: 修改
    354      *
    355      * @return TemplateModel
    356      * @throws Exception
    357      */
    358     public static function parseAndVerify( $params, int $option_type ): TemplateModel {
    359 
    360         if ( $option_type > 4 || $option_type < 1 ) {
    361             throw new Exception( "The option type is not support" );
    362         }
    363 
    364         $params = json_decode( $params );
    365 
    366         if ( $option_type == self::MODIFY ) {
    367             if ( ! isset( $params->id ) ) {
    368                 throw new Exception( 'The template id is required' );
    369             }
    370         }
    371 
    372         if ( ! isset( $params->type ) || ! in_array( $params->type, array_keys( TemplateConfigUtil::getTemplateType() ) ) ) {
    373             throw new Exception( 'The template type is required or not support this type' );
    374         }
    375 
    376         if ( ! isset( $params->info ) ) {
    377             throw new Exception( "The template info data is required" );
    378         }
    379 
    380 
    381         if ( $option_type < 4 ) {
    382             if ( ! isset( $params->name ) ) {
    383                 throw new Exception( 'The template name is required' );
    384             }
    385         }
    386 
    387         // 转换为 TemplateModel
    388         $model = self::convert( $params );
    389         if ( self::INSERT == $option_type || self::COPY == $option_type ) {
    390             if ( isset( $model->id ) || property_exists( $model, 'id' ) ) {
    391                 unset( $model->id );
    392             }
    393             // 状态
    394             $model->status = 0;
    395             // 创建时间
    396             $model->gmt_create = current_time( 'mysql' );
    397         }
    398         // 是否删除
    399         $model->is_delete = 0;
    400         // 修改时间
    401         $model->gmt_modified = current_time( 'mysql' );
    402 
    403         $info = $model->info;
    404 
    405         // 标签
    406         if ( isset( $info->tags ) && is_array( $info->tags ) ) {
    407             $model->tags = implode( ',', $info->tags );
    408         }
    409         // 重新组装 scenes
    410         $sceneList = array();
    411         if ( isset( $info->scenes ) && is_array( $info->scenes ) ) {
    412             foreach ( $info->scenes as $index => $scene ) {
    413                 $sceneList[ $index ] = $scene->key;
    414             }
    415         }
    416         // 场景
    417         $model->scenes = implode( ',', $sceneList );
    418         // info
    419         $model->info = json_encode( $model->info );
    420 
    421         return $model;
    422     }
     233        }
     234
     235        $insert = $this->insert( (array) $model );
     236        if ( ! $insert ) {
     237            return false;
     238        }
     239
     240        return $this->get_db()->insert_id;
     241    }
     242
     243    /**
     244     * 复制模版
     245     *
     246     * @param TemplateModel $model 模版信息
     247     *
     248     * @return int|false 复制成功返回自增主键 ID,或出错时为 false
     249     */
     250    public function copyTemplate( TemplateModel $model ) {
     251
     252        return $this->createTemplate( $model );
     253    }
     254
     255    /**
     256     * 更新模版
     257     *
     258     * @param $model TemplateModel 模版信息
     259     *
     260     * @return int|false 更新成功返回主键 ID,或出错时为 false
     261     */
     262    public function modifyTemplate( TemplateModel $model ) {
     263
     264        if ( empty( $model->id ) ) {
     265            return false;
     266        }
     267
     268        if ( isset( $model->_variableToTips ) || property_exists( $model, '_variableToTips' ) ) {
     269            unset( $model->_variableToTips );
     270        }
     271
     272        $update = $this->updateById( (array) $model );
     273        if ( ! $update ) {
     274            return false;
     275        }
     276
     277        return $model->id;
     278    }
     279
     280    /**
     281     * 删除模版
     282     *
     283     * @param int  $tmpId 模版 ID
     284     * @param bool $isTombstones 是否放入回收站, 是否为逻辑删除,默认为 true,false 时候彻底删除
     285     *
     286     * @return bool|int 删除成功返回主键 ID,或出错时为 false
     287     */
     288    public function deleteTemplate( int $tmpId, bool $isTombstones = true ) {
     289        if ( $isTombstones ) {
     290            $model            = new TemplateModel();
     291            $model->id        = $tmpId;
     292            $model->is_delete = 1;
     293
     294            if ( isset( $model->_variableToTips ) || property_exists( $model, '_variableToTips' ) ) {
     295                unset( $model->_variableToTips );
     296            }
     297
     298            $update = $this->updateById( (array) $model );
     299            if ( ! $update ) {
     300                return false;
     301            }
     302
     303            return $tmpId;
     304
     305        }
     306
     307        $delete = $this->deleteById( $tmpId );
     308        if ( ! $delete ) {
     309            return false;
     310        }
     311
     312        return $tmpId;
     313    }
     314
     315    /**
     316     * 获取 WHERE 查询条件
     317     *
     318     * @param array $params
     319     *
     320     * @return string
     321     */
     322    private function preparePageWhereSql( array $params ): string {
     323
     324        $whereSql = ' WHERE `is_delete` = 0 ';
     325
     326        // 模版状态查询
     327        if ( isset( $params['status'] ) ) {
     328            $whereSql .= " AND `status` = %d";
     329            $whereSql = $this->get_db()->prepare( $whereSql, $params['status'] );
     330        }
     331        // 模版名称模糊查询
     332        if ( isset( $params['name'] ) ) {
     333            $whereSql .= " AND `name` LIKE %s";
     334            $whereSql = $this->get_db()->prepare( $whereSql, '%' . $params['name'] . '%' );
     335        }
     336        // 模版标签查询
     337        if ( isset( $params['tags'] ) ) {
     338            $whereSql .= " AND `tags` LIKE %s";
     339            $whereSql = $this->get_db()->prepare( $whereSql, '%' . $params['tags'] . '%' );
     340        }
     341        // 模版场景查询
     342        if ( isset( $params['scenes'] ) ) {
     343            $whereSql .= " AND `scenes` LIKE %s";
     344            $whereSql = $this->get_db()->prepare( $whereSql, '%' . $params['scenes'] . '%' );
     345        }
     346
     347        return $whereSql;
     348    }
     349
     350    /**
     351     * 将数组或者对象转为该模型
     352     *
     353     * @param      $data object
     354     * @param bool $is_parse_info 是否解析 info 字段为具体的魔板类型数据
     355     *
     356     * @return TemplateModel
     357     * @throws Exception
     358     */
     359    public static function convert( $data, bool $is_parse_info = true ): TemplateModel {
     360        $model = new self();
     361        $model = ModuleConvertUtil::convert( $model, $data );
     362        if ( is_string( $model->tags ) ) {
     363            $model->tags = explode( ',', $model->tags );
     364        }
     365        if ( is_string( $model->scenes ) ) {
     366            $model->scenes = explode( ',', $model->scenes );
     367        }
     368        $info = $model->info;
     369        if ( is_string( $info ) ) {
     370            $info = json_decode( $info );
     371        }
     372        if ( is_array( $info ) ) {
     373            $info = (object) $info;
     374        }
     375        if ( $is_parse_info ) {
     376            $info = TemplateManager::factoryByKey( $info );
     377        }
     378        $model->info = $info;
     379
     380        return $model;
     381    }
     382
     383    /**
     384     * @param $params string
     385     * @param $option_type int 选项类型, 1: 新增 2: 复制, 3: 修改
     386     *
     387     * @return TemplateModel
     388     * @throws Exception
     389     */
     390    public static function parseAndVerify( $params, int $option_type ): TemplateModel {
     391
     392        if ( $option_type > 4 || $option_type < 1 ) {
     393            throw new Exception( "The option type is not support" );
     394        }
     395
     396        $params = json_decode( $params );
     397
     398        if ( $option_type == self::MODIFY ) {
     399            if ( ! isset( $params->id ) ) {
     400                throw new Exception( 'The template id is required' );
     401            }
     402        }
     403
     404        if ( ! isset( $params->type ) || ! in_array( $params->type, array_keys( TemplateConfigUtil::getTemplateType() ) ) ) {
     405            throw new Exception( 'The template type is required or not support this type' );
     406        }
     407
     408        if ( ! isset( $params->info ) ) {
     409            throw new Exception( "The template info data is required" );
     410        }
     411
     412
     413        if ( $option_type < 4 ) {
     414            if ( ! isset( $params->name ) ) {
     415                throw new Exception( 'The template name is required' );
     416            }
     417        }
     418
     419        // 转换为 TemplateModel
     420        $model = self::convert( $params );
     421        if ( self::INSERT == $option_type || self::COPY == $option_type ) {
     422            if ( isset( $model->id ) || property_exists( $model, 'id' ) ) {
     423                unset( $model->id );
     424            }
     425            // 状态
     426            $model->status = 0;
     427            // 创建时间
     428            $model->gmt_create = current_time( 'mysql' );
     429        }
     430        // 是否删除
     431        $model->is_delete = 0;
     432        // 修改时间
     433        $model->gmt_modified = current_time( 'mysql' );
     434
     435        $info = $model->info;
     436
     437        // 标签
     438        if ( isset( $info->tags ) && is_array( $info->tags ) ) {
     439            $model->tags = implode( ',', $info->tags );
     440        }
     441        // 重新组装 scenes
     442        $sceneList = array();
     443        if ( isset( $info->scenes ) && is_array( $info->scenes ) ) {
     444            foreach ( $info->scenes as $index => $scene ) {
     445                $sceneList[ $index ] = $scene->key;
     446            }
     447        }
     448        // 场景
     449        $model->scenes = implode( ',', $sceneList );
     450        // info
     451        $model->info = json_encode( $model->info );
     452
     453        return $model;
     454    }
    423455
    424456
  • moredeal-ai-writer/trunk/application/short/TemplateShortCode.php

    r2879654 r2881141  
    2424     * @var array
    2525     */
    26     const ALLOWED_ATTS = array(
     26    const ALLOWED_ATTRS = array(
    2727        'post_id'  => 0,
    2828        'title'    => '',
     
    3232    /**
    3333     * 文章标签内容处理
     34     *
    3435     * @var TemplateShortCode
    3536     */
     
    4647    /**
    4748     * 获取实例对象
     49     *
    4850     * @return TemplateShortCode
    4951     */
     
    7981     * @return array
    8082     */
    81     public static function allowed_atts(): array {
    82         return self::ALLOWED_ATTS;
     83    public static function allowed_attrs(): array {
     84        return self::ALLOWED_ATTRS;
    8385    }
    8486
     
    8688     * 渲染简码内容
    8789     *
    88      * @param         $atts
     90     * @param         $attrs
    8991     * @param string  $content
    9092     *
    9193     * @return string
    9294     */
    93     public function render_template_short_code( $atts, string $content = "" ): string {
     95    public function render_template_short_code( $attrs, string $content = "" ): string {
    9496
    9597        // 基本验证数据
    96         $verification = $this->verification( $atts );
     98        $verification = $this->verification( $attrs );
    9799        if ( ! $verification ) {
    98100            return $content;
     
    100102
    101103        // 查询数据库是否存在该模板
    102         $template_key = $atts['template'];
     104        $template_key = $attrs['template'];
    103105        $template     = TemplateModel::model()->get_template( $template_key );
    104106        if ( empty( $template ) ) {
     
    107109
    108110        // 简码属性预处理
    109         $attributes = $this->prepareAttributes( $atts );
     111        $attributes = $this->prepareAttributes( $attrs );
    110112
    111113        return $this->render_template( $template, $content, $attributes );
     
    115117     * 基本验证数据, 必填属性验证
    116118     *
    117      * @param  $atts
     119     * @param  $attrs
    118120     *
    119121     * @return bool
    120122     */
    121     public function verification( $atts ): bool {
     123    public function verification( $attrs ): bool {
    122124
    123         if ( empty( $atts ) || ! is_array( $atts ) ) {
     125        if ( empty( $attrs ) || ! is_array( $attrs ) ) {
    124126            return false;
    125127        }
    126128
    127         if ( empty( $atts['template'] ) ) {
     129        if ( empty( $attrs['template'] ) ) {
    128130            return false;
    129131        }
     
    135137     * 准备简码属性
    136138     *
    137      * @param  $atts
     139     * @param  $attrs
    138140     *
    139141     * @return array
    140142     */
    141     public function prepareAttributes( $atts ): array {
     143    public function prepareAttributes( $attrs ): array {
    142144
    143145        $post_id    = get_post() ? get_the_ID() : 0;
    144146        $shortcode  = self::short_code();
    145         $hook_name  = $shortcode . '_shortcode_atts';
    146         $default    = apply_filters( $hook_name, self::allowed_atts() );
    147         $attributes = shortcode_atts( $default, $atts, $shortcode );
     147        $hook_name  = $shortcode . '_shortcode_attrs';
     148        $default    = apply_filters( $hook_name, self::allowed_attrs() );
     149        $attributes = shortcode_atts( $default, $attrs, $shortcode );
    148150
    149151        if ( empty( $attributes['post_id'] || $attributes['post_id'] == 0 ) ) {
  • moredeal-ai-writer/trunk/moredeal-aigc.php

    r2880924 r2881141  
    99Description: Moredeal AI Writer - GPT Content Generator, Prompts store, Customize Prompts, Share Prompts
    1010Author: mdc.ai
    11 Version: 1.0.6
     11Version: 1.0.7
    1212Author URI: mdc.ai
    1313*/
     
    1717defined( '\ABSPATH' ) || die( 'No direct script access allowed!' );
    1818
    19 define( 'MoredealAigc\\VERSION', '1.0.6' );
     19define( 'MoredealAigc\\VERSION', '1.0.7' );
    2020define( 'MoredealAigc\\PLUGIN_FILE', __FILE__ );
    2121define( 'MoredealAigc\\PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
  • moredeal-ai-writer/trunk/readme.txt

    r2880924 r2881141  
    55Tested Up to: 6.1.1
    66Requires PHP: 7.0
    7 Stable Tag: 1.0.6
     7Stable Tag: 1.0.7
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • moredeal-ai-writer/trunk/res/admin/css/index.css

    r2880362 r2881141  
    1 .mainEdit[data-v-4d5199e3]{padding:20px}.mainEdit .editVariable[data-v-4d5199e3]{display:flex;justify-content:space-between;margin-bottom:20px}.mainEdit .editVariable .title[data-v-4d5199e3]{max-width:325px}.mainEdit .editVariable .subtitles[data-v-4d5199e3]{overflow-wrap:anywhere;line-height:14px;font-size:14px;font-weight:300;color:#7e879b}.mainEdit .el_value[data-v-4d5199e3]{display:flex;line-height:56px;margin-bottom:10px}.mainEdit .el_value .el-icon-delete[data-v-4d5199e3]{margin-top:20px;cursor:pointer;margin-left:5px}.pad20[data-v-76b37c3e]{padding:20px}.mar20[data-v-76b37c3e]{margin:20px}.marbottom20[data-v-76b37c3e]{margin-bottom:20px}.padbottom30[data-v-76b37c3e]{padding-top:30px}.topBtn[data-v-76b37c3e]{display:flex;justify-content:right}.el_edit[data-v-76b37c3e]{width:170px;margin:20px 10px 0 0!important}.el_edit .label[data-v-76b37c3e]{max-width:80px;vertical-align:middle;display:inline-block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:16px;font-weight:500;color:#fff}.el_edit .els[data-v-76b37c3e]{display:inline-block;font-size:14px;font-weight:300;color:#ccc;margin-left:5px}.pad10{padding:10px}.topBtn{display:flex;justify-content:right;margin-bottom:10px}.label{max-width:80px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:16px;font-weight:500;color:#fff}.els,.label{display:inline-block}.els{font-size:14px;font-weight:300;color:#ccc;margin-left:5px}[data-v-5e6becf4] .v-dialog--fullscreen{overflow-x:hidden;padding:32px 0 0 160px}.pad10[data-v-5e6becf4]{padding:10px}.mar10[data-v-5e6becf4]{margin:10px}.statistics[data-v-5e6becf4]{background:rgba(0,0,0,.2);padding:12px;display:flex;gap:25px;width:-moz-fit-content;width:fit-content;border-radius:8px;align-items:center;position:absolute;left:0;right:0;margin:auto}.statistics .tokens[data-v-5e6becf4]{display:flex;gap:5px;align-items:center}.statistics .tokens .labels[data-v-5e6becf4]{font-size:14px;font-weight:300;margin:0;color:#7e879b}.statistics .tokens .value[data-v-5e6becf4]{font-size:20px;font-weight:400;margin:0;color:#fff}.title[data-v-5e6becf4]{display:flex;justify-content:space-between;margin-bottom:10px}.title .stepTitle[data-v-5e6becf4]{font-size:16px;font-weight:500}.title .stepDesc[data-v-5e6becf4]{font-size:12px;line-height:12px;font-weight:300px;color:#7e879b}.el-row[data-v-38f821a3]{padding-bottom:20px}.el-col[data-v-38f821a3]{margin-top:20px}.moredeal[data-v-38f821a3]{gap:30px;display:grid;grid-template-columns:repeat(auto-fit,minmax(350px,1fr));padding:0 0 20px 0;overflow:hidden}.title[data-v-38f821a3]{font-size:30px;margin-bottom:20px;font-weight:500;color:#fff}.tagList[data-v-38f821a3]{width:495px;cursor:pointer;background:#2f3349;box-shadow:2px 3px 5px -1px rgba(0,0,0,.2),2px 5px 8px 0 rgba(0,0,0,.14),2px 1px 14px 0 rgba(0,0,0,.12)!important;padding:20px;border-radius:10px;display:flex;align-items:center}.tagList .tagImage[data-v-38f821a3]{font-size:40px;margin:0 10px}.tagList .tagDes[data-v-38f821a3]{width:430px}.tagList .tagDes .tagName[data-v-38f821a3]{font-size:20px;font-weight:500}.tagList .tagDes .tagContent[data-v-38f821a3]{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:14px;color:#7e879b}[data-v-38f821a3] .v-sheet.v-toolbar:not(.v-sheet--outlined){box-shadow:none}[data-v-38f821a3] .theme--dark.v-toolbar.v-sheet{background:none}.main[data-v-418c3a6c]{max-width:1200px;border:1px solid red;padding:20px 24px;margin:0 auto;margin-top:30px}.main .title[data-v-418c3a6c]{text-align:center;margin-bottom:48px}.main .title h1[data-v-418c3a6c]{font-weight:400}.main .title h3[data-v-418c3a6c]{margin-top:20px;font-weight:400}.main .templateGoods[data-v-418c3a6c]{display:flex;flex-wrap:wrap}.main .templateGoods .goods[data-v-418c3a6c]{border:1px solid #eaeaea;padding-top:0;border-radius:8px;min-height:475px;position:relative;overflow:hidden}[data-v-418c3a6c] .search .v-select.v-select--is-menu-active .v-input__icon--append .v-icon{transform:none}[data-v-4aeec4b8].theme--dark.v-application{background:#25293c;margin-left:-20px}[data-v-4aeec4b8] .theme--dark.v-tabs-items{background:#25293c!important}.main[data-v-4aeec4b8]{padding:25px}input[type=text][data-v-4aeec4b8]:focus{border:none!important;box-shadow:none!important}input[type=text]{border:none!important}input:disabled,input[readonly],input[type=text]{background:none!important}input[type=text]:focus{border:none!important}input[type=text]:focus,textarea:focus{box-shadow:none!important}.el-loading-mask{background-color:rgba(47,51,73,.8)}textarea:disabled{background:none}.el-message{z-index:9999!important}
     1.mainEdit[data-v-4d5199e3]{padding:20px}.mainEdit .editVariable[data-v-4d5199e3]{display:flex;justify-content:space-between;margin-bottom:20px}.mainEdit .editVariable .title[data-v-4d5199e3]{max-width:325px}.mainEdit .editVariable .subtitles[data-v-4d5199e3]{overflow-wrap:anywhere;line-height:14px;font-size:14px;font-weight:300;color:#7e879b}.mainEdit .el_value[data-v-4d5199e3]{display:flex;line-height:56px;margin-bottom:10px}.mainEdit .el_value .el-icon-delete[data-v-4d5199e3]{margin-top:20px;cursor:pointer;margin-left:5px}.pad20[data-v-76b37c3e]{padding:20px}.mar20[data-v-76b37c3e]{margin:20px}.marbottom20[data-v-76b37c3e]{margin-bottom:20px}.padbottom30[data-v-76b37c3e]{padding-top:30px}.topBtn[data-v-76b37c3e]{display:flex;justify-content:right}.el_edit[data-v-76b37c3e]{width:170px;margin:20px 10px 0 0!important}.el_edit .label[data-v-76b37c3e]{max-width:80px;vertical-align:middle;display:inline-block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:16px;font-weight:500;color:#fff}.el_edit .els[data-v-76b37c3e]{display:inline-block;font-size:14px;font-weight:300;color:#ccc;margin-left:5px}.pad10{padding:10px}.topBtn{display:flex;justify-content:right;margin-bottom:10px}.label{max-width:80px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:16px;font-weight:500;color:#fff}.els,.label{display:inline-block}.els{font-size:14px;font-weight:300;color:#ccc;margin-left:5px}[data-v-e425a684] .v-dialog--fullscreen{overflow-x:hidden;padding:32px 0 0 160px}.pad10[data-v-e425a684]{padding:10px}.mar10[data-v-e425a684]{margin:10px}.statistics[data-v-e425a684]{background:rgba(0,0,0,.2);padding:12px;display:flex;gap:25px;width:-moz-fit-content;width:fit-content;border-radius:8px;align-items:center;position:absolute;left:0;right:0;margin:auto}.statistics .tokens[data-v-e425a684]{display:flex;gap:5px;align-items:center}.statistics .tokens .labels[data-v-e425a684]{font-size:14px;font-weight:300;margin:0;color:#7e879b}.statistics .tokens .value[data-v-e425a684]{font-size:20px;font-weight:400;margin:0;color:#fff}.title[data-v-e425a684]{display:flex;justify-content:space-between;margin-bottom:10px}.title .stepTitle[data-v-e425a684]{font-size:16px;font-weight:500}.title .stepDesc[data-v-e425a684]{font-size:12px;line-height:12px;font-weight:300px;color:#7e879b}.el-row[data-v-38f821a3]{padding-bottom:20px}.el-col[data-v-38f821a3]{margin-top:20px}.moredeal[data-v-38f821a3]{gap:30px;display:grid;grid-template-columns:repeat(auto-fit,minmax(350px,1fr));padding:0 0 20px 0;overflow:hidden}.title[data-v-38f821a3]{font-size:30px;margin-bottom:20px;font-weight:500;color:#fff}.tagList[data-v-38f821a3]{width:495px;cursor:pointer;background:#2f3349;box-shadow:2px 3px 5px -1px rgba(0,0,0,.2),2px 5px 8px 0 rgba(0,0,0,.14),2px 1px 14px 0 rgba(0,0,0,.12)!important;padding:20px;border-radius:10px;display:flex;align-items:center}.tagList .tagImage[data-v-38f821a3]{font-size:40px;margin:0 10px}.tagList .tagDes[data-v-38f821a3]{width:430px}.tagList .tagDes .tagName[data-v-38f821a3]{font-size:20px;font-weight:500}.tagList .tagDes .tagContent[data-v-38f821a3]{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:14px;color:#7e879b}[data-v-38f821a3] .v-sheet.v-toolbar:not(.v-sheet--outlined){box-shadow:none}[data-v-38f821a3] .theme--dark.v-toolbar.v-sheet{background:none}.main[data-v-418c3a6c]{max-width:1200px;border:1px solid red;padding:20px 24px;margin:0 auto;margin-top:30px}.main .title[data-v-418c3a6c]{text-align:center;margin-bottom:48px}.main .title h1[data-v-418c3a6c]{font-weight:400}.main .title h3[data-v-418c3a6c]{margin-top:20px;font-weight:400}.main .templateGoods[data-v-418c3a6c]{display:flex;flex-wrap:wrap}.main .templateGoods .goods[data-v-418c3a6c]{border:1px solid #eaeaea;padding-top:0;border-radius:8px;min-height:475px;position:relative;overflow:hidden}[data-v-418c3a6c] .search .v-select.v-select--is-menu-active .v-input__icon--append .v-icon{transform:none}[data-v-4aeec4b8].theme--dark.v-application{background:#25293c;margin-left:-20px}[data-v-4aeec4b8] .theme--dark.v-tabs-items{background:#25293c!important}.main[data-v-4aeec4b8]{padding:25px}input[type=text][data-v-4aeec4b8]:focus{border:none!important;box-shadow:none!important}input[type=text]{border:none!important}input:disabled,input[readonly],input[type=text]{background:none!important}input[type=text]:focus{border:none!important}input[type=text]:focus,textarea:focus{box-shadow:none!important}.el-loading-mask{background-color:rgba(47,51,73,.8)}textarea:disabled{background:none}.el-message{z-index:9999!important}
  • moredeal-ai-writer/trunk/res/admin/js/index.js

    r2880362 r2881141  
    1 (function(e){function t(t){for(var s,o,n=t[0],r=t[1],c=t[2],p=0,u=[];p<n.length;p++)o=n[p],Object.prototype.hasOwnProperty.call(i,o)&&i[o]&&u.push(i[o][0]),i[o]=0;for(s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s]);d&&d(t);while(u.length)u.shift()();return l.push.apply(l,c||[]),a()}function a(){for(var e,t=0;t<l.length;t++){for(var a=l[t],s=!0,n=1;n<a.length;n++){var r=a[n];0!==i[r]&&(s=!1)}s&&(l.splice(t--,1),e=o(o.s=a[0]))}return e}var s={},i={index:0},l=[];function o(t){if(s[t])return s[t].exports;var a=s[t]={i:t,l:!1,exports:{}};return e[t].call(a.exports,a,a.exports,o),a.l=!0,a.exports}o.m=e,o.c=s,o.d=function(e,t,a){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(o.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)o.d(a,s,function(t){return e[t]}.bind(null,s));return a},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var n=window["webpackJsonp"]=window["webpackJsonp"]||[],r=n.push.bind(n);n.push=t,n=n.slice();for(var c=0;c<n.length;c++)t(n[c]);var d=r;l.push([0,"chunk-vendors"]),a()})({0:function(e,t,a){e.exports=a("56d7")},"1e09":function(e,t,a){},"1fb6":function(e,t,a){"use strict";var s=a("16b3"),i=function(){var e=this,t=e._self._c;return t(s["a"],{staticClass:"pad10"},[t("div",{staticClass:"topBtn"},[t("el-button",{attrs:{size:"mini",icon:"el-icon-plus",type:"primary"},on:{click:e.addVariable}},[e._v(e._s(e.$t("viewTemplate.addVariables")))]),t("el-button",{attrs:{size:"mini",icon:"el-icon-check",type:"info"},on:{click:e.handleSave}},[e._v(e._s(e.$t("templateModal.save")))])],1),e._l(e.variablesList,(function(e,a){return t("iShowInput",{key:e.key+a,attrs:{form:e,is_show:!1}})})),e._l(e.variablesList,(function(a,s){return t("el-button",{key:s,staticClass:"el_edit",staticStyle:{margin:"10px 0 0 10px"},attrs:{type:"info"},on:{click:function(t){return e.handleEdit(a,s)}}},[t("span",{staticClass:"label"},[e._v(e._s(a.label))]),t("span",{staticClass:"els"},[e._v(e._s(a.style))])])})),t("edit",{ref:"edits",on:{deleteForms:e.deleteForm}})],2)},l=[],o=(a("5edb"),a("ec0b")),n=a("6068"),r={data(){return{index:"",variablesList:[]}},components:{edit:o["a"],iShowInput:n["a"]},methods:{handleEdit(e,t){this.$refs.edits.opens=!0,this.index=t,this.$refs.edits.form=e},addVariable(){this.variablesList.push({key:this.$store.state.variablesKey.input,field:"Variable_"+this.variablesList.length,label:"Variable "+this.variablesList.length,desc:"",options:[],is_show:!0,style:"input"})},deleteForm(){console.log(this.index),console.log(this.variablesList),this.variablesList.splice(this.index,1)},handleSave(){this.$emit("handleSave",this.variablesList)}}},c=r,d=(a("dc8e"),a("e607")),p=Object(d["a"])(c,i,l,!1,null,null,null);t["a"]=p.exports},"22b1":function(e,t,a){"use strict";a("2fb4")},"240e":function(e,t,a){},"24c7":function(e,t,a){"use strict";a("5888")},"26d6":function(e,t,a){"use strict";a("8d39")},"2b97":function(e,t,a){"use strict";a("938f")},"2fb4":function(e,t,a){},"365c":function(e,t,a){"use strict";a.d(t,"g",(function(){return n})),a.d(t,"h",(function(){return r})),a.d(t,"d",(function(){return c})),a.d(t,"f",(function(){return d})),a.d(t,"c",(function(){return p})),a.d(t,"a",(function(){return u})),a.d(t,"i",(function(){return f})),a.d(t,"b",(function(){return m})),a.d(t,"e",(function(){return h})),a.d(t,"j",(function(){return v}));var s=a("e1e2"),i=a("47df");let l;l=MOREDEAL_AIGC.wpRestUrl;const o=s["a"].create({headers:{"Content-Type":"application/json"},baseURL:l,timeout:3e5,withCredentials:!0});function n(e){return o({url:"/aigc/v1/template/page",method:"get",params:e})}function r(e){return o({url:"/aigc/v1/template/tokenInfo",method:"get",params:e})}function c(e){return o({url:"/aigc/v1/template/config",method:"get",params:e})}function d(e){return o({url:"/aigc/v1/template/detail",method:"get",params:e})}function p(e){return o({url:"/aigc/v1/template/executeTemplate",method:"post",data:e})}function u(e){return o({url:"/aigc/v1/template/create",method:"post",data:e})}function f(e){return o({url:"/aigc/v1/template/modify",method:"post",data:e})}function m(e){return o({url:"/aigc/v1/template/delete",method:"post",data:e})}function h(e){return o({url:"/aigc/v1/config/get",method:"get",params:e})}function v(e){return o({url:"/aigc/v1/config/set",method:"post",data:e})}o.interceptors.request.use(e=>e,e=>Promise.reject(e)),o.interceptors.response.use(e=>e.data&&e.data.status||e.data&&!e.data.status?e.data:void 0,e=>(e.message.includes("timeout")?i["Message"].error({center:!0,message:"Request Timeout",offset:52}):i["Message"].error({center:!0,message:"System Error",offset:52}),Promise.reject(e)))},4203:function(e,t,a){"use strict";a("240e")},"56d7":function(e,t,a){"use strict";a.r(t);var s=a("1f37"),i=a("a517"),l=a("a04a"),o=a("16b3"),n=a("3785"),r=a("dc88"),c=a("6589"),d=a("b217"),p=a("e39c"),u=function(){var e=this,t=e._self._c;return t(i["a"],[t("div",{staticClass:"main"},[t(d["a"],{attrs:{"background-color":"#25293c"}},[t(r["a"],{staticStyle:{"text-transform":"none"}},[e._v(e._s(e.$t("tabs.myTemplate")))]),t(r["a"],{staticStyle:{"text-transform":"none"}},[e._v(e._s(e.$t("tabs.templateMarket")))]),t(c["a"],{attrs:{transition:!1}},[t(o["a"],{attrs:{color:"#25293c"}},[t("myself-template")],1)],1),t(c["a"],{attrs:{transition:!1}},[t(o["a"],{attrs:{color:"#25293c"}},[t(n["b"],[e._v('Thank you for your interest! We are actively working on developing a new feature for our plugin that will include a variety of process templates in a "Template Marketplace," enabling you to easily generate different types of content and articles. We\'re working hard on this feature and look forward to sharing it with you soon.')]),t(n["b"],{on:{click:e.openUrl}},[t("el-link",{attrs:{type:"primary"}},[e._v("Contact us to get the latest information.")])],1)],1)],1),t(c["a"],{attrs:{transition:!1}},[t(o["a"],{staticStyle:{"padding-top":"50px"},attrs:{color:"#25293c"}},[t(p["a"],{staticStyle:{width:"700px"},attrs:{"persistent-placeholder":"",clearable:"",label:"api_key",outlined:""},scopedSlots:e._u([{key:"append-outer",fn:function(){return[t(l["a"],{on:{click:e.handleSave}},[e._v(e._s(e.$t("setting.save")))])]},proxy:!0}]),model:{value:e.api_key,callback:function(t){e.api_key=t},expression:"api_key"}})],1)],1)],1)],1)])},f=[],m=a("3049"),h=a("c2f0"),v=a("6059"),_=a("7ff8"),b=a("15a6"),g=a("a872"),y=a("e3b7"),x=function(){var e=this,t=e._self._c;return t("div",[t("div",{staticStyle:{width:"1100px",margin:"0 auto"}},[t("div",{staticClass:"title"},[e._v(" "+e._s(e.$t("tabs.myTemplate"))+" "),t(l["a"],{staticStyle:{float:"right","text-transform":"none"},attrs:{color:"primary"},on:{click:e.handleAdd}},[e._v(e._s(e.$t("myselfTemplateList.createTemplate"))),t(_["a"],{attrs:{right:""}},[e._v("mdi-plus")])],1)],1),t(v["a"],[t(b["a"],[t(m["a"],{attrs:{cols:"6",md:"3"}},[t(p["a"],{attrs:{"persistent-placeholder":"",label:e.$t("myselfTemplateList.templateName"),clearable:"",outlined:""},on:{input:e.textChange},model:{value:e.queryParams.name,callback:function(t){e.$set(e.queryParams,"name",t)},expression:"queryParams.name"}})],1),t(m["a"],{attrs:{cols:"6",md:"3"}},[t(p["a"],{attrs:{"persistent-placeholder":"",label:e.$t("myselfTemplateList.templateScene"),clearable:"",outlined:""},on:{input:e.textChange},model:{value:e.queryParams.desc,callback:function(t){e.$set(e.queryParams,"desc",t)},expression:"queryParams.desc"}})],1)],1)],1),t("div",{staticClass:"moredeal"},e._l(e.templateList,(function(a,s){return t("div",{key:s,staticClass:"tagList",on:{click:function(t){return e.goDetail(a)}}},[t("div",{staticClass:"tagImage el-icon-document"}),t("div",{staticClass:"tagDes"},[t("div",{staticClass:"tagName"},[e._v(e._s(a.name))]),t("div",{staticClass:"tagContent"},[e._v(e._s(a.desc))])])])})),0)],1),t(h["a"],{staticStyle:{"z-index":"2000 !important"},attrs:{width:"1200"},model:{value:e.open,callback:function(t){e.open=t},expression:"open"}},[t(o["a"],{staticStyle:{padding:"0 20px"},attrs:{color:"#25293c"}},[t(y["a"],[t(n["c"],[e._v(e._s(e.$t("templateModal.title")))]),t(g["a"]),t(l["a"],{attrs:{fab:"",text:""},on:{click:function(t){e.open=!1}}},[t(_["a"],[e._v("mdi-close")])],1)],1),t("div",{staticClass:"moredeal"},e._l(e.createList,(function(a,s){return t("div",{key:s,staticClass:"tagList",staticStyle:{width:"360px"},on:{click:function(t){return e.createCode(s)}}},[t("div",{staticClass:"tagImage el-icon-document"}),t("div",{staticClass:"tagDes"},[t("div",{staticClass:"tagName"},[e._v(" "+e._s(a.name)+" ")]),t("div",{staticClass:"tagContent"},[e._v(e._s(a.description))])])])})),0)],1)],1),t("create-modal",{ref:"createModals"})],1)},k=[],$=a("1185"),S=a("34ae"),w=a("96b0"),M=a("804b"),C=a("2708"),L=a("8e80"),D=a("ac5c"),T=a("3b43"),O=a("3877"),E=a("df70"),P=a("92a2"),I=a("e4c8"),R=function(){var e=this,t=e._self._c;return t("div",[t(h["a"],{staticStyle:{"overflow-x":"hidden"},attrs:{"retain-focus":!1,persistent:"",fullscreen:"","hide-overlay":""},model:{value:e.open,callback:function(t){e.open=t},expression:"open"}},[t(o["a"],{staticClass:"pad10",staticStyle:{overflow:"hidden"},attrs:{color:"#25293c"}},[t(y["a"],{staticStyle:{"margin-top":"10px"},attrs:{color:"#25293c",elevation:"0",extended:"","extension-height":"10"}},[t(l["a"],{attrs:{text:""},on:{click:e.handleBack}},[t(_["a"],{attrs:{left:""}},[e._v("mdi-arrow-left")]),e._v("Back ")],1),t(P["a"],{staticStyle:{"margin-left":"10px"}},[e._v(e._s(e.totalData.name))]),t("div",{staticClass:"statistics"},[t("div",{staticClass:"tokens"},[t("p",{staticClass:"labels"},[e._v("Tokens")]),t("p",{staticClass:"value"},[e._v(e._s(e.tokenList.tokenUsable))])]),t("div",{staticClass:"tokens"},[t("p",{staticClass:"labels"},[e._v("Trial Days")]),t("p",{staticClass:"value"},[e._v(e._s(e.tokenList.timeLeft))])]),t(l["a"],{attrs:{color:"primary",text:"","x-small":""},on:{click:e.contact}},[e._v("UPGRADE")])],1),t(g["a"]),t(L["a"],{attrs:{"offset-y":""},scopedSlots:e._u([{key:"activator",fn:function({on:a,attrs:s}){return[t(l["a"],e._g(e._b({staticStyle:{margin:"0 5px"},attrs:{fab:"",small:"",text:""}},"v-btn",s,!1),a),[t(_["a"],[e._v("mdi-dots-vertical")])],1)]}}])},[t(S["a"],{attrs:{dense:""}},[e.totalData.id||0===e.totalData.id?t(w["a"],{attrs:{link:""},on:{click:function(t){e.dialog=!0}}},[t(_["a"],{attrs:{color:"error"}},[e._v("mdi-delete")]),t(C["b"],[e._v(e._s(e.$t("viewTemplate.delete")))])],1):e._e(),t(w["a"],{attrs:{link:""}},[t(_["a"],[e._v("mdi-content-copy")]),t(C["b"],[e._v(e._s(e.$t("viewTemplate.copy"))+" ")])],1)],1)],1),t(I["a"],{attrs:{bottom:""},scopedSlots:e._u([{key:"activator",fn:function({on:a}){return[t(l["a"],e._g({staticStyle:{"margin-right":"10px"},attrs:{text:""},on:{click:e.configuration}},a),[t(_["a"],[e._v("mdi-clipboard-flow")])],1)]}}])},[t("span",[e._v(e._s(e.$t("templateModal.configuration")))])]),t(l["a"],{attrs:{color:"blue darken-1",loading:e.saveLoading},on:{click:e.handleSave}},[e._v(" "+e._s(e.$t("templateModal.save")))])],1),t(b["a"],[t(m["a"],{staticStyle:{padding:"0 0 0 20px"},attrs:{cols:"4"}},[t(o["a"],{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"pad10 mar10",attrs:{color:"#2f3349",elevation:"5"}},[t(d["a"],{attrs:{"background-color":"#2f3349"},model:{value:e.foundcative,callback:function(t){e.foundcative=t},expression:"foundcative"}},[t(r["a"],{staticStyle:{"text-transform":"none"}},[e._v(e._s(e.$t("templateModal.foundation")))]),t(r["a"],{staticStyle:{"text-transform":"none"}},[e._v(e._s(e.$t("templateModal.model")))]),t(O["a"],{model:{value:e.foundcative,callback:function(t){e.foundcative=t},expression:"foundcative"}},[t(c["a"],{attrs:{transition:!1}},[t(o["a"],{staticStyle:{overflow:"hidden"},attrs:{color:"#2f3349"}},[t(v["a"],{ref:"leftForm",staticStyle:{"margin-top":"20px"}},[t(p["a"],{attrs:{"persistent-hint":"","validate-on-blur":"",clearable:"",rules:[t=>!!t||e.$t("templateModal.templateName")+e.$t("myselfTemplateList.isRequire")],"persistent-placeholder":"",label:e.$t("templateModal.templateName"),placeholder:e.$t("templateModal.pleaseName"),outlined:""},model:{value:e.totalData.name,callback:function(t){e.$set(e.totalData,"name",t)},expression:"totalData.name"}}),t(E["a"],{attrs:{"persistent-placeholder":"",clearable:"",label:e.$t("templateModal.templateDesc"),placeholder:e.$t("templateModal.pleaseDesc"),outlined:""},model:{value:e.totalData.desc,callback:function(t){e.$set(e.totalData,"desc",t)},expression:"totalData.desc"}}),t($["a"],{staticStyle:{"margin-bottom":"30px"}}),e._l(e.foundationList,(function(e,a){return t("iShowInput",{key:e.key+a,attrs:{form:e}})}))],2)],1)],1),t(c["a"],{attrs:{transition:!1}},[t(o["a"],{attrs:{color:"#2f3349"}},[t(S["a"],{attrs:{color:"#2f3349"}},[t(w["a"],[t(M["a"],{staticStyle:{width:"130px"}},[e._v(e._s(e.$t("advanced.version")))]),t(C["a"],[e.totalData.info?t(C["b"],[e._v(e._s(e.totalData.info.version))]):e._e()],1)],1),t(w["a"],[t(M["a"],{staticStyle:{width:"130px"}},[e._v(e._s(e.$t("advanced.key")))]),t(C["a"],[e.totalData.info?t(C["b"],[e._v(e._s(e.totalData.info.key))]):e._e()],1)],1),t(w["a"],[t(M["a"],{staticStyle:{width:"130px"}},[e._v(e._s(e.$t("advanced.scene")))]),t(C["a"],[e.totalData.info&&e.totalData.info.scenes&&0!=e.totalData.info.scenes.length?t(C["b"],[e._v(e._s(e.totalData.info.scenes.map(e=>e.app).toString()))]):e._e()],1)],1)],1)],1)],1),t(c["a"],{attrs:{transition:!1}},[t("variable",{ref:"variables",on:{handleSave:e.setVariable}})],1)],1)],1)],1)],1),t(m["a"],{staticStyle:{padding:"0 12px"},attrs:{cols:"8"}},[t(o["a"],{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticStyle:{padding:"20px 0",margin:"10px 10px 10px 0"},attrs:{color:"#2f3349",elevation:"5"}},[t(l["a"],{staticStyle:{"margin-left":"10px","text-transform":"none","margin-bottom":"10px"},attrs:{color:"primary"},on:{click:e.allExecute}},[t(_["a"],[e._v("mdi-motion-play")]),e._v(e._s(e.$t("templateModal.allExecute")))],1),e._l(e.stepList,(function(a,s){return t(o["a"],{directives:[{name:"loading",rawName:"v-loading",value:e.loadings[s],expression:"loadings[index]"}],key:s,staticClass:"pad10",staticStyle:{"text-transform":"none",padding:"0 10px"},attrs:{color:"#2f3349",elevation:"0"}},["button"!=a.stepModule.response.style?t("div",{staticClass:"title"},[t("div",[t("div",{staticClass:"stepTitle"},[e._v(e._s(a.label))]),t("div",{staticClass:"stepDesc"},[e._v(e._s(a.desc))])]),t("div",{staticStyle:{"white-space":"nowrap"}},[t("i",{class:"success"==e.results[s]?"el-icon-success":"error"==e.results[s]?"el-icon-error":"",style:{color:"success"==e.results[s]?"#67c23a":"#f56c6c",fontSize:"20px",verticalAlign:"middle",marginRight:"5px"}}),t("el-button",{attrs:{type:"primary",size:"mini",icon:"el-icon-video-play",disabled:0!=s&&"success"!=e.results[s-1]&&0!=s&&!e.stepList[s-1].stepModule.response.value},on:{click:function(t){return e.handleExecute(a.field,s)}}},[e._v(e._s(a.buttonLabel))])],1)]):e._e(),"button"!=a.stepModule.response.style?t(v["a"],{ref:"rightForm"+s,refInFor:!0},[t(b["a"],{attrs:{"no-gutters":""}},[e._l(a.stepModule.variables,(function(a,s){return[a.is_show?t(m["a"],{key:a.key+s,staticStyle:{padding:"0 12px 0 0"},attrs:{cols:"text"!=a.style?4:6}},[t("iShowInput",{attrs:{form:a,right_show:e.right_show}})],1):e._e()]})),e._l(a.variables,(function(a,s){return[a.is_show?t(m["a"],{key:a.key+s,staticStyle:{padding:"0 12px 0 0"},attrs:{cols:"text"!=a.style?4:6}},[t("iShowInput",{attrs:{form:a,right_show:e.right_show}})],1):e._e()]}))],2)],1):e._e(),t("div",[a.stepModule.response.isShow&&"input"==a.stepModule.response.style?t(p["a"],{attrs:{clearable:"",outlined:""},model:{value:a.stepModule.response.value,callback:function(t){e.$set(a.stepModule.response,"value",t)},expression:"item.stepModule.response.value"}}):e._e(),a.stepModule.response.isShow&&"text"==a.stepModule.response.style?t(E["a"],{attrs:{rows:10,outlined:""},model:{value:a.stepModule.response.value,callback:function(t){e.$set(a.stepModule.response,"value",t)},expression:"item.stepModule.response.value"}}):e._e(),a.stepModule.response.isShow&&"img"==a.stepModule.response.style?t("div",[null==a.stepModule.response.value||0==a.stepModule.response.value.length?t("div",{staticStyle:{height:"100px",border:"1px solid #ccc","margin-bottom":"20px"}}):e._e(),a.stepModule.response.value&&0!=a.stepModule.response.value.length?t("div",e._l(a.stepModule.response.value,(function(e,a){return t("el-image",{key:a,staticStyle:{width:"100px",height:"100px",margin:"5px 0 0 5px"},attrs:{"preview-src-list":[e.url],src:e.url,fit:"cover"}})})),1):e._e()]):e._e(),"button"==a.stepModule.response.style&&"text"==a.stepModule.response.type?t("el-button",{staticStyle:{width:"100%",height:"60px","font-size":"20px",display:"block",margin:"0 auto"},attrs:{type:"primary",disabled:0!=s&&"success"!=e.results[s-1]&&0!=s&&!e.stepList[s-1].stepModule.response.value},on:{click:function(t){return e.handleExecute(a.field,s)}}},[e._v(e._s(a.label))]):e._e(),"button"==a.stepModule.response.style&&"copy"==a.stepModule.response.type?t("el-button",{staticStyle:{width:"100%",height:"60px","font-size":"20px",display:"block",margin:"0 auto"},attrs:{type:"primary",disabled:0!=s&&"success"!=e.results[s-1]&&0!=s&&!e.stepList[s-1].stepModule.response.value},on:{click:e.handleCopy}},[e._v(e._s(a.label))]):e._e()],1)],1)}))],2)],1)],1)],1),t("step-configuration",{ref:"configurations",on:{handleSaves:e.setConfigurations}}),t(h["a"],{attrs:{width:"410"},model:{value:e.dialog,callback:function(t){e.dialog=t},expression:"dialog"}},[t(o["a"],{staticStyle:{"padding-top":"20px"},attrs:{color:"#25293c"}},[t(n["c"],{staticClass:"text-h6"},[e._v(" "+e._s(e.$t("templateModal.reconfirm"))+" ")]),t(n["a"],[t(g["a"]),t(l["a"],{staticStyle:{"text-transform":"none"},attrs:{text:""},on:{click:function(t){e.dialog=!1}}},[e._v(e._s(e.$t("templateModal.cancel")))]),t(l["a"],{staticStyle:{"text-transform":"none"},attrs:{color:"primary",text:""},on:{click:e.handleDel}},[e._v(e._s(e.$t("templateModal.save1")))])],1)],1)],1)],1),t(D["a"],{attrs:{"z-index":9999,value:e.configLoading}},[t(T["a"],{attrs:{indeterminate:"",size:"64"}})],1)],1)},j=[],V=a("f159"),A=V["a"],N=(a("26d6"),a("e607")),q=Object(N["a"])(A,R,j,!1,null,"5e6becf4",null),U=q.exports,F=a("365c"),K=a("7736"),B={data(){return{queryParams:{current:1,limit:1e4},open:!1,templateList:[],createList:{}}},components:{createModal:U},created(){this.getTemplateList(),this.getConfigList()},methods:{...Object(K["b"])(["getVariablesKey"]),getTemplateList(){Object(F["g"])(this.queryParams).then(e=>{this.templateList=e.data.list})},getConfigList(){Object(F["d"])().then(e=>{this.createList=e.data.templateType,this.getVariablesKey(e.data.variablesKey)})},textChange(e){clearInterval(this.timmer),this.timmer=setInterval(()=>{clearInterval(this.timmer),this.getTemplateList()},200)},handleAdd(){this.open=!0,this.$refs.createModals.totalData={info:{}},this.$refs.createModals.foundationList=[],this.$refs.createModals.stepList=[]},goDetail(e){this.$refs.createModals.templateType=void 0,this.funPublic(),this.$refs.createModals.getStepDataList(e.id),this.$refs.createModals.open=!0},createCode(e){this.open=!1,this.$refs.createModals.templateType=e,this.funPublic(),this.$refs.createModals.getStepDataList(),this.$refs.createModals.open=!0},funPublic(){this.$refs.createModals.foundcative="foundtion",this.$refs.createModals.loadings=[],this.$refs.createModals.results=[],this.$refs.createModals.tokenUsageList()}}},W=B,z=(a("24c7"),Object(N["a"])(W,x,k,!1,null,"38f821a3",null)),J=z.exports,G=a("c058"),H=function(){var e=this,t=e._self._c;return t("div",{staticClass:"main"},[e._m(0),t("div",{staticClass:"search"},[t(G["a"],{attrs:{"append-icon":"mdi-magnify",items:e.searchList,outlined:"","item-text":"label","item-value":"value",clearable:""}})],1),t("div",{staticClass:"templateGoods"},[t(b["a"],[t(m["a"],{attrs:{cols:4,sm:6,xs:12}},[t("div",{staticClass:"goods"})]),t(m["a"],{attrs:{cols:4,sm:6,xs:12}},[t("div",{staticClass:"goods"})]),t(m["a"],{attrs:{cols:4,sm:6,xs:12}},[t("div",{staticClass:"goods"})])],1)],1)])},Q=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"title"},[t("h1",[e._v("模板市场")]),t("h3",[e._v("Browse 42+ Best AI Code Assistant Tools")])])}],X={data(){return{searchList:[{label:"搜索1",value:1},{label:"搜索2",value:2},{label:"搜索3",value:3}]}}},Y=X,Z=(a("4203"),Object(N["a"])(Y,H,Q,!1,null,"418c3a6c",null)),ee=Z.exports,te={data(){return{api_key:"",totalData:{}}},components:{myselfTemplate:J,templateMark:ee},created(){this.setting()},methods:{setting(){Object(F["e"])().then(e=>{this.api_key=e.data.api_key})},openUrl(){window.open("https://www.mdc.ai/contact-us/")},handleSave(){Object(F["j"])({api_key:this.api_key}).then(e=>{e.status&&this.$message({type:"success",message:"更新成功",offset:52})})}}},ae=te,se=(a("22b1"),Object(N["a"])(ae,u,f,!1,null,"4aeec4b8",null)),ie=se.exports,le=a("47df"),oe=a.n(le),ne=(a("55ee"),a("1e09"),a("160d"));s["default"].use(K["a"]);let re={variablesKey:{}},ce={},de={getVariablesKey(e,t){e.variablesKey=t}},pe={},ue=new ne["a"]({storage:window.sessionStorage});var fe=new K["a"].Store({state:re,getters:ce,mutations:de,actions:pe,plugins:[ue.plugin]}),me=a("397c");s["default"].use(me["a"]);const he={locale:localStorage.getItem("lang")||"en",messages:{zh:a("9a9c"),en:a("76c4f")}};var ve=he,_e=a("9ab1");a("29d6");s["default"].use(_e["a"]);var be=new _e["a"]({theme:{dark:!0},icons:{iconfont:"mdi"}}),ge=a("e6ef"),ye=a.n(ge);s["default"].use(oe.a),s["default"].use(ye.a),s["default"].config.productionTip=!1,new s["default"]({render:e=>e(ie),store:fe,vuetify:be,i18n:ve}).$mount("#moredeal-aigc-dashboard")},5888:function(e,t,a){},6068:function(e,t,a){"use strict";var s=a("7332"),i=a("e39c"),l=a("df70"),o=function(){var e=this,t=e._self._c;return!e.is_show||e.form.is_show?t("div",["input"==e.form.style?t(i["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,"validate-on-blur":"",rules:[!e.is_show||!e.right_show||(t=>!!t||e.form.label+e.$t("myselfTemplateList.isRequire"))],placeholder:e.form.default?e.form.default.toString():e.form.default,clearable:"",label:e.form.label,outlined:""},model:{value:e.form.value,callback:function(t){e.$set(e.form,"value",t)},expression:"form.value"}}):e._e(),"text"==e.form.style?t(l["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,"validate-on-blur":"",rules:[!e.is_show||!e.right_show||(t=>!!t||e.form.label+e.$t("myselfTemplateList.isRequire"))],placeholder:e.form.default?e.form.default.toString():e.form.default,outlined:"",clearable:"",label:e.form.label},model:{value:e.form.value,callback:function(t){e.$set(e.form,"value",t)},expression:"form.value"}}):e._e(),"select"==e.form.style?t(s["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,"validate-on-blur":"",rules:[!e.is_show||!e.right_show||(t=>!!t||e.form.label+e.$t("myselfTemplateList.isRequire"))],placeholder:e.form.default?e.form.default.toString():e.form.default,items:e.form.options,"item-text":"label","item-value":"value",label:e.form.label,clearable:"",outlined:""},model:{value:e.form.value,callback:function(t){e.$set(e.form,"value",t)},expression:"form.value"}}):e._e()],1):e._e()},n=[],r={props:{form:{type:Object},is_show:{type:Boolean,default:!0},right_show:{type:Boolean,default:!0}}},c=r,d=a("e607"),p=Object(d["a"])(c,o,n,!1,null,null,null);t["a"]=p.exports},"6f4d":function(e,t,a){},"75d8":function(e,t,a){"use strict";var s=a("16b3"),i=a("3785"),l=a("3049"),o=a("1185"),n=a("6059"),r=a("eaf2"),c=a("15a6"),d=a("a872"),p=a("e39c"),u=a("e3b7"),f=a("92a2"),m=function(){var e=this,t=e._self._c;return t(r["a"],{ref:"drawer",staticStyle:{margin:"32px 0 0 160px"},attrs:{color:"#25293c",persistent:"",absolute:"",temporary:"",right:"",width:"70%","hide-overlay":""},model:{value:e.open,callback:function(t){e.open=t},expression:"open"}},[t("div",{staticClass:"pad20",staticStyle:{"padding-top":"0"}},[t(u["a"],{attrs:{color:"#25293c",elevation:"0"}},[t(f["a"],[e._v("Template Flow")]),t(d["a"]),t("el-button",{attrs:{size:"mini",icon:"el-icon-check",type:"primary"},on:{click:e.handleSave}},[e._v(e._s(e.$t("templateModal.save")))]),t("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(t){e.open=!1}}},[e._v("Back "),t("i",{staticClass:"el-icon-right"})])],1),e._l(e.stepList,(function(a,r){return t(s["a"],{key:r,staticClass:"marbottom20 pad20 padbottom30",attrs:{color:"#2f3349",elevation:"5"}},[t(n["a"],[t(c["a"],[t(l["a"],{staticStyle:{padding:"0 12px"},attrs:{cols:3}},[t(p["a"],{attrs:{"persistent-placeholder":"",label:e.$t("viewTemplate.title"),outlined:""},model:{value:a.label,callback:function(t){e.$set(a,"label",t)},expression:"step.label"}})],1),t(l["a"],{staticStyle:{padding:"0 12px"},attrs:{cols:9}},[t(p["a"],{attrs:{"persistent-placeholder":"",label:e.$t("viewTemplate.desc"),outlined:""},model:{value:a.desc,callback:function(t){e.$set(a,"desc",t)},expression:"step.desc"}})],1)],1)],1),"button"!=a.stepModule.response.style?t(i["c"],[e._v(e._s(e.$t("templateModal.Variable")))]):e._e(),e._l(a.stepModule.variables,(function(e,a){return t("defaultInput",{key:a,attrs:{form:e}})})),t(c["a"],{staticStyle:{"margin-top":"10px"}},e._l(a.variables,(function(e,a){return t(l["a"],{key:a,staticStyle:{padding:"0 10px"},attrs:{cols:3}},[t("defaultInput",{staticClass:"edit_list",attrs:{form:e}})],1)})),1),"button"!=a.stepModule.response.style?t(o["a"],{staticStyle:{margin:"10px 0 0 0"}}):e._e(),e._l(a.stepModule.variables,(function(s,i){return t("div",{key:i+"no",staticStyle:{cursor:"pointer",display:"inline-block"},on:{click:function(t){return e.handleEdit(s,r,i,!1,a)}}},[t("el-button",{staticClass:"el_edit",attrs:{type:"info"}},[t("div",{staticClass:"label"},[e._v(e._s(s.label))]),t("div",{staticClass:"els"},[e._v(e._s(s.style))])])],1)})),e._l(a.variables,(function(s,i){return t("el-button",{key:i+"yes",staticClass:"el_edit",attrs:{type:"info"},on:{click:function(t){return e.handleEdit(s,r,i,!0,a)}}},[t("div",{staticClass:"label"},[e._v(e._s(s.label))]),t("div",{staticClass:"els"},[e._v(e._s(s.style))])])})),t("br"),"button"!=a.stepModule.response.style?t("el-button",{staticStyle:{margin:"10px 0 0 0px"},attrs:{icon:"el-icon-plus",type:"primary"},on:{click:function(t){return e.addVariable(a)}}},[e._v(e._s(e.$t("viewTemplate.addVariables")))]):e._e()],2)})),t("edit",{ref:"edits",on:{deleteForms:e.deleteForm,editSaveTwos:e.editSaveTwo,editSaves:e.editSave}})],2)])},h=[],v=(a("5edb"),a("ec0b")),_=a("7332"),b=a("df70"),g=function(){var e=this,t=e._self._c;return t("div",["input"==e.form.style?t(p["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,clearable:"",label:e.form.label,outlined:""},model:{value:e.form.default,callback:function(t){e.$set(e.form,"default",t)},expression:"form.default"}}):e._e(),"text"==e.form.style?t(b["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,outlined:"",clearable:"",label:e.form.label},model:{value:e.form.default,callback:function(t){e.$set(e.form,"default",t)},expression:"form.default"}}):e._e(),"select"==e.form.style?t(_["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,items:e.form.options,"item-text":"label","item-value":"value",label:e.form.label,clearable:"",outlined:""},model:{value:e.form.default,callback:function(t){e.$set(e.form,"default",t)},expression:"form.default"}}):e._e()],1)},y=[],x={props:{form:{type:Object}}},k=x,$=a("e607"),S=Object($["a"])(k,g,y,!1,null,null,null),w=S.exports,M={data(){return{open:!1,stepList:[],noVip:!0,prompt:"Write an article about"}},created(){addEventListener("keydown",e=>{27==e.keyCode&&this.open&&0==this.$refs.edits.opens&&this.$set(this,"open",!1)})},components:{edit:v["a"],defaultInput:w},methods:{handleEdit(e,t,a,s,i){this.$refs.edits.opens=!0,this.$refs.edits.flag=s,this.$refs.edits.coordinates={stepIndex:t,index:a},this.$refs.edits.form=JSON.parse(JSON.stringify(e)),this.$refs.edits.$refs.editForm.resetValidation(),this.$refs.edits.varbles=i.label.trim().replace(/ /g,"_").toUpperCase()},addVariable(e){e.variables.push({key:this.$store.state.variablesKey.input,field:"Variable_"+e.variables.length,label:"Variable "+e.variables.length,desc:"",options:[],is_show:!0,style:"input"})},deleteForm(e){this.stepList[e.stepIndex].variables.splice(e.index,1)},editSave(e,t){this.$set(this.stepList[t.stepIndex].variables,t.index,e)},editSaveTwo(e,t){this.$set(this.stepList[t.stepIndex].stepModule.variables,t.index,e)},handleSave(){this.stepList.map(e=>{e.field=e.label.trim().replace(/ /g,"_").toUpperCase()}),this.$emit("handleSaves",this.stepList)}}},C=M,L=(a("bc1b"),Object($["a"])(C,m,h,!1,null,"76b37c3e",null));t["a"]=L.exports},"76c4":function(e,t,a){},"76c4f":function(e,t){e.exports={tabs:{myTemplate:"My Template",templateMarket:"Template Market",configuration:"Configuration"},myselfTemplateList:{templateName:"Template Name",pleaseName:"Please enter a template name",templateScene:"Template Scene",pleaseScene:"Please enter template scenario",createTemplate:"Start Template",type:"template Type",isRequire:"is require"},advanced:{version:"Template Version",key:"Template Key",scene:"Template Scene"},setting:{pleaseInput:"Please enter api_key",save:"Save api_key"},templateModal:{copy:"Click to Copy",title:"Template Library",Variable:"Variable",configuration:"See the steps to configure the",foundation:"GENEROL",model:"ADVANCED",templateName:"Template Name",pleaseName:"Please enter a template name",templateDesc:"Template Desc",pleaseDesc:"Please enter template Desc",execute:"Execute",allExecute:"All Execution",create:"Create Article",reconfirm:"Please confirm again whether to delete",cancel:"Cancel",save:"save",save1:"Confirm",return:"Return Template"},viewTemplate:{title:"Step Title",desc:"Step Desc",type:"Step Type",delete:"Delete",copy:"Copy",variables:"Variables",addVariables:"Add Variables",editVariables:"Edit Variables",options:"Option",addOption:"Add Option"},tips:{Please:"Please select",notOpen:"Not open yet",edit:"Successful Operation"}}},"8d39":function(e,t,a){},"938f":function(e,t,a){},"9a9c":function(e,t){e.exports={tabs:{myTemplate:"我的模板",templateMarket:"模板市场",configuration:"配置"},myselfTemplateList:{templateName:"模板名称",pleaseName:"请输入模板名称",templateScene:"模板场景",pleaseScene:"请输入模板场景",createTemplate:"新建模板",type:"模板类型",isRequire:"是必填"},advanced:{version:"模板版本号",key:"模板key",scene:"模板场景"},setting:{pleaseInput:"请输入 api_key",save:"保存 api_key"},templateModal:{copy:"点击复制",title:"模板使用",Variable:"变量",configuration:"查看步骤配置",foundation:"基础",model:"模型",templateName:"模板名称",pleaseName:"请输入模板名称",templateDesc:"模板描述",pleaseDesc:"请输入模板描述",execute:"执行",allExecute:"全部执行",create:"创建文章",reconfirm:"请再次确认是否要删除",cancel:"取 消",save:"保 存",return:"返回模板"},viewTemplate:{title:"步骤标题",desc:"步骤描述",type:"步骤类型",delete:"删除",copy:"拷贝",variables:"变量",addVariables:"增加变量",editVariables:"编辑变量",options:"选项",addOption:"增加选项"},tips:{Please:"请选择",notOpen:"暂未开放",edit:"操作成功"}}},bc1b:function(e,t,a){"use strict";a("6f4d")},dc8e:function(e,t,a){"use strict";a("76c4")},ec0b:function(e,t,a){"use strict";var s=a("a04a"),i=a("6059"),l=a("7ff8"),o=a("34ae"),n=a("96b0"),r=a("2708"),c=a("8e80"),d=a("eaf2"),p=a("7332"),u=a("9dec"),f=a("e39c"),m=a("df70"),h=a("e4c8"),v=function(){var e=this,t=e._self._c;return t(d["a"],{attrs:{color:"#25293c","hide-overlay":"",app:"",temporary:"",right:"",width:"500"},model:{value:e.opens,callback:function(t){e.opens=t},expression:"opens"}},[t("div",{staticClass:"mainEdit"},[t("div",{staticClass:"editVariable"},[t("div",{staticClass:"title"},[t("div",{staticClass:"titles"},[e._v(e._s(e.$t("viewTemplate.editVariables")))]),t("div",{staticClass:"subtitles"},[e._v("Add this variable to the prompt like this:")]),t(h["a"],{attrs:{top:""},scopedSlots:e._u([{key:"activator",fn:function({on:a}){return[t("div",e._g({staticClass:"subtitles",staticStyle:{cursor:"pointer"},on:{click:function(t){return e.copys(e.varbles,e.form.field)}}},a),[e._v("{STEP."+e._s(e.varbles)+"."),e.form.field?t("span",[e._v(e._s(e.form.field.toUpperCase()))]):e._e(),e._v("}")])]}}])},[t("span",[e._v(e._s(e.$t("templateModal.copy")))])])],1),t("div",[e.flag?t(c["a"],{attrs:{"offset-y":""},scopedSlots:e._u([{key:"activator",fn:function({on:a,attrs:i}){return[t(s["a"],e._g(e._b({staticStyle:{margin:"0 5px"},attrs:{fab:"",small:"",text:""}},"v-btn",i,!1),a),[t(l["a"],[e._v("mdi-dots-vertical")])],1)]}}],null,!1,1130029260)},[t(o["a"],{attrs:{dense:""}},[t(n["a"],{attrs:{link:""},on:{click:e.deleteForm}},[t(l["a"],{attrs:{color:"error"}},[e._v("mdi-delete")]),t(r["b"],[e._v(e._s(e.$t("viewTemplate.delete")))])],1)],1)],1):e._e(),t(s["a"],{staticStyle:{"margin-right":"10px"},attrs:{color:"blue darken-1"},on:{click:e.goBack}},[e._v(" "+e._s(e.$t("templateModal.save")))])],1)]),t(i["a"],{ref:"editForm"},[t(f["a"],{attrs:{"persistent-placeholder":"","validate-on-blur":"",rules:[t=>!!t||"field"+e.$t("myselfTemplateList.isRequire")],disabled:!e.flag,clearable:"",label:"field",outlined:""},nativeOn:{keydown:function(t){return e.keydown(t)}},model:{value:e.form.field,callback:function(t){e.$set(e.form,"field",t)},expression:"form.field"}}),t(f["a"],{attrs:{"persistent-placeholder":"","validate-on-blur":"",rules:[t=>!!t||"label"+e.$t("myselfTemplateList.isRequire")],disabled:!e.flag,clearable:"",label:"label",outlined:""},model:{value:e.form.label,callback:function(t){e.$set(e.form,"label",t)},expression:"form.label"}}),t(m["a"],{attrs:{"persistent-placeholder":"",disabled:!e.flag,clearable:"",label:"desc",outlined:""},model:{value:e.form.desc,callback:function(t){e.$set(e.form,"desc",t)},expression:"form.desc"}}),t(p["a"],{attrs:{"persistent-placeholder":"","validate-on-blur":"",rules:[t=>!!t||"type"+e.$t("myselfTemplateList.isRequire")],disabled:!e.flag,items:e.option,"item-text":"label","item-value":"value",label:"type",outlined:""},on:{change:e.onChange},model:{value:e.form.style,callback:function(t){e.$set(e.form,"style",t)},expression:"form.style"}}),t(u["a"],{attrs:{label:"is_show"},model:{value:e.form.is_show,callback:function(t){e.$set(e.form,"is_show",t)},expression:"form.is_show"}}),"select"==e.form.style?t("div",[e._l(e.form.options,(function(a,s){return t("div",{key:s,staticClass:"el_value"},[t(f["a"],{attrs:{"persistent-placeholder":"","validate-on-blur":"",rules:[t=>!!t||"label"+e.$t("myselfTemplateList.isRequire")],clearable:"",label:"label",outlined:""},model:{value:a.label,callback:function(t){e.$set(a,"label",t)},expression:"item.label"}}),t("div",{staticStyle:{margin:"0 10px"}},[e._v("-")]),t(f["a"],{attrs:{"persistent-placeholder":"","validate-on-blur":"",rules:[t=>!!t||"value"+e.$t("myselfTemplateList.isRequire")],clearable:"",label:"value",outlined:""},model:{value:a.value,callback:function(t){e.$set(a,"value",t)},expression:"item.value"}}),t("div",{staticClass:"el-icon-delete",on:{click:function(t){return e.delSele(s)}}})],1)})),t("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:e.handleAdd}},[e._v(e._s(e.$t("viewTemplate.addOption")))])],2):e._e()],1)],1)])},_=[],b=(a("5edb"),{data(){return{opens:!1,flag:!0,coordinates:{},varbles:"",form:{},option:[{label:"input",value:"input"},{label:"textarea",value:"text"},{label:"select",value:"select",options:[]}]}},created(){addEventListener("keydown",e=>{27==e.keyCode&&this.opens&&this.$set(this,"opens",!1)})},methods:{goBack(){this.$refs.editForm.validate()&&(this.flag?this.$emit("editSaves",this.form,this.coordinates):this.$emit("editSaveTwos",this.form,this.coordinates),this.$set(this,"opens",!1))},deleteForm(){this.$emit("deleteForms",this.coordinates),this.opens=!1},onChange(e){"input"==e?this.form.key=this.$store.state.variablesKey.input:"text"==e?this.form.key=this.$store.state.variablesKey.text:"select"==e&&(this.form.key=this.$store.state.variablesKey.select)},handleAdd(){this.form.options.push({label:"label",value:"value"})},delSele(e){this.form.options.splice(e,1)},copys(e,t){let a="{STEP."+e+"."+t.toUpperCase()+"}";this.$copyText(a).then(e=>{this.$message({type:"success",message:"Copy Success",offset:52})})},keydown(e){32==e.keyCode&&(e.returnValue=!1)}}}),g=b,y=(a("2b97"),a("e607")),x=Object(y["a"])(g,v,_,!1,null,"4d5199e3",null);t["a"]=x.exports},f159:function(module,__webpack_exports__,__webpack_require__){"use strict";var _components_stepConfiguration_index_vue__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("75d8"),_variable_vue__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("1fb6"),_api__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("365c"),_components_iShowInput_vue__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("6068");__webpack_exports__["a"]={data(){return{open:!1,dialog:!1,right_show:!1,foundcative:0,loading:!1,saveLoading:!1,configLoading:!1,loadings:[],results:[],templateType:void 0,foundationList:[],tokenList:{},stepList:[],totalData:{}}},created(){addEventListener("keydown",e=>{27==e.keyCode&&this.open&&0==this.$refs.configurations.open&&this.$set(this,"open",!1)})},components:{stepConfiguration:_components_stepConfiguration_index_vue__WEBPACK_IMPORTED_MODULE_0__["a"],iShowInput:_components_iShowInput_vue__WEBPACK_IMPORTED_MODULE_3__["a"],variable:_variable_vue__WEBPACK_IMPORTED_MODULE_1__["a"]},methods:{getStepDataList(e){this.loading=!0,Object(_api__WEBPACK_IMPORTED_MODULE_2__["f"])({tmpId:e,tmpCode:this.templateType}).then(e=>{e.status?(this.totalData=e.data,this.foundationList=this.totalData.info.variables,this.stepList=this.totalData.info.steps):(this.foundationList=[],this.stepList=[]),this.loading=!1})},tokenUsageList(){Object(_api__WEBPACK_IMPORTED_MODULE_2__["h"])().then(e=>{e.success&&(this.tokenList=e.data)})},setVariable(e){this.foundationList=e,this.totalData.info.variables=e,this.foundcative="foundtion"},tabClick(e){e.label==this.$t("templateModal.Variable")&&(this.$refs.variables.variablesList=JSON.parse(JSON.stringify(this.totalData.info.variables)))},setConfigurations(e){this.configLoading=!0,this.stepList=e,this.totalData.info.steps=e,this.handleSave(!1)},handleDel(){Object(_api__WEBPACK_IMPORTED_MODULE_2__["b"])({tmpId:this.totalData.id}).then(e=>{e.status&&(this.$message({type:"success",message:"删除成功",offset:52}),this.$parent.getTemplateList(),this.open=!1)})},configuration(){this.$refs.configurations.open=!0,this.$refs.configurations.stepList=JSON.parse(JSON.stringify(this.stepList))},handleExecute(stepField,index,flag){this.right_show=!0,this.$nextTick(()=>{eval("this.$refs.rightForm"+index)[0].validate()&&(this.$set(this.loadings,index,!0),!this.totalData.id&&(this.totalData.type=this.templateType),Object(_api__WEBPACK_IMPORTED_MODULE_2__["c"])({tmpId:this.totalData.id,stepField:stepField,templateModel:this.totalData}).then(e=>{if(this.tokenUsageList(),e.data.status){let t=e.data.stepResponse;t.value.trim(),this.totalData.info.steps[index].stepModule.response=t,this.$set(this.loadings,index,!1),this.$set(this.results,index,"success"),flag&&index<this.totalData.info.steps.length-1&&this.handleExecute(this.totalData.info.steps[index+1].field,index+1,!0),this.$message({type:"success",message:"success",offset:52})}else{this.$message({type:"warning",message:e.data.message,offset:52}),this.$set(this.results,index,"error");for(let e=index;e<this.totalData.info.steps.length;e++)this.$set(this.loadings,e,!1)}}).catch(()=>{this.$set(this.results,index,"error");for(let e=index;e<this.totalData.info.steps.length;e++)this.$set(this.loadings,e,!1)}))})},allExecute(){this.right_show=!0;let rightResult=!0;this.totalData.info.steps.map((item,index)=>{"button"!=item.stepModule.response.style&&(eval("this.$refs.rightForm"+index)[0].validate()||(rightResult=!1))}),rightResult&&(this.totalData.info.steps.map((e,t)=>{this.$set(this.loadings,t,!0)}),this.totalData.info.steps[0],this.handleExecute(this.totalData.info.steps[0].field,0,!0))},handleUrl(){},handleCopy(){let e="";this.totalData.info.steps.map(t=>{"button"!=t.stepModule.response.style&&(e+="\n          \n          "+t.stepModule.response.value)}),this.$copyText(e).then(e=>{this.$message.success("Copy Success")})},handleBack(){this.$set(this,"open",!1),this.$refs.leftForm.resetValidation(),this.totalData.info&&this.totalData.info.steps.map((item,index)=>{"button"!=item.stepModule.response.style&&eval("this.$refs.rightForm"+index)[0].resetValidation()})},handleSave(flag){this.saveLoading=!0,this.right_show=!1,this.foundcative=0;let rightResult=!0;this.totalData.info.steps.map((item,index)=>{"button"!=item.stepModule.response.style&&(eval("this.$refs.rightForm"+index)[0].validate()||(rightResult=!1))});let leftResult=this.$refs.leftForm.validate();leftResult&&rightResult?this.totalData.id||0===this.totalData.id?Object(_api__WEBPACK_IMPORTED_MODULE_2__["i"])(this.totalData).then(e=>{this.saveLoading=!1,this.configLoading=!1,this.$refs.configurations.open=!1,e.status&&(this.open=!flag,this.$parent.getTemplateList(),this.$message({type:"success",message:this.$t("tips.edit"),offset:52}))}):(this.totalData.type=this.templateType,Object(_api__WEBPACK_IMPORTED_MODULE_2__["a"])(this.totalData).then(e=>{this.saveLoading=!1,this.configLoading=!1,this.$refs.configurations.open=!1,e.status&&(this.open=!flag,this.$parent.getTemplateList(),this.$message({type:"success",message:this.$t("tips.edit"),offset:52}))})):(this.configLoading=!1,this.saveLoading=!1)},contact(){window.open("https://www.mdc.ai/contact-us/")}}}}});
     1(function(e){function t(t){for(var s,o,n=t[0],r=t[1],c=t[2],p=0,u=[];p<n.length;p++)o=n[p],Object.prototype.hasOwnProperty.call(i,o)&&i[o]&&u.push(i[o][0]),i[o]=0;for(s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s]);d&&d(t);while(u.length)u.shift()();return l.push.apply(l,c||[]),a()}function a(){for(var e,t=0;t<l.length;t++){for(var a=l[t],s=!0,n=1;n<a.length;n++){var r=a[n];0!==i[r]&&(s=!1)}s&&(l.splice(t--,1),e=o(o.s=a[0]))}return e}var s={},i={index:0},l=[];function o(t){if(s[t])return s[t].exports;var a=s[t]={i:t,l:!1,exports:{}};return e[t].call(a.exports,a,a.exports,o),a.l=!0,a.exports}o.m=e,o.c=s,o.d=function(e,t,a){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(o.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)o.d(a,s,function(t){return e[t]}.bind(null,s));return a},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var n=window["webpackJsonp"]=window["webpackJsonp"]||[],r=n.push.bind(n);n.push=t,n=n.slice();for(var c=0;c<n.length;c++)t(n[c]);var d=r;l.push([0,"chunk-vendors"]),a()})({0:function(e,t,a){e.exports=a("56d7")},"1e09":function(e,t,a){},"1fb6":function(e,t,a){"use strict";var s=a("16b3"),i=function(){var e=this,t=e._self._c;return t(s["a"],{staticClass:"pad10"},[t("div",{staticClass:"topBtn"},[t("el-button",{attrs:{size:"mini",icon:"el-icon-plus",type:"primary"},on:{click:e.addVariable}},[e._v(e._s(e.$t("viewTemplate.addVariables")))]),t("el-button",{attrs:{size:"mini",icon:"el-icon-check",type:"info"},on:{click:e.handleSave}},[e._v(e._s(e.$t("templateModal.save")))])],1),e._l(e.variablesList,(function(e,a){return t("iShowInput",{key:e.key+a,attrs:{form:e,is_show:!1}})})),e._l(e.variablesList,(function(a,s){return t("el-button",{key:s,staticClass:"el_edit",staticStyle:{margin:"10px 0 0 10px"},attrs:{type:"info"},on:{click:function(t){return e.handleEdit(a,s)}}},[t("span",{staticClass:"label"},[e._v(e._s(a.label))]),t("span",{staticClass:"els"},[e._v(e._s(a.style))])])})),t("edit",{ref:"edits",on:{deleteForms:e.deleteForm}})],2)},l=[],o=(a("5edb"),a("ec0b")),n=a("6068"),r={data(){return{index:"",variablesList:[]}},components:{edit:o["a"],iShowInput:n["a"]},methods:{handleEdit(e,t){this.$refs.edits.opens=!0,this.index=t,this.$refs.edits.form=e},addVariable(){this.variablesList.push({key:this.$store.state.variablesKey.input,field:"Variable_"+this.variablesList.length,label:"Variable "+this.variablesList.length,desc:"",options:[],is_show:!0,style:"input"})},deleteForm(){console.log(this.index),console.log(this.variablesList),this.variablesList.splice(this.index,1)},handleSave(){this.$emit("handleSave",this.variablesList)}}},c=r,d=(a("dc8e"),a("e607")),p=Object(d["a"])(c,i,l,!1,null,null,null);t["a"]=p.exports},"22b1":function(e,t,a){"use strict";a("2fb4")},"240e":function(e,t,a){},"24c7":function(e,t,a){"use strict";a("5888")},2721:function(e,t,a){"use strict";a("dc14")},"2b97":function(e,t,a){"use strict";a("938f")},"2fb4":function(e,t,a){},"365c":function(e,t,a){"use strict";a.d(t,"g",(function(){return n})),a.d(t,"h",(function(){return r})),a.d(t,"d",(function(){return c})),a.d(t,"f",(function(){return d})),a.d(t,"c",(function(){return p})),a.d(t,"a",(function(){return u})),a.d(t,"i",(function(){return f})),a.d(t,"b",(function(){return m})),a.d(t,"e",(function(){return h})),a.d(t,"j",(function(){return v}));var s=a("e1e2"),i=a("47df");let l;l=MOREDEAL_AIGC.wpRestUrl;const o=s["a"].create({headers:{"Content-Type":"application/json"},baseURL:l,timeout:3e5,withCredentials:!0});function n(e){return o({url:"/aigc/v1/template/page",method:"get",params:e})}function r(e){return o({url:"/aigc/v1/template/tokenInfo",method:"get",params:e})}function c(e){return o({url:"/aigc/v1/template/config",method:"get",params:e})}function d(e){return o({url:"/aigc/v1/template/detail",method:"get",params:e})}function p(e){return o({url:"/aigc/v1/template/executeTemplate",method:"post",data:e})}function u(e){return o({url:"/aigc/v1/template/create",method:"post",data:e})}function f(e){return o({url:"/aigc/v1/template/modify",method:"post",data:e})}function m(e){return o({url:"/aigc/v1/template/delete",method:"post",data:e})}function h(e){return o({url:"/aigc/v1/config/get",method:"get",params:e})}function v(e){return o({url:"/aigc/v1/config/set",method:"post",data:e})}o.interceptors.request.use(e=>e,e=>Promise.reject(e)),o.interceptors.response.use(e=>e.data&&e.data.status||e.data&&!e.data.status?e.data:void 0,e=>(e.message.includes("timeout")?i["Message"].error({center:!0,message:"Request Timeout",offset:52}):i["Message"].error({center:!0,message:"System Error",offset:52}),Promise.reject(e)))},4203:function(e,t,a){"use strict";a("240e")},"56d7":function(e,t,a){"use strict";a.r(t);var s=a("1f37"),i=a("a517"),l=a("a04a"),o=a("16b3"),n=a("3785"),r=a("dc88"),c=a("6589"),d=a("b217"),p=a("e39c"),u=function(){var e=this,t=e._self._c;return t(i["a"],[t("div",{staticClass:"main"},[t(d["a"],{attrs:{"background-color":"#25293c"}},[t(r["a"],{staticStyle:{"text-transform":"none"}},[e._v(e._s(e.$t("tabs.myTemplate")))]),t(r["a"],{staticStyle:{"text-transform":"none"}},[e._v(e._s(e.$t("tabs.templateMarket")))]),t(c["a"],{attrs:{transition:!1}},[t(o["a"],{attrs:{color:"#25293c"}},[t("myself-template")],1)],1),t(c["a"],{attrs:{transition:!1}},[t(o["a"],{attrs:{color:"#25293c"}},[t(n["b"],[e._v('Thank you for your interest! We are actively working on developing a new feature for our plugin that will include a variety of process templates in a "Template Marketplace," enabling you to easily generate different types of content and articles. We\'re working hard on this feature and look forward to sharing it with you soon.')]),t(n["b"],{on:{click:e.openUrl}},[t("el-link",{attrs:{type:"primary"}},[e._v("Contact us to get the latest information.")])],1)],1)],1),t(c["a"],{attrs:{transition:!1}},[t(o["a"],{staticStyle:{"padding-top":"50px"},attrs:{color:"#25293c"}},[t(p["a"],{staticStyle:{width:"700px"},attrs:{"persistent-placeholder":"",clearable:"",label:"api_key",outlined:""},scopedSlots:e._u([{key:"append-outer",fn:function(){return[t(l["a"],{on:{click:e.handleSave}},[e._v(e._s(e.$t("setting.save")))])]},proxy:!0}]),model:{value:e.api_key,callback:function(t){e.api_key=t},expression:"api_key"}})],1)],1)],1)],1)])},f=[],m=a("3049"),h=a("c2f0"),v=a("6059"),_=a("7ff8"),b=a("15a6"),g=a("a872"),y=a("e3b7"),x=function(){var e=this,t=e._self._c;return t("div",[t("div",{staticStyle:{width:"1100px",margin:"0 auto"}},[t("div",{staticClass:"title"},[e._v(" "+e._s(e.$t("tabs.myTemplate"))+" "),t(l["a"],{staticStyle:{float:"right","text-transform":"none"},attrs:{color:"primary"},on:{click:e.handleAdd}},[e._v(e._s(e.$t("myselfTemplateList.createTemplate"))),t(_["a"],{attrs:{right:""}},[e._v("mdi-plus")])],1)],1),t(v["a"],[t(b["a"],[t(m["a"],{attrs:{cols:"6",md:"3"}},[t(p["a"],{attrs:{"persistent-placeholder":"",label:e.$t("myselfTemplateList.templateName"),clearable:"",outlined:""},on:{input:e.textChange},model:{value:e.queryParams.name,callback:function(t){e.$set(e.queryParams,"name",t)},expression:"queryParams.name"}})],1),t(m["a"],{attrs:{cols:"6",md:"3"}},[t(p["a"],{attrs:{"persistent-placeholder":"",label:e.$t("myselfTemplateList.templateScene"),clearable:"",outlined:""},on:{input:e.textChange},model:{value:e.queryParams.desc,callback:function(t){e.$set(e.queryParams,"desc",t)},expression:"queryParams.desc"}})],1)],1)],1),t("div",{staticClass:"moredeal"},e._l(e.templateList,(function(a,s){return t("div",{key:s,staticClass:"tagList",on:{click:function(t){return e.goDetail(a)}}},[t("div",{staticClass:"tagImage el-icon-document"}),t("div",{staticClass:"tagDes"},[t("div",{staticClass:"tagName"},[e._v(e._s(a.name))]),t("div",{staticClass:"tagContent"},[e._v(e._s(a.desc))])])])})),0)],1),t(h["a"],{staticStyle:{"z-index":"2000 !important"},attrs:{width:"1200"},model:{value:e.open,callback:function(t){e.open=t},expression:"open"}},[t(o["a"],{staticStyle:{padding:"0 20px"},attrs:{color:"#25293c"}},[t(y["a"],[t(n["c"],[e._v(e._s(e.$t("templateModal.title")))]),t(g["a"]),t(l["a"],{attrs:{fab:"",text:""},on:{click:function(t){e.open=!1}}},[t(_["a"],[e._v("mdi-close")])],1)],1),t("div",{staticClass:"moredeal"},e._l(e.createList,(function(a,s){return t("div",{key:s,staticClass:"tagList",staticStyle:{width:"360px"},on:{click:function(t){return e.createCode(s)}}},[t("div",{staticClass:"tagImage el-icon-document"}),t("div",{staticClass:"tagDes"},[t("div",{staticClass:"tagName"},[e._v(" "+e._s(a.name)+" ")]),t("div",{staticClass:"tagContent"},[e._v(e._s(a.description))])])])})),0)],1)],1),t("create-modal",{ref:"createModals"})],1)},k=[],$=a("1185"),S=a("34ae"),w=a("96b0"),M=a("804b"),C=a("2708"),L=a("8e80"),D=a("ac5c"),T=a("3b43"),O=a("3877"),E=a("df70"),P=a("92a2"),I=a("e4c8"),R=function(){var e=this,t=e._self._c;return t("div",[t(h["a"],{staticStyle:{"overflow-x":"hidden"},attrs:{"retain-focus":!1,persistent:"",fullscreen:"","hide-overlay":""},model:{value:e.open,callback:function(t){e.open=t},expression:"open"}},[t(o["a"],{staticClass:"pad10",staticStyle:{overflow:"hidden"},attrs:{color:"#25293c"}},[t(y["a"],{staticStyle:{"margin-top":"10px"},attrs:{color:"#25293c",elevation:"0",extended:"","extension-height":"10"}},[t(l["a"],{attrs:{text:""},on:{click:e.handleBack}},[t(_["a"],{attrs:{left:""}},[e._v("mdi-arrow-left")]),e._v("Back ")],1),t(P["a"],{staticStyle:{"margin-left":"10px"}},[e._v(e._s(e.totalData.name))]),t("div",{staticClass:"statistics"},[t("div",{staticClass:"tokens"},[t("p",{staticClass:"labels"},[e._v("Tokens")]),t("p",{staticClass:"value"},[e._v(e._s(e.tokenList.tokenUsable))])]),t("div",{staticClass:"tokens"},[t("p",{staticClass:"labels"},[e._v("Trial Days")]),t("p",{staticClass:"value"},[e._v(e._s(e.tokenList.timeLeft))])]),t(l["a"],{attrs:{color:"primary",text:"","x-small":""},on:{click:e.contact}},[e._v("UPGRADE")])],1),t(g["a"]),t(L["a"],{attrs:{"offset-y":""},scopedSlots:e._u([{key:"activator",fn:function({on:a,attrs:s}){return[t(l["a"],e._g(e._b({staticStyle:{margin:"0 5px"},attrs:{fab:"",small:"",text:""}},"v-btn",s,!1),a),[t(_["a"],[e._v("mdi-dots-vertical")])],1)]}}])},[t(S["a"],{attrs:{dense:""}},[e.totalData.id||0===e.totalData.id?t(w["a"],{attrs:{link:""},on:{click:function(t){e.dialog=!0}}},[t(_["a"],{attrs:{color:"error"}},[e._v("mdi-delete")]),t(C["b"],[e._v(e._s(e.$t("viewTemplate.delete")))])],1):e._e(),t(w["a"],{attrs:{link:""}},[t(_["a"],[e._v("mdi-content-copy")]),t(C["b"],[e._v(e._s(e.$t("viewTemplate.copy"))+" ")])],1)],1)],1),t(I["a"],{attrs:{bottom:""},scopedSlots:e._u([{key:"activator",fn:function({on:a}){return[t(l["a"],e._g({staticStyle:{"margin-right":"10px"},attrs:{text:""},on:{click:e.configuration}},a),[t(_["a"],[e._v("mdi-clipboard-flow")])],1)]}}])},[t("span",[e._v(e._s(e.$t("templateModal.configuration")))])]),t(l["a"],{attrs:{color:"blue darken-1",loading:e.saveLoading},on:{click:e.handleSave}},[e._v(" "+e._s(e.$t("templateModal.save")))])],1),t(b["a"],[t(m["a"],{staticStyle:{padding:"0 0 0 20px"},attrs:{cols:"4"}},[t(o["a"],{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"pad10 mar10",attrs:{color:"#2f3349",elevation:"5"}},[t(d["a"],{attrs:{"background-color":"#2f3349"},model:{value:e.foundcative,callback:function(t){e.foundcative=t},expression:"foundcative"}},[t(r["a"],{staticStyle:{"text-transform":"none"}},[e._v(e._s(e.$t("templateModal.foundation")))]),t(r["a"],{staticStyle:{"text-transform":"none"}},[e._v(e._s(e.$t("templateModal.model")))]),t(O["a"],{model:{value:e.foundcative,callback:function(t){e.foundcative=t},expression:"foundcative"}},[t(c["a"],{attrs:{transition:!1}},[t(o["a"],{staticStyle:{overflow:"hidden"},attrs:{color:"#2f3349"}},[t(v["a"],{ref:"leftForm",staticStyle:{"margin-top":"20px"}},[t(p["a"],{attrs:{"persistent-hint":"","validate-on-blur":"",clearable:"",rules:[t=>!!t||e.$t("templateModal.templateName")+e.$t("myselfTemplateList.isRequire")],"persistent-placeholder":"",label:e.$t("templateModal.templateName"),placeholder:e.$t("templateModal.pleaseName"),outlined:""},model:{value:e.totalData.name,callback:function(t){e.$set(e.totalData,"name",t)},expression:"totalData.name"}}),t(E["a"],{attrs:{"persistent-placeholder":"",clearable:"",label:e.$t("templateModal.templateDesc"),placeholder:e.$t("templateModal.pleaseDesc"),outlined:""},model:{value:e.totalData.desc,callback:function(t){e.$set(e.totalData,"desc",t)},expression:"totalData.desc"}}),t($["a"],{staticStyle:{"margin-bottom":"30px"}}),e._l(e.foundationList,(function(e,a){return t("iShowInput",{key:e.key+a,attrs:{form:e}})}))],2)],1)],1),t(c["a"],{attrs:{transition:!1}},[t(o["a"],{attrs:{color:"#2f3349"}},[t(S["a"],{attrs:{color:"#2f3349"}},[t(w["a"],[t(M["a"],{staticStyle:{width:"130px"}},[e._v(e._s(e.$t("advanced.version")))]),t(C["a"],[e.totalData.info?t(C["b"],[e._v(e._s(e.totalData.info.version))]):e._e()],1)],1),t(w["a"],[t(M["a"],{staticStyle:{width:"130px"}},[e._v(e._s(e.$t("advanced.key")))]),t(C["a"],[e.totalData.info?t(C["b"],[e._v(e._s(e.totalData.info.key))]):e._e()],1)],1),t(w["a"],[t(M["a"],{staticStyle:{width:"130px"}},[e._v(e._s(e.$t("advanced.scene")))]),t(C["a"],[e.totalData.info&&e.totalData.info.scenes&&0!=e.totalData.info.scenes.length?t(C["b"],[e._v(e._s(e.totalData.info.scenes.map(e=>e.app).toString()))]):e._e()],1)],1)],1)],1)],1),t(c["a"],{attrs:{transition:!1}},[t("variable",{ref:"variables",on:{handleSave:e.setVariable}})],1)],1)],1)],1)],1),t(m["a"],{staticStyle:{padding:"0 12px"},attrs:{cols:"8"}},[t(o["a"],{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticStyle:{padding:"20px 0",margin:"10px 10px 10px 0"},attrs:{color:"#2f3349",elevation:"5"}},[t(l["a"],{staticStyle:{"margin-left":"10px","text-transform":"none","margin-bottom":"10px"},attrs:{color:"primary"},on:{click:e.allExecute}},[t(_["a"],[e._v("mdi-motion-play")]),e._v(e._s(e.$t("templateModal.allExecute")))],1),e._l(e.stepList,(function(a,s){return t(o["a"],{directives:[{name:"loading",rawName:"v-loading",value:e.loadings[s],expression:"loadings[index]"}],key:s,staticClass:"pad10",staticStyle:{"text-transform":"none",padding:"0 10px"},attrs:{color:"#2f3349",elevation:"0"}},["button"!=a.stepModule.response.style?t("div",{staticClass:"title"},[t("div",[t("div",{staticClass:"stepTitle"},[e._v(e._s(a.label))]),t("div",{staticClass:"stepDesc"},[e._v(e._s(a.desc))])]),t("div",{staticStyle:{"white-space":"nowrap"}},[t("i",{class:"success"==e.results[s]?"el-icon-success":"error"==e.results[s]?"el-icon-error":"",style:{color:"success"==e.results[s]?"#67c23a":"#f56c6c",fontSize:"20px",verticalAlign:"middle",marginRight:"5px"}}),t("el-button",{attrs:{type:"primary",size:"mini",icon:"el-icon-video-play",disabled:0!=s&&"success"!=e.results[s-1]&&0!=s&&!e.stepList[s-1].stepModule.response.value},on:{click:function(t){return e.handleExecute(a.field,s)}}},[e._v(e._s(a.buttonLabel))])],1)]):e._e(),"button"!=a.stepModule.response.style?t(v["a"],{ref:"rightForm"+s,refInFor:!0},[t(b["a"],{attrs:{"no-gutters":""}},[e._l(a.stepModule.variables,(function(a,s){return[a.is_show?t(m["a"],{key:a.key+s,staticStyle:{padding:"0 12px 0 0"},attrs:{cols:"text"!=a.style?4:6}},[t("iShowInput",{attrs:{form:a,right_show:e.right_show}})],1):e._e()]})),e._l(a.variables,(function(a,s){return[a.is_show?t(m["a"],{key:a.key+s,staticStyle:{padding:"0 12px 0 0"},attrs:{cols:"text"!=a.style?4:6}},[t("iShowInput",{attrs:{form:a,right_show:e.right_show}})],1):e._e()]}))],2)],1):e._e(),t("div",[a.stepModule.response.isShow&&"input"==a.stepModule.response.style?t(p["a"],{attrs:{clearable:"",outlined:""},model:{value:a.stepModule.response.value,callback:function(t){e.$set(a.stepModule.response,"value",t)},expression:"item.stepModule.response.value"}}):e._e(),a.stepModule.response.isShow&&"text"==a.stepModule.response.style?t(E["a"],{attrs:{rows:10,outlined:""},model:{value:a.stepModule.response.value,callback:function(t){e.$set(a.stepModule.response,"value",t)},expression:"item.stepModule.response.value"}}):e._e(),a.stepModule.response.isShow&&"img"==a.stepModule.response.style?t("div",[null==a.stepModule.response.value||0==a.stepModule.response.value.length?t("div",{staticStyle:{height:"100px",border:"1px solid #ccc","margin-bottom":"20px"}}):e._e(),a.stepModule.response.value&&0!=a.stepModule.response.value.length?t("div",e._l(a.stepModule.response.value,(function(e,a){return t("el-image",{key:a,staticStyle:{width:"100px",height:"100px",margin:"5px 0 0 5px"},attrs:{"preview-src-list":[e.url],src:e.url,fit:"cover"}})})),1):e._e()]):e._e(),"button"==a.stepModule.response.style&&"text"==a.stepModule.response.type?t("el-button",{staticStyle:{width:"100%",height:"60px","font-size":"20px",display:"block",margin:"0 auto"},attrs:{type:"primary",disabled:0!=s&&"success"!=e.results[s-1]&&0!=s&&!e.stepList[s-1].stepModule.response.value},on:{click:function(t){return e.handleExecute(a.field,s)}}},[e._v(e._s(a.label))]):e._e(),"button"==a.stepModule.response.style&&"copy"==a.stepModule.response.type?t("el-button",{staticStyle:{width:"100%",height:"60px","font-size":"20px",display:"block",margin:"0 auto"},attrs:{type:"primary",disabled:0!=s&&"success"!=e.results[s-1]&&0!=s&&!e.stepList[s-1].stepModule.response.value},on:{click:e.handleCopy}},[e._v(e._s(a.label))]):e._e()],1)],1)}))],2)],1)],1)],1),t("step-configuration",{ref:"configurations",on:{handleSaves:e.setConfigurations}}),t(h["a"],{attrs:{width:"410"},model:{value:e.dialog,callback:function(t){e.dialog=t},expression:"dialog"}},[t(o["a"],{staticStyle:{"padding-top":"20px"},attrs:{color:"#25293c"}},[t(n["c"],{staticClass:"text-h6"},[e._v(" "+e._s(e.$t("templateModal.reconfirm"))+" ")]),t(n["a"],[t(g["a"]),t(l["a"],{staticStyle:{"text-transform":"none"},attrs:{text:""},on:{click:function(t){e.dialog=!1}}},[e._v(e._s(e.$t("templateModal.cancel")))]),t(l["a"],{staticStyle:{"text-transform":"none"},attrs:{color:"primary",text:""},on:{click:e.handleDel}},[e._v(e._s(e.$t("templateModal.save1")))])],1)],1)],1)],1),t(D["a"],{attrs:{"z-index":9999,value:e.configLoading}},[t(T["a"],{attrs:{indeterminate:"",size:"64"}})],1)],1)},j=[],V=a("f159"),A=V["a"],N=(a("2721"),a("e607")),q=Object(N["a"])(A,R,j,!1,null,"e425a684",null),U=q.exports,F=a("365c"),K=a("7736"),B={data(){return{queryParams:{current:1,limit:1e4},open:!1,templateList:[],createList:{}}},components:{createModal:U},created(){this.getTemplateList(),this.getConfigList()},methods:{...Object(K["b"])(["getVariablesKey"]),getTemplateList(){Object(F["g"])(this.queryParams).then(e=>{this.templateList=e.data.list})},getConfigList(){Object(F["d"])().then(e=>{this.createList=e.data.templateType,this.getVariablesKey(e.data.variablesKey)})},textChange(e){clearInterval(this.timmer),this.timmer=setInterval(()=>{clearInterval(this.timmer),this.getTemplateList()},200)},handleAdd(){this.open=!0,this.$refs.createModals.totalData={info:{}},this.$refs.createModals.foundationList=[],this.$refs.createModals.stepList=[]},goDetail(e){this.$refs.createModals.templateType=void 0,this.funPublic(),this.$refs.createModals.getStepDataList(e.id),this.$refs.createModals.open=!0},createCode(e){this.open=!1,this.$refs.createModals.templateType=e,this.funPublic(),this.$refs.createModals.getStepDataList(),this.$refs.createModals.open=!0},funPublic(){this.$refs.createModals.foundcative="foundtion",this.$refs.createModals.loadings=[],this.$refs.createModals.results=[],this.$refs.createModals.tokenUsageList()}}},W=B,z=(a("24c7"),Object(N["a"])(W,x,k,!1,null,"38f821a3",null)),J=z.exports,G=a("c058"),H=function(){var e=this,t=e._self._c;return t("div",{staticClass:"main"},[e._m(0),t("div",{staticClass:"search"},[t(G["a"],{attrs:{"append-icon":"mdi-magnify",items:e.searchList,outlined:"","item-text":"label","item-value":"value",clearable:""}})],1),t("div",{staticClass:"templateGoods"},[t(b["a"],[t(m["a"],{attrs:{cols:4,sm:6,xs:12}},[t("div",{staticClass:"goods"})]),t(m["a"],{attrs:{cols:4,sm:6,xs:12}},[t("div",{staticClass:"goods"})]),t(m["a"],{attrs:{cols:4,sm:6,xs:12}},[t("div",{staticClass:"goods"})])],1)],1)])},Q=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"title"},[t("h1",[e._v("模板市场")]),t("h3",[e._v("Browse 42+ Best AI Code Assistant Tools")])])}],X={data(){return{searchList:[{label:"搜索1",value:1},{label:"搜索2",value:2},{label:"搜索3",value:3}]}}},Y=X,Z=(a("4203"),Object(N["a"])(Y,H,Q,!1,null,"418c3a6c",null)),ee=Z.exports,te={data(){return{api_key:"",totalData:{}}},components:{myselfTemplate:J,templateMark:ee},created(){this.setting()},methods:{setting(){Object(F["e"])().then(e=>{this.api_key=e.data.api_key})},openUrl(){window.open("https://www.mdc.ai/contact-us/")},handleSave(){Object(F["j"])({api_key:this.api_key}).then(e=>{e.status&&this.$message({type:"success",message:"更新成功",offset:52})})}}},ae=te,se=(a("22b1"),Object(N["a"])(ae,u,f,!1,null,"4aeec4b8",null)),ie=se.exports,le=a("47df"),oe=a.n(le),ne=(a("55ee"),a("1e09"),a("160d"));s["default"].use(K["a"]);let re={variablesKey:{}},ce={},de={getVariablesKey(e,t){e.variablesKey=t}},pe={},ue=new ne["a"]({storage:window.sessionStorage});var fe=new K["a"].Store({state:re,getters:ce,mutations:de,actions:pe,plugins:[ue.plugin]}),me=a("397c");s["default"].use(me["a"]);const he={locale:localStorage.getItem("lang")||"en",messages:{zh:a("9a9c"),en:a("76c4f")}};var ve=he,_e=a("9ab1");a("29d6");s["default"].use(_e["a"]);var be=new _e["a"]({theme:{dark:!0},icons:{iconfont:"mdi"}}),ge=a("e6ef"),ye=a.n(ge);s["default"].use(oe.a),s["default"].use(ye.a),s["default"].config.productionTip=!1,new s["default"]({render:e=>e(ie),store:fe,vuetify:be,i18n:ve}).$mount("#moredeal-aigc-dashboard")},5888:function(e,t,a){},6068:function(e,t,a){"use strict";var s=a("7332"),i=a("e39c"),l=a("df70"),o=function(){var e=this,t=e._self._c;return!e.is_show||e.form.is_show?t("div",["input"==e.form.style?t(i["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,"validate-on-blur":"",rules:[!e.is_show||!e.right_show||(t=>!!t||e.form.label+e.$t("myselfTemplateList.isRequire"))],placeholder:e.form.default?e.form.default.toString():e.form.default,clearable:"",label:e.form.label,outlined:""},model:{value:e.form.value,callback:function(t){e.$set(e.form,"value",t)},expression:"form.value"}}):e._e(),"text"==e.form.style?t(l["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,"validate-on-blur":"",rules:[!e.is_show||!e.right_show||(t=>!!t||e.form.label+e.$t("myselfTemplateList.isRequire"))],placeholder:e.form.default?e.form.default.toString():e.form.default,outlined:"",clearable:"",label:e.form.label},model:{value:e.form.value,callback:function(t){e.$set(e.form,"value",t)},expression:"form.value"}}):e._e(),"select"==e.form.style?t(s["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,"validate-on-blur":"",rules:[!e.is_show||!e.right_show||(t=>!!t||e.form.label+e.$t("myselfTemplateList.isRequire"))],placeholder:e.form.default?e.form.default.toString():e.form.default,items:e.form.options,"item-text":"label","item-value":"value",label:e.form.label,clearable:"",outlined:""},model:{value:e.form.value,callback:function(t){e.$set(e.form,"value",t)},expression:"form.value"}}):e._e()],1):e._e()},n=[],r={props:{form:{type:Object},is_show:{type:Boolean,default:!0},right_show:{type:Boolean,default:!0}}},c=r,d=a("e607"),p=Object(d["a"])(c,o,n,!1,null,null,null);t["a"]=p.exports},"6f4d":function(e,t,a){},"75d8":function(e,t,a){"use strict";var s=a("16b3"),i=a("3785"),l=a("3049"),o=a("1185"),n=a("6059"),r=a("eaf2"),c=a("15a6"),d=a("a872"),p=a("e39c"),u=a("e3b7"),f=a("92a2"),m=function(){var e=this,t=e._self._c;return t(r["a"],{ref:"drawer",staticStyle:{margin:"32px 0 0 160px"},attrs:{color:"#25293c",persistent:"",absolute:"",temporary:"",right:"",width:"70%","hide-overlay":""},model:{value:e.open,callback:function(t){e.open=t},expression:"open"}},[t("div",{staticClass:"pad20",staticStyle:{"padding-top":"0"}},[t(u["a"],{attrs:{color:"#25293c",elevation:"0"}},[t(f["a"],[e._v("Template Flow")]),t(d["a"]),t("el-button",{attrs:{size:"mini",icon:"el-icon-check",type:"primary"},on:{click:e.handleSave}},[e._v(e._s(e.$t("templateModal.save")))]),t("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(t){e.open=!1}}},[e._v("Back "),t("i",{staticClass:"el-icon-right"})])],1),e._l(e.stepList,(function(a,r){return t(s["a"],{key:r,staticClass:"marbottom20 pad20 padbottom30",attrs:{color:"#2f3349",elevation:"5"}},[t(n["a"],[t(c["a"],[t(l["a"],{staticStyle:{padding:"0 12px"},attrs:{cols:3}},[t(p["a"],{attrs:{"persistent-placeholder":"",label:e.$t("viewTemplate.title"),outlined:""},model:{value:a.label,callback:function(t){e.$set(a,"label",t)},expression:"step.label"}})],1),t(l["a"],{staticStyle:{padding:"0 12px"},attrs:{cols:9}},[t(p["a"],{attrs:{"persistent-placeholder":"",label:e.$t("viewTemplate.desc"),outlined:""},model:{value:a.desc,callback:function(t){e.$set(a,"desc",t)},expression:"step.desc"}})],1)],1)],1),"button"!=a.stepModule.response.style?t(i["c"],[e._v(e._s(e.$t("templateModal.Variable")))]):e._e(),e._l(a.stepModule.variables,(function(e,a){return t("defaultInput",{key:a,attrs:{form:e}})})),t(c["a"],{staticStyle:{"margin-top":"10px"}},e._l(a.variables,(function(e,a){return t(l["a"],{key:a,staticStyle:{padding:"0 10px"},attrs:{cols:3}},[t("defaultInput",{staticClass:"edit_list",attrs:{form:e}})],1)})),1),"button"!=a.stepModule.response.style?t(o["a"],{staticStyle:{margin:"10px 0 0 0"}}):e._e(),e._l(a.stepModule.variables,(function(s,i){return t("div",{key:i+"no",staticStyle:{cursor:"pointer",display:"inline-block"},on:{click:function(t){return e.handleEdit(s,r,i,!1,a)}}},[t("el-button",{staticClass:"el_edit",attrs:{type:"info"}},[t("div",{staticClass:"label"},[e._v(e._s(s.label))]),t("div",{staticClass:"els"},[e._v(e._s(s.style))])])],1)})),e._l(a.variables,(function(s,i){return t("el-button",{key:i+"yes",staticClass:"el_edit",attrs:{type:"info"},on:{click:function(t){return e.handleEdit(s,r,i,!0,a)}}},[t("div",{staticClass:"label"},[e._v(e._s(s.label))]),t("div",{staticClass:"els"},[e._v(e._s(s.style))])])})),t("br"),"button"!=a.stepModule.response.style?t("el-button",{staticStyle:{margin:"10px 0 0 0px"},attrs:{icon:"el-icon-plus",type:"primary"},on:{click:function(t){return e.addVariable(a)}}},[e._v(e._s(e.$t("viewTemplate.addVariables")))]):e._e()],2)})),t("edit",{ref:"edits",on:{deleteForms:e.deleteForm,editSaveTwos:e.editSaveTwo,editSaves:e.editSave}})],2)])},h=[],v=(a("5edb"),a("ec0b")),_=a("7332"),b=a("df70"),g=function(){var e=this,t=e._self._c;return t("div",["input"==e.form.style?t(p["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,clearable:"",label:e.form.label,outlined:""},model:{value:e.form.default,callback:function(t){e.$set(e.form,"default",t)},expression:"form.default"}}):e._e(),"text"==e.form.style?t(b["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,outlined:"",clearable:"",label:e.form.label},model:{value:e.form.default,callback:function(t){e.$set(e.form,"default",t)},expression:"form.default"}}):e._e(),"select"==e.form.style?t(_["a"],{attrs:{"persistent-placeholder":"","persistent-hint":"",hint:e.form.desc,items:e.form.options,"item-text":"label","item-value":"value",label:e.form.label,clearable:"",outlined:""},model:{value:e.form.default,callback:function(t){e.$set(e.form,"default",t)},expression:"form.default"}}):e._e()],1)},y=[],x={props:{form:{type:Object}}},k=x,$=a("e607"),S=Object($["a"])(k,g,y,!1,null,null,null),w=S.exports,M={data(){return{open:!1,stepList:[],noVip:!0,prompt:"Write an article about"}},created(){addEventListener("keydown",e=>{27==e.keyCode&&this.open&&0==this.$refs.edits.opens&&this.$set(this,"open",!1)})},components:{edit:v["a"],defaultInput:w},methods:{handleEdit(e,t,a,s,i){this.$refs.edits.opens=!0,this.$refs.edits.flag=s,this.$refs.edits.coordinates={stepIndex:t,index:a},this.$refs.edits.form=JSON.parse(JSON.stringify(e)),this.$refs.edits.$refs.editForm.resetValidation(),this.$refs.edits.varbles=i.label.trim().replace(/ /g,"_").toUpperCase()},addVariable(e){e.variables.push({key:this.$store.state.variablesKey.input,field:"Variable_"+e.variables.length,label:"Variable "+e.variables.length,desc:"",options:[],is_show:!0,style:"input"})},deleteForm(e){this.stepList[e.stepIndex].variables.splice(e.index,1)},editSave(e,t){this.$set(this.stepList[t.stepIndex].variables,t.index,e)},editSaveTwo(e,t){this.$set(this.stepList[t.stepIndex].stepModule.variables,t.index,e)},handleSave(){this.stepList.map(e=>{e.field=e.label.trim().replace(/ /g,"_").toUpperCase()}),this.$emit("handleSaves",this.stepList)}}},C=M,L=(a("bc1b"),Object($["a"])(C,m,h,!1,null,"76b37c3e",null));t["a"]=L.exports},"76c4":function(e,t,a){},"76c4f":function(e,t){e.exports={tabs:{myTemplate:"My Template",templateMarket:"Template Market",configuration:"Configuration"},myselfTemplateList:{templateName:"Template Name",pleaseName:"Please enter a template name",templateScene:"Template Scene",pleaseScene:"Please enter template scenario",createTemplate:"Start Template",type:"template Type",isRequire:"is require"},advanced:{version:"Template Version",key:"Template Key",scene:"Template Scene"},setting:{pleaseInput:"Please enter api_key",save:"Save api_key"},templateModal:{copy:"Click to Copy",title:"Template Library",Variable:"Variable",configuration:"See the steps to configure the",foundation:"GENEROL",model:"ADVANCED",templateName:"Template Name",pleaseName:"Please enter a template name",templateDesc:"Template Desc",pleaseDesc:"Please enter template Desc",execute:"Execute",allExecute:"All Execution",create:"Create Article",reconfirm:"Please confirm again whether to delete",cancel:"Cancel",save:"save",save1:"Confirm",return:"Return Template"},viewTemplate:{title:"Step Title",desc:"Step Desc",type:"Step Type",delete:"Delete",copy:"Copy",variables:"Variables",addVariables:"Add Variables",editVariables:"Edit Variables",options:"Option",addOption:"Add Option"},tips:{Please:"Please select",notOpen:"Not open yet",edit:"Successful Operation"}}},"938f":function(e,t,a){},"9a9c":function(e,t){e.exports={tabs:{myTemplate:"我的模板",templateMarket:"模板市场",configuration:"配置"},myselfTemplateList:{templateName:"模板名称",pleaseName:"请输入模板名称",templateScene:"模板场景",pleaseScene:"请输入模板场景",createTemplate:"新建模板",type:"模板类型",isRequire:"是必填"},advanced:{version:"模板版本号",key:"模板key",scene:"模板场景"},setting:{pleaseInput:"请输入 api_key",save:"保存 api_key"},templateModal:{copy:"点击复制",title:"模板使用",Variable:"变量",configuration:"查看步骤配置",foundation:"基础",model:"模型",templateName:"模板名称",pleaseName:"请输入模板名称",templateDesc:"模板描述",pleaseDesc:"请输入模板描述",execute:"执行",allExecute:"全部执行",create:"创建文章",reconfirm:"请再次确认是否要删除",cancel:"取 消",save:"保 存",return:"返回模板"},viewTemplate:{title:"步骤标题",desc:"步骤描述",type:"步骤类型",delete:"删除",copy:"拷贝",variables:"变量",addVariables:"增加变量",editVariables:"编辑变量",options:"选项",addOption:"增加选项"},tips:{Please:"请选择",notOpen:"暂未开放",edit:"操作成功"}}},bc1b:function(e,t,a){"use strict";a("6f4d")},dc14:function(e,t,a){},dc8e:function(e,t,a){"use strict";a("76c4")},ec0b:function(e,t,a){"use strict";var s=a("a04a"),i=a("6059"),l=a("7ff8"),o=a("34ae"),n=a("96b0"),r=a("2708"),c=a("8e80"),d=a("eaf2"),p=a("7332"),u=a("9dec"),f=a("e39c"),m=a("df70"),h=a("e4c8"),v=function(){var e=this,t=e._self._c;return t(d["a"],{attrs:{color:"#25293c","hide-overlay":"",app:"",temporary:"",right:"",width:"500"},model:{value:e.opens,callback:function(t){e.opens=t},expression:"opens"}},[t("div",{staticClass:"mainEdit"},[t("div",{staticClass:"editVariable"},[t("div",{staticClass:"title"},[t("div",{staticClass:"titles"},[e._v(e._s(e.$t("viewTemplate.editVariables")))]),t("div",{staticClass:"subtitles"},[e._v("Add this variable to the prompt like this:")]),t(h["a"],{attrs:{top:""},scopedSlots:e._u([{key:"activator",fn:function({on:a}){return[t("div",e._g({staticClass:"subtitles",staticStyle:{cursor:"pointer"},on:{click:function(t){return e.copys(e.varbles,e.form.field)}}},a),[e._v("{STEP."+e._s(e.varbles)+"."),e.form.field?t("span",[e._v(e._s(e.form.field.toUpperCase()))]):e._e(),e._v("}")])]}}])},[t("span",[e._v(e._s(e.$t("templateModal.copy")))])])],1),t("div",[e.flag?t(c["a"],{attrs:{"offset-y":""},scopedSlots:e._u([{key:"activator",fn:function({on:a,attrs:i}){return[t(s["a"],e._g(e._b({staticStyle:{margin:"0 5px"},attrs:{fab:"",small:"",text:""}},"v-btn",i,!1),a),[t(l["a"],[e._v("mdi-dots-vertical")])],1)]}}],null,!1,1130029260)},[t(o["a"],{attrs:{dense:""}},[t(n["a"],{attrs:{link:""},on:{click:e.deleteForm}},[t(l["a"],{attrs:{color:"error"}},[e._v("mdi-delete")]),t(r["b"],[e._v(e._s(e.$t("viewTemplate.delete")))])],1)],1)],1):e._e(),t(s["a"],{staticStyle:{"margin-right":"10px"},attrs:{color:"blue darken-1"},on:{click:e.goBack}},[e._v(" "+e._s(e.$t("templateModal.save")))])],1)]),t(i["a"],{ref:"editForm"},[t(f["a"],{attrs:{"persistent-placeholder":"","validate-on-blur":"",rules:[t=>!!t||"field"+e.$t("myselfTemplateList.isRequire")],disabled:!e.flag,clearable:"",label:"field",outlined:""},nativeOn:{keydown:function(t){return e.keydown(t)}},model:{value:e.form.field,callback:function(t){e.$set(e.form,"field",t)},expression:"form.field"}}),t(f["a"],{attrs:{"persistent-placeholder":"","validate-on-blur":"",rules:[t=>!!t||"label"+e.$t("myselfTemplateList.isRequire")],disabled:!e.flag,clearable:"",label:"label",outlined:""},model:{value:e.form.label,callback:function(t){e.$set(e.form,"label",t)},expression:"form.label"}}),t(m["a"],{attrs:{"persistent-placeholder":"",disabled:!e.flag,clearable:"",label:"desc",outlined:""},model:{value:e.form.desc,callback:function(t){e.$set(e.form,"desc",t)},expression:"form.desc"}}),t(p["a"],{attrs:{"persistent-placeholder":"","validate-on-blur":"",rules:[t=>!!t||"type"+e.$t("myselfTemplateList.isRequire")],disabled:!e.flag,items:e.option,"item-text":"label","item-value":"value",label:"type",outlined:""},on:{change:e.onChange},model:{value:e.form.style,callback:function(t){e.$set(e.form,"style",t)},expression:"form.style"}}),t(u["a"],{attrs:{label:"is_show"},model:{value:e.form.is_show,callback:function(t){e.$set(e.form,"is_show",t)},expression:"form.is_show"}}),"select"==e.form.style?t("div",[e._l(e.form.options,(function(a,s){return t("div",{key:s,staticClass:"el_value"},[t(f["a"],{attrs:{"persistent-placeholder":"","validate-on-blur":"",rules:[t=>!!t||"label"+e.$t("myselfTemplateList.isRequire")],clearable:"",label:"label",outlined:""},model:{value:a.label,callback:function(t){e.$set(a,"label",t)},expression:"item.label"}}),t("div",{staticStyle:{margin:"0 10px"}},[e._v("-")]),t(f["a"],{attrs:{"persistent-placeholder":"","validate-on-blur":"",rules:[t=>!!t||"value"+e.$t("myselfTemplateList.isRequire")],clearable:"",label:"value",outlined:""},model:{value:a.value,callback:function(t){e.$set(a,"value",t)},expression:"item.value"}}),t("div",{staticClass:"el-icon-delete",on:{click:function(t){return e.delSele(s)}}})],1)})),t("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:e.handleAdd}},[e._v(e._s(e.$t("viewTemplate.addOption")))])],2):e._e()],1)],1)])},_=[],b=(a("5edb"),{data(){return{opens:!1,flag:!0,coordinates:{},varbles:"",form:{},option:[{label:"input",value:"input"},{label:"textarea",value:"text"},{label:"select",value:"select",options:[]}]}},created(){addEventListener("keydown",e=>{27==e.keyCode&&this.opens&&this.$set(this,"opens",!1)})},methods:{goBack(){this.$refs.editForm.validate()&&(this.flag?this.$emit("editSaves",this.form,this.coordinates):this.$emit("editSaveTwos",this.form,this.coordinates),this.$set(this,"opens",!1))},deleteForm(){this.$emit("deleteForms",this.coordinates),this.opens=!1},onChange(e){"input"==e?this.form.key=this.$store.state.variablesKey.input:"text"==e?this.form.key=this.$store.state.variablesKey.text:"select"==e&&(this.form.key=this.$store.state.variablesKey.select)},handleAdd(){this.form.options.push({label:"label",value:"value"})},delSele(e){this.form.options.splice(e,1)},copys(e,t){let a="{STEP."+e+"."+t.toUpperCase()+"}";this.$copyText(a).then(e=>{this.$message({type:"success",message:"Copy Success",offset:52})})},keydown(e){32==e.keyCode&&(e.returnValue=!1)}}}),g=b,y=(a("2b97"),a("e607")),x=Object(y["a"])(g,v,_,!1,null,"4d5199e3",null);t["a"]=x.exports},f159:function(module,__webpack_exports__,__webpack_require__){"use strict";var _components_stepConfiguration_index_vue__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("75d8"),_variable_vue__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("1fb6"),_api__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("365c"),_components_iShowInput_vue__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("6068");__webpack_exports__["a"]={data(){return{open:!1,dialog:!1,right_show:!1,foundcative:0,loading:!1,saveLoading:!1,configLoading:!1,loadings:[],results:[],templateType:void 0,foundationList:[],tokenList:{},stepList:[],totalData:{}}},created(){addEventListener("keydown",e=>{27==e.keyCode&&this.open&&0==this.$refs.configurations.open&&this.$set(this,"open",!1)})},components:{stepConfiguration:_components_stepConfiguration_index_vue__WEBPACK_IMPORTED_MODULE_0__["a"],iShowInput:_components_iShowInput_vue__WEBPACK_IMPORTED_MODULE_3__["a"],variable:_variable_vue__WEBPACK_IMPORTED_MODULE_1__["a"]},methods:{getStepDataList(e){this.loading=!0,Object(_api__WEBPACK_IMPORTED_MODULE_2__["f"])({tmpId:e,tmpCode:this.templateType}).then(e=>{e.status?(this.totalData=e.data,this.foundationList=this.totalData.info.variables,this.stepList=this.totalData.info.steps):(this.foundationList=[],this.stepList=[]),this.loading=!1})},tokenUsageList(){Object(_api__WEBPACK_IMPORTED_MODULE_2__["h"])().then(e=>{e.success&&(this.tokenList=e.data)})},setVariable(e){this.foundationList=e,this.totalData.info.variables=e,this.foundcative="foundtion"},tabClick(e){e.label==this.$t("templateModal.Variable")&&(this.$refs.variables.variablesList=JSON.parse(JSON.stringify(this.totalData.info.variables)))},setConfigurations(e){this.configLoading=!0,this.stepList=e,this.totalData.info.steps=e,this.handleSave(!1)},handleDel(){Object(_api__WEBPACK_IMPORTED_MODULE_2__["b"])({tmpId:this.totalData.id}).then(e=>{e.status&&(this.$message({type:"success",message:"删除成功",offset:52}),this.$parent.getTemplateList(),this.open=!1)})},configuration(){this.$refs.configurations.open=!0,this.$refs.configurations.stepList=JSON.parse(JSON.stringify(this.stepList))},handleExecute(stepField,index,flag){this.right_show=!0,this.$nextTick(()=>{eval("this.$refs.rightForm"+index)[0].validate()&&(this.$set(this.loadings,index,!0),!this.totalData.id&&(this.totalData.type=this.templateType),Object(_api__WEBPACK_IMPORTED_MODULE_2__["c"])({tmpId:this.totalData.id,stepField:stepField,templateModel:this.totalData}).then(e=>{if(this.tokenUsageList(),e.data.status){let t=e.data.stepResponse;t.value.trim(),this.totalData.info.steps[index].stepModule.response=t,this.$set(this.loadings,index,!1),this.$set(this.results,index,"success"),flag&&index<this.totalData.info.steps.length-1&&this.handleExecute(this.totalData.info.steps[index+1].field,index+1,!0),this.$message({type:"success",message:"success",offset:52})}else{this.$message({type:"warning",message:e.data.message,offset:52}),this.$set(this.results,index,"error");for(let e=index;e<this.totalData.info.steps.length;e++)this.$set(this.loadings,e,!1)}}).catch(()=>{this.$set(this.results,index,"error");for(let e=index;e<this.totalData.info.steps.length;e++)this.$set(this.loadings,e,!1)}))})},allExecute(){this.right_show=!0;let rightResult=!0;this.totalData.info.steps.map((item,index)=>{"button"!=item.stepModule.response.style&&(eval("this.$refs.rightForm"+index)[0].validate()||(rightResult=!1))}),rightResult&&(this.totalData.info.steps.map((e,t)=>{this.$set(this.loadings,t,!0)}),this.totalData.info.steps[0],this.handleExecute(this.totalData.info.steps[0].field,0,!0))},handleUrl(){},handleCopy(){let e="";this.totalData.info.steps.map(t=>{"button"!=t.stepModule.response.style&&(e+="\n          \n          "+t.stepModule.response.value)}),this.$copyText(e).then(e=>{this.$message.success("Copy Success")})},handleBack(){this.$set(this,"open",!1),this.$refs.leftForm.resetValidation(),this.totalData.info&&this.totalData.info.steps.map((item,index)=>{"button"!=item.stepModule.response.style&&eval("this.$refs.rightForm"+index)[0].resetValidation()})},handleSave(flag){this.saveLoading=!0,this.right_show=!1,this.foundcative=0;let rightResult=!0;this.totalData.info.steps.map((item,index)=>{"button"!=item.stepModule.response.style&&(eval("this.$refs.rightForm"+index)[0].validate()||(rightResult=!1))});let leftResult=this.$refs.leftForm.validate();leftResult&&rightResult?this.totalData.id||0===this.totalData.id?Object(_api__WEBPACK_IMPORTED_MODULE_2__["i"])(this.totalData).then(e=>{this.saveLoading=!1,this.configLoading=!1,this.$refs.configurations.open=!1,e.status&&(this.open=!flag,this.$parent.getTemplateList(),this.$message({type:"success",message:this.$t("tips.edit"),offset:52}))}):(this.totalData.type=this.templateType,Object(_api__WEBPACK_IMPORTED_MODULE_2__["a"])(this.totalData).then(e=>{this.saveLoading=!1,this.configLoading=!1,this.$refs.configurations.open=!1,e.status&&(flag?this.open=!1:(this.totalData.id=e.data,this.open=!0),this.$parent.getTemplateList(),this.$message({type:"success",message:this.$t("tips.edit"),offset:52}))})):(this.configLoading=!1,this.saveLoading=!1)},contact(){window.open("https://www.mdc.ai/contact-us/")}}}}});
Note: See TracChangeset for help on using the changeset viewer.