<?php
$set = Dever::input('set');
if (!$set) {
    $set = Dever::input('field');
}
if (is_string($set)) {
    $set = Dever::json_decode(html_entity_decode($set));
}
$info_data_id = $set['info_data_id'] ?? false;
$upload = 1;
$upload_show = true;
if ($info_data_id) {
    $info = Dever::db('info_data', 'source')->find($info_data_id);
    if ($info['type'] == 1) {
        $upload_show = false;
    } elseif ($info['type'] == 2) {
        $upload = 1;
    } elseif ($info['type'] == 3) {
        $upload = 3;
    } elseif ($info['type'] == 4) {
        $upload = 2;
    }
}
return array
(
    'source' => 'source/info_data_content',
    'update' => array
    (
        'control' => array
        (
            'ai_prompt' => array
            (
                'ai_prompt_type' => 1,
            ),
            'prompt' => array
            (
                'ai_prompt_type' => 2,
            ),
        ),
        //'desc' => '原创声明：',
        'field'    => array
        (
            'info_data_id' => array
            (
                'type' => 'hidden',
            ),
            'name' => '',
            'ai_platform' => array
            (
                'name' => '智能平台',
                'type' => 'cascader',
                'option'    => 'Dever::call("ai/manage.getPlatform")',
                'remote_default' => false,
                //'rules' => true,
            ),
            'ai_prompt_type' => array
            (
                'type' => 'radio',
                'control' => true,
            ),
            'ai_prompt' => array
            (
                'type' => 'cascader',
                'option'    => 'Dever::call("ai/manage.getPrompt")',
                'remote_default' => false,
            ),
            'prompt' => array
            (
                //'rules' => true,
                'type' => 'textarea',
                'autosize' => array('minRows' => 5),
                'desc' => '将根据素材配置以及提示词自动生成素材的文案，生成进度请查看版本信息，提示词可以为空，点击确定将启动生成任务',
            ),
            'content' => array
            (
                'name' => '文案',
                //'rules' => true,
                'type' => 'editor',
                'editorMenu' => array
                (
                    'uploadImage' => 1,
                    'uploadVideo' => 3,
                ),
            ),
        ),
        # update提交之后的操作
        'end' => 'source/content.update',
    ),
);