From 1ca58606dacd2a22498872c02038d9c06af991e1 Mon Sep 17 00:00:00 2001 From: GeekMaster Date: Tue, 9 Sep 2025 18:05:51 +0800 Subject: [PATCH] optimize jimeng AI task params build --- api/service/jimeng/service.go | 22 +- api/service/migration_service.go | 10 +- api/store/model/jimeng_job.go | 32 +- api/store/vo/jimeng_job.go | 32 +- web/src/components/ImageUpload.vue | 16 +- web/src/store/data/jimeng_data.js | 632 +++++++++++++++++++++++++++++ web/src/store/jimeng.js | 219 ++++++++++ web/src/views/Jimeng.vue | 169 ++++++++ 8 files changed, 1084 insertions(+), 48 deletions(-) create mode 100644 web/src/store/data/jimeng_data.js diff --git a/api/service/jimeng/service.go b/api/service/jimeng/service.go index ca80c712..48ddd288 100644 --- a/api/service/jimeng/service.go +++ b/api/service/jimeng/service.go @@ -114,16 +114,16 @@ func (s *Service) CreateTask(userId uint, req *CreateTaskRequest) (*model.Jimeng // 创建任务记录 job := &model.JimengJob{ - UserId: userId, - TaskId: taskId, - Type: req.Type, - ReqKey: req.ReqKey, - Prompt: req.Prompt, - TaskParams: string(paramsJson), - Status: model.JMTaskStatusInQueue, - Power: req.Power, - CreatedAt: time.Now(), - UpdatedAt: time.Now(), + UserId: userId, + TaskId: taskId, + Type: req.Type, + ReqKey: req.ReqKey, + Prompt: req.Prompt, + Params: string(paramsJson), + Status: model.JMTaskStatusInQueue, + Power: req.Power, + CreatedAt: time.Now(), + UpdatedAt: time.Now(), } // 保存到数据库 @@ -187,7 +187,7 @@ func (s *Service) ProcessTask(jobId uint) error { func (s *Service) buildTaskRequest(job *model.JimengJob) (*SubmitTaskRequest, error) { // 解析任务参数 var params map[string]any - if err := json.Unmarshal([]byte(job.TaskParams), ¶ms); err != nil { + if err := json.Unmarshal([]byte(job.Params), ¶ms); err != nil { return nil, fmt.Errorf("parse task params failed: %w", err) } diff --git a/api/service/migration_service.go b/api/service/migration_service.go index 4db9ea1e..2eeb24ac 100644 --- a/api/service/migration_service.go +++ b/api/service/migration_service.go @@ -159,8 +159,16 @@ func (s *MigrationService) MigrateConfigContent() error { // 数据表迁移 func (s *MigrationService) TableMigration() { + + // v4.2.7 数据表迁移 + if s.db.Migrator().HasColumn(&model.JimengJob{}, "task_params") { + s.db.Migrator().RenameColumn(&model.JimengJob{}, "task_params", "params") + } + // 新数据表 - s.db.AutoMigrate(&model.Moderation{}) + if !s.db.Migrator().HasTable(&model.Moderation{}) { + s.db.AutoMigrate(&model.Moderation{}) + } // 订单字段整理 if s.db.Migrator().HasColumn(&model.Order{}, "pay_type") { diff --git a/api/store/model/jimeng_job.go b/api/store/model/jimeng_job.go index 624cd90c..4c7c7046 100644 --- a/api/store/model/jimeng_job.go +++ b/api/store/model/jimeng_job.go @@ -6,22 +6,22 @@ import ( // JimengJob 即梦AI任务模型 type JimengJob struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int(11);not null;index;comment:用户ID" json:"user_id"` - TaskId string `gorm:"column:task_id;type:varchar(100);not null;index;comment:任务ID" json:"task_id"` - Type JMTaskType `gorm:"column:type;type:varchar(50);not null;comment:任务类型" json:"type"` - ReqKey string `gorm:"column:req_key;type:varchar(100);comment:请求Key" json:"req_key"` - Prompt string `gorm:"column:prompt;type:text;comment:提示词" json:"prompt"` - TaskParams string `gorm:"column:task_params;type:text;comment:任务参数JSON" json:"task_params"` - ImgURL string `gorm:"column:img_url;type:varchar(1024);comment:图片或封面URL" json:"img_url"` - VideoURL string `gorm:"column:video_url;type:varchar(1024);comment:视频URL" json:"video_url"` - RawData string `gorm:"column:raw_data;type:text;comment:原始API响应" json:"raw_data"` - Progress int `gorm:"column:progress;type:int;default:0;comment:进度百分比" json:"progress"` - Status JMTaskStatus `gorm:"column:status;type:varchar(20);default:'pending';comment:任务状态" json:"status"` - ErrMsg string `gorm:"column:err_msg;type:varchar(1024);comment:错误信息" json:"err_msg"` - Power int `gorm:"column:power;type:int(11);default:0;comment:消耗算力" json:"power"` - CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;comment:创建时间" json:"created_at"` - UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null;comment:更新时间" json:"updated_at"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;index;comment:用户ID" json:"user_id"` + TaskId string `gorm:"column:task_id;type:varchar(100);not null;index;comment:任务ID" json:"task_id"` + Type JMTaskType `gorm:"column:type;type:varchar(50);not null;comment:任务类型" json:"type"` + ReqKey string `gorm:"column:req_key;type:varchar(100);comment:请求Key" json:"req_key"` + Prompt string `gorm:"column:prompt;type:text;comment:提示词" json:"prompt"` + Params string `gorm:"column:params;type:text;comment:任务参数JSON" json:"params"` + ImgURL string `gorm:"column:img_url;type:varchar(1024);comment:图片或封面URL" json:"img_url"` + VideoURL string `gorm:"column:video_url;type:varchar(1024);comment:视频URL" json:"video_url"` + RawData string `gorm:"column:raw_data;type:text;comment:原始API响应" json:"raw_data"` + Progress int `gorm:"column:progress;type:int;default:0;comment:进度百分比" json:"progress"` + Status JMTaskStatus `gorm:"column:status;type:varchar(20);default:'pending';comment:任务状态" json:"status"` + ErrMsg string `gorm:"column:err_msg;type:varchar(1024);comment:错误信息" json:"err_msg"` + Power int `gorm:"column:power;type:int(11);default:0;comment:消耗算力" json:"power"` + CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;comment:创建时间" json:"created_at"` + UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null;comment:更新时间" json:"updated_at"` } // JMTaskStatus 任务状态 diff --git a/api/store/vo/jimeng_job.go b/api/store/vo/jimeng_job.go index 2f1d869d..82749dbf 100644 --- a/api/store/vo/jimeng_job.go +++ b/api/store/vo/jimeng_job.go @@ -4,20 +4,20 @@ import "geekai/store/model" // JimengJob 即梦AI任务VO type JimengJob struct { - Id uint `json:"id"` - UserId uint `json:"user_id"` - TaskId string `json:"task_id"` - Type model.JMTaskType `json:"type"` - ReqKey string `json:"req_key"` - Prompt string `json:"prompt"` - TaskParams string `json:"task_params"` - ImgURL string `json:"img_url"` - VideoURL string `json:"video_url"` - RawData string `json:"raw_data"` - Progress int `json:"progress"` - Status model.JMTaskStatus `json:"status"` - ErrMsg string `json:"err_msg"` - Power int `json:"power"` - CreatedAt int64 `json:"created_at"` // 时间戳 - UpdatedAt int64 `json:"updated_at"` // 时间戳 + Id uint `json:"id"` + UserId uint `json:"user_id"` + TaskId string `json:"task_id"` + Type model.JMTaskType `json:"type"` + ReqKey string `json:"req_key"` + Prompt string `json:"prompt"` + Params map[string]any `json:"params"` + ImgURL string `json:"img_url"` + VideoURL string `json:"video_url"` + RawData string `json:"raw_data"` + Progress int `json:"progress"` + Status model.JMTaskStatus `json:"status"` + ErrMsg string `json:"err_msg"` + Power int `json:"power"` + CreatedAt int64 `json:"created_at"` // 时间戳 + UpdatedAt int64 `json:"updated_at"` // 时间戳 } diff --git a/web/src/components/ImageUpload.vue b/web/src/components/ImageUpload.vue index 26163cd8..c73d44ff 100644 --- a/web/src/components/ImageUpload.vue +++ b/web/src/components/ImageUpload.vue @@ -78,7 +78,7 @@ :show-file-list="false" :http-request="handleUpload" :multiple="multiple" - accept="image/*" + :accept="accept" class="uploader" :limit="maxCount" > @@ -86,7 +86,7 @@
拖拽图片到此处,或 点击上传
@@ -123,6 +123,14 @@ const props = defineProps({ type: Number, default: 1, }, + maxSize: { + type: Number, + default: 5, + }, + accept: { + type: String, + default: '.png,.jpg,.jpeg', + }, }) const emit = defineEmits(['update:modelValue', 'upload-success']) @@ -161,8 +169,8 @@ const handleUpload = async (uploadFile) => { } // 检查文件大小 (5MB) - if (file.size > 5 * 1024 * 1024) { - ElMessage.error('图片大小不能超过 5MB') + if (file.size > props.maxSize * 1024 * 1024) { + ElMessage.error(`图片大小不能超过 ${props.maxSize}MB`) return } diff --git a/web/src/store/data/jimeng_data.js b/web/src/store/data/jimeng_data.js new file mode 100644 index 00000000..64558cf2 --- /dev/null +++ b/web/src/store/data/jimeng_data.js @@ -0,0 +1,632 @@ +export const paramsMap = { + image: [ + { + name: '图片 2.1 文生图', + version: '2.1', + label: '平面绘感强,可生成文字海报', + key: 'jimeng_high_aes_general_v21_L', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入提示词', + info: '用于生成图像的提示词 ,中英文均可输入', + }, + { + name: 'size', + type: 'select', + required: true, + placeholder: '请选择尺寸', + label: '图片尺寸', + options: [ + { + label: '21:9 (1195 * 512)', + value: '1195x512', + }, + { + label: '16:9 (1024 * 576)', + value: '1024x576', + }, + { + label: '3:2 (1024 * 682)', + value: '1024x682', + }, + { + label: '4:3 (1024 * 768)', + value: '1024x768', + }, + { + label: '1:1 (1024 * 1024)', + value: '1024x1024', + }, + { + label: '3:4 (768 * 1024)', + value: '768x1024', + }, + { + label: '2:3 (682 * 1024)', + value: '682x1024', + }, + { + label: '9:16 (576 * 1024)', + value: '576x1024', + }, + ], + }, + { + name: 'use_pre_llm', + type: 'boolean', + required: true, + label: '开启文本扩写', + info: '开启后,系统会自动扩写提示词,提高生成质量', + value: true, + }, + ], + }, + { + name: '图片 3.0 文生图', + version: '3.0', + label: '影视质感,文字更准,直出2k高清图', + key: 'jimeng_t2i_v30', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入提示词', + info: '用于生成图像的提示词 ,中英文均可输入', + }, + { + name: 'size', + type: 'select', + required: true, + placeholder: '请选择尺寸', + label: '图片尺寸', + + options: [ + { + label: '1:1 (1328 * 1328)', + value: '1328x1328', + }, + { + label: '4:3 (1472 * 1104)', + value: '1472x1104', + }, + { + label: '3:2 (1584 * 1056)', + value: '1584x1056', + }, + { + label: '16:9 (1664 * 936)', + value: '1664x936', + }, + { + label: '21:9 (2016 * 864)', + value: '2016x864', + }, + { + label: '1:1 高清2K (2048 * 2048)', + value: '2048x2048', + }, + { + label: '4:3 高清2K (2304 * 1728)', + value: '2304x1728', + }, + { + label: '3:2 高清2K (2496 * 1664)', + value: '2496x1664', + }, + { + label: '16:9 高清2K (2560 * 1440)', + value: '2560x1440', + }, + { + label: '21:9 高清2K (3024 * 1296)', + value: '3024x1296', + }, + ], + }, + { + name: 'use_pre_llm', + type: 'boolean', + required: true, + label: '开启文本扩写', + info: '开启后,系统会自动扩写提示词,提高生成质量', + }, + ], + }, + { + name: '图片 3.1 文生图', + version: '3.1', + label: '丰富的美学多样性,画面更鲜明生动', + key: 'jimeng_t2i_v31', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入提示词', + info: '用于生成图像的提示词 ,中英文均可输入', + }, + { + name: 'size', + type: 'select', + required: true, + placeholder: '请选择尺寸', + label: '图片尺寸', + + options: [ + { + label: '1:1 (1328 * 1328)', + value: '1328x1328', + }, + { + label: '4:3 (1472 * 1104)', + value: '1472x1104', + }, + { + label: '3:2 (1584 * 1056)', + value: '1584x1056', + }, + { + label: '16:9 (1664 * 936)', + value: '1664x936', + }, + { + label: '21:9 (2016 * 864)', + value: '2016x864', + }, + { + label: '1:1 高清2K (2048 * 2048)', + value: '2048x2048', + }, + { + label: '4:3 高清2K (2304 * 1728)', + value: '2304x1728', + }, + { + label: '3:2 高清2K (2496 * 1664)', + value: '2496x1664', + }, + { + label: '16:9 高清2K (2560 * 1440)', + value: '2560x1440', + }, + { + label: '21:9 高清2K (3024 * 1296)', + value: '3024x1296', + }, + ], + }, + { + name: 'use_pre_llm', + type: 'boolean', + required: true, + label: '开启文本扩写', + info: '开启后,系统会自动扩写提示词,提高生成质量', + }, + ], + }, + + { + name: '图片 3.0 图生图', + version: '3.0', + label: '精准执行编辑指令,保持图像内容完整性', + key: 'jimeng_i2i_v30', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入用于编辑图像的提示词,如:把xxx改成xxx,删除xxx,添加xxx等', + info: '建议长度<=120字符,最长不超过800字符', + }, + { + name: 'image_urls', + label: '参考图片', + type: 'image', + required: true, + placeholder: '请上传图片', + maxSize: 5, + accept: '.png,.jpg,.jpeg', + info: '长边与短边比例在3以内,超出此比例或比例相对极端,会导致报错。', + }, + { + name: 'scale', + label: '文本描述影响的程度', + type: 'slider', + min: 0, + max: 1, + step: 0.1, + value: 0.5, + info: '该值越大代表文本描述影响程度越大,且输入图片影响程度越小', + }, + { + name: 'size', + type: 'select', + required: true, + placeholder: '请选择尺寸', + label: '图片尺寸', + + options: [ + { + label: '1:1 (1328 * 1328)', + value: '1328x1328', + }, + { + label: '4:3 (1472 * 1104)', + value: '1472x1104', + }, + { + label: '3:2 (1584 * 1056)', + value: '1584x1056', + }, + { + label: '16:9 (1664 * 936)', + value: '1664x936', + }, + { + label: '21:9 (2016 * 864)', + value: '2016x864', + }, + ], + }, + ], + }, + ], + video: [ + { + name: '视频 3.0 720P-文生视频', + version: '3.0', + label: '生成效果与速度兼备', + key: 'jimeng_t2v_v30', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入提示词', + info: '用于生成视频的提示词 ,中英文均可输入', + }, + { + name: 'aspect_ratio', + label: '视频比例', + type: 'select', + required: false, + placeholder: '请选择视频比例', + options: [ + { + label: '16:9 (横版)', + value: '16:9', + }, + { + label: '4:3 (标准)', + value: '4:3', + }, + { + label: '1:1 (正方形)', + value: '1:1', + }, + { + label: '3:4 (竖版)', + value: '3:4', + }, + { + label: '9:16 (竖屏)', + value: '9:16', + }, + { + label: '21:9 (超宽)', + value: '21:9', + }, + ], + }, + { + name: 'duration', + type: 'select', + label: '视频时长', + options: [ + { + label: '5秒', + value: '5', + }, + { + label: '10秒', + value: '10', + }, + ], + }, + ], + }, + + { + name: '视频 3.0 720P-图生视频-首帧', + version: '3.0', + label: '根据提示词 + 首帧图片生成视频', + key: 'jimeng_i2v_first_v30', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入提示词', + info: '用于生成视频的提示词 ,中英文均可输入', + }, + { + name: 'image_urls', + label: '首帧图片', + type: 'image', + required: false, + placeholder: '请上传图片', + multiple: false, + maxCount: 1, + maxSize: 5, + accept: '.png,.jpg,.jpeg', + }, + { + name: 'duration', + type: 'select', + label: '视频时长', + options: [ + { + label: '5秒', + value: '5', + }, + { + label: '10秒', + value: '10', + }, + ], + }, + ], + }, + + { + name: '视频 3.0 720P-图生视频-首尾帧', + version: '3.0', + label: '根据提示词 + 首尾帧图片生成视频', + key: 'jimeng_i2v_first_tail_v30', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入提示词', + info: '用于生成视频的提示词 ,中英文均可输入', + }, + { + name: 'image_urls', + label: '首帧图片', + type: 'image', + required: false, + placeholder: '请上传图片', + multiple: true, + maxCount: 2, + maxSize: 5, + accept: '.png,.jpg,.jpeg', + }, + { + name: 'duration', + type: 'select', + label: '视频时长', + options: [ + { + label: '5秒', + value: '5', + }, + { + label: '10秒', + value: '10', + }, + ], + }, + ], + }, + + { + name: '视频 3.0 720P-图生视频-运镜', + version: '3.0', + label: '根据提示词 + 运镜图片生成视频', + key: 'jimeng_i2v_recamera_v30', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入提示词', + info: '用于生成视频的提示词 ,中英文均可输入', + }, + { + name: 'image_urls', + label: '运镜图片', + type: 'image', + required: false, + placeholder: '请上传图片', + maxSize: 5, + multiple: false, + maxCount: 1, + accept: '.png,.jpg,.jpeg', + }, + { + name: 'template_id', + label: '运镜控制', + type: 'select', + required: false, + placeholder: '请选择运镜控制', + options: [ + { + label: '希区柯克推进', + value: 'hitchcock_dolly_in', + }, + { + label: '希区柯克拉远', + value: 'hitchcock_dolly_out', + }, + { + label: '机械臂', + value: 'robo_arm', + }, + { + label: '动感环绕', + value: 'dynamic_orbit', + }, + { + label: '中心环绕', + value: 'central_orbit', + }, + { + label: '起重机', + value: 'crane_push', + }, + { + label: '超级拉远', + value: 'quick_pull_back', + }, + { + label: '逆时针回旋', + value: 'counterclockwise_swivel', + }, + { + label: '顺时针回旋', + value: 'clockwise_swivel', + }, + { + label: '手持运镜', + value: 'handheld', + }, + { + label: '快速推拉', + value: 'rapid_push_pull', + }, + ], + }, + { + name: 'camera_strength', + label: '运镜强度', + type: 'select', + required: false, + placeholder: '请选择运镜强度', + options: [ + { + label: '弱', + value: 'weak', + }, + { + label: '中', + value: 'medium', + }, + { + label: '强', + value: 'strong', + }, + ], + }, + { + name: 'duration', + type: 'select', + label: '视频时长', + options: [ + { + label: '5秒', + value: '5', + }, + { + label: '10秒', + value: '10', + }, + ], + }, + ], + }, + + { + name: '视频 3.0Pro 图生视频', + version: '3.0', + label: '根据提示词 + 首帧图片生成视频', + key: 'jimeng_ti2v_v30_pro', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入提示词', + info: '用于生成视频的提示词 ,中英文均可输入', + }, + { + name: 'image_urls', + label: '首帧图片', + type: 'image', + required: false, + placeholder: '请上传图片', + info: '只支持上传首帧图片', + multiple: false, + maxCount: 1, + maxSize: 5, + accept: '.png,.jpg,.jpeg', + }, + // 比例 + { + name: 'aspect_ratio', + label: '视频比例', + type: 'select', + required: false, + placeholder: '请选择视频比例', + info: '只在文生视频场景下生效,图生视频场景会根据输入图的长宽比自动适配', + options: [ + { + label: '21:9 (2176 * 928)', + value: '21:9', + }, + { + label: '16:9 (1920 * 1088)', + value: '16:9', + }, + { + label: '4:3 (1664 * 1248)', + value: '4:3', + }, + { + label: '1:1 (1440 * 1440)', + value: '1:1', + }, + { + label: '3:4 (1248 * 1664)', + value: '3:4', + }, + { + label: '9:16 (1088 * 1920)', + value: '9:16', + }, + ], + }, + { + name: 'duration', + type: 'select', + label: '视频时长', + options: [ + { + label: '5秒', + value: '5', + }, + { + label: '10秒', + value: '10', + }, + ], + }, + ], + }, + ], + virtualHuman: [], + actionTransfer: [], +} diff --git a/web/src/store/jimeng.js b/web/src/store/jimeng.js index 0a9ca489..f26665a0 100644 --- a/web/src/store/jimeng.js +++ b/web/src/store/jimeng.js @@ -44,6 +44,225 @@ export const useJimengStore = defineStore('jimeng', () => { // 登录弹窗 const shareStore = useSharedStore() + const paramsMap = { + image: [ + { + name: '图片 2.1', + version: '2.1', + label: '平面绘感强,可生成文字海报', + key: 'jimeng_high_aes_general_v21_L', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入提示词', + info: '用于生成图像的提示词 ,中英文均可输入', + }, + { + name: 'size', + type: 'select', + required: true, + placeholder: '请选择尺寸', + label: '图片尺寸', + options: [ + { + label: '21:9 (1195x512)', + value: '1195x512', + }, + { + label: '16:9 (1024x576)', + value: '1024x576', + }, + { + label: '3:2 (1024x682)', + value: '1024x682', + }, + { + label: '4:3 (1024x768)', + value: '1024x768', + }, + { + label: '1:1 (1024x1024)', + value: '1024x1024', + }, + { + label: '3:4 (768x1024)', + value: '768x1024', + }, + { + label: '2:3 (682x1024)', + value: '682x1024', + }, + { + label: '9:16 (576x1024)', + value: '576x1024', + }, + ], + }, + { + name: 'use_pre_llm', + type: 'boolean', + required: true, + label: '开启文本扩写', + info: '开启后,系统会自动扩写提示词,提高生成质量', + value: true, + }, + ], + }, + { + name: '图片 3.0 文生图', + version: '3.0', + label: '影视质感,文字更准,直出2k高清图', + key: 'jimeng_t2i_v30', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入提示词', + info: '用于生成图像的提示词 ,中英文均可输入', + }, + { + name: 'size', + type: 'select', + required: true, + placeholder: '请选择尺寸', + label: '图片尺寸', + + options: [ + { + label: '1:1 (1328x1328)', + value: '1328x1328', + }, + { + label: '4:3 (1472x1104)', + value: '1472x1104', + }, + { + label: '3:2 (1584x1056)', + value: '1584x1056', + }, + { + label: '16:9 (1664x936)', + value: '1664x936', + }, + { + label: '21:9 (2016x864)', + value: '2016x864', + }, + { + label: '1:1 高清2K (2048x2048)', + value: '2048x2048', + }, + { + label: '4:3 高清2K (2304x1728)', + value: '2304x1728', + }, + { + label: '3:2 高清2K (2496x1664)', + value: '2496x1664', + }, + { + label: '16:9 高清2K (2560x1440)', + value: '2560x1440', + }, + { + label: '21:9 高清2K (3024x1296)', + value: '3024x1296', + }, + ], + }, + { + name: 'use_pre_llm', + type: 'boolean', + required: true, + label: '开启文本扩写', + info: '开启后,系统会自动扩写提示词,提高生成质量', + }, + ], + }, + { + name: '图片 3.1', + version: '3.1', + label: '文生图3.0', + key: 'jimeng_t2i_v31', + params: [ + { + name: 'prompt', + label: '提示词', + type: 'text', + required: true, + placeholder: '请输入提示词', + info: '用于生成图像的提示词 ,中英文均可输入', + }, + { + name: 'size', + type: 'select', + required: true, + placeholder: '请选择尺寸', + label: '图片尺寸', + + options: [ + { + label: '1:1 (1328x1328)', + value: '1328x1328', + }, + { + label: '4:3 (1472x1104)', + value: '1472x1104', + }, + { + label: '3:2 (1584x1056)', + value: '1584x1056', + }, + { + label: '16:9 (1664x936)', + value: '1664x936', + }, + { + label: '21:9 (2016x864)', + value: '2016x864', + }, + { + label: '1:1 高清2K (2048x2048)', + value: '2048x2048', + }, + { + label: '4:3 高清2K (2304x1728)', + value: '2304x1728', + }, + { + label: '3:2 高清2K (2496x1664)', + value: '2496x1664', + }, + { + label: '16:9 高清2K (2560x1440)', + value: '2560x1440', + }, + { + label: '21:9 高清2K (3024x1296)', + value: '3024x1296', + }, + ], + }, + { + name: 'use_pre_llm', + type: 'boolean', + required: true, + label: '开启文本扩写', + info: '开启后,系统会自动扩写提示词,提高生成质量', + }, + ], + }, + ], + video: [], + virtualHuman: [], + actionTransfer: [], + } + // 功能分类配置 const categories = [ { key: 'image_generation', name: '图片生成' }, diff --git a/web/src/views/Jimeng.vue b/web/src/views/Jimeng.vue index 986bf293..0a7b638f 100644 --- a/web/src/views/Jimeng.vue +++ b/web/src/views/Jimeng.vue @@ -19,6 +19,125 @@ + +
+ + + +
+ +
+
创建图像(文生图)
+
    +
  • + 结构建议:主体描述 + 风格 + 美学(准确响应);风格 + 主体描述 + 美学 + 氛围(更强美学) +
  • +
  • + 用专业短词描述风格/镜头/构图;主体用自然语言完整描述(主体 + 行为 + 环境) +
  • +
  • 关键信息靠前;用正向表达代替“不要xxx”类否定词
  • +
  • 需要生成文字时,明确“生成文字”并补充位置/风格/材质
  • +
+
+
+ 示例:新年主题海报,上方以手写涂鸦风格写着“新年快乐”,红金配色,纸张纹理,强对比光影,居中极简构图,留白用于标题。 +
+
+
+
Before:海报,“新年快乐”
+
After:一张海报,上面文字写着:“新年快乐”
+
+
+
Before:海报,“新年快乐”
+
+ After:一张海报,画面上方有手写涂鸦风格的文字写着:“新年快乐” +
+
+

特征与视角可反复强调:

+
    +
  • 御剑飞行 → 男人站在剑上,他踩在剑上,剑被他踩着,御剑飞仙
  • +
  • 仰视视角 → 采用低角度,从下往上,仰视与广角构图
  • +
+
+
+ 示例:百合南瓜羹特写,只展示半碗,米黄色糯米勾芡,橙色南瓜块与丝理清晰,点缀紫白色百合。 +
+
+
+ + +
+
编辑图像(图生图/图像编辑)
+
    +
  • 应用场景可加:如“海报、平面设计”等词以增强对应风格
  • +
  • 生成或保留的文字请用引号包裹,准确率更高
  • +
  • 建议长度 ≤ 120 字,最多不超过 800 字,过长可能失效
  • +
  • 编辑指令用自然语言;一次只做一件事更易生效
  • +
  • 多实体时指明“对谁做什么”,局部编辑尽量精准
  • +
  • 效果不明显可提高编辑强度 scale;底图越清晰效果越好
  • +
+
+
示例(添加/删除实体):删除图上的女孩;添加一道彩虹。
+
+
+
+ 示例(添加文字):一张圣诞节海报,上面写着“Merry Christmas”。 +
+
+
+
示例(修改实体):把手里的鸡腿改成汉堡。
+
+
+
+ 示例(修改风格/色彩/动作/背景):改成漫画风格;把外套改成粉色;让男孩微笑;背景换成海边日落。 +
+
+
+ + +
+
生成视频(文/图生视频)
+
    +
  • 基础结构:主体 / 背景 / 镜头 + 动作
  • +
  • + 多个镜头连贯叙事:镜头1 + 主体 + 动作1 + 镜头2 + 主体 + 动作2 + ... +
  • +
  • + 多个连续动作:时序:主体1 + 运动1 + 运动2;多主体:主体1 + + 运动1 + 主体2 + 运动2 ... +
  • +
  • + 运镜词典:镜头切换;镜头向上/下/左/右移动;镜头拉近/拉远;镜头环绕/航拍/广角/360度旋转;镜头跟随;固定镜头;镜头特写;手持拍摄(晃动/抖动) +
  • +
  • + 程度副词:快速、缓缓、大幅度、高频率、剧烈等,突出动作强度与节奏 +
  • +
+
+
+ 示例:镜头1,城市夜景航拍,镜头环绕;镜头2,男主在屋顶奔跑,镜头跟随,快速;镜头3,男主停下特写,霓虹反光,缓慢拉近。 +
+
+
+
+
+
+
+
{ store.init() }) @@ -732,6 +854,7 @@ function copyErrorMsg(msg) { .err-msg-clip { display: -webkit-box; -webkit-line-clamp: 2; + line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; @@ -745,4 +868,50 @@ function copyErrorMsg(msg) { line-height: 60px; } } + +// 新增:提示词指南样式 +.prompt-guide { + margin: 12px 0 16px; + + .guide-title { + display: flex; + align-items: center; + font-weight: 600; + color: #666; + } + + .guide-content { + max-height: 220px; + overflow: auto; + line-height: 1.6; + font-size: 12px; + color: #555; + padding-right: 4px; + } + + .guide-section { + margin-bottom: 10px; + } + + .guide-subtitle { + font-weight: 600; + margin-bottom: 6px; + color: #333; + } + + ul { + list-style: disc; + padding-left: 18px; + margin: 4px 0; + } + + .quote { + margin: 8px 0; + padding: 8px 10px; + border-left: 3px solid #a3a3a3; + background: #f8f8f8; + border-radius: 4px; + color: #444; + } +}