|
@@ -3100,30 +3100,39 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
|
|
|
return '';
|
|
return '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return $this->getArtStylePromptMappings($normalizedInput);
|
|
|
|
|
-
|
|
|
|
|
- // foreach ($this->getArtStylePromptMappings() as $mapping) {
|
|
|
|
|
- // foreach ($mapping['aliases'] as $alias) {
|
|
|
|
|
- // $normalizedAlias = $this->normalizeArtStyleInput($alias);
|
|
|
|
|
- // if ($normalizedAlias === '') {
|
|
|
|
|
- // continue;
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
- // if (strpos($normalizedInput, $normalizedAlias) !== false || strpos($normalizedAlias, $normalizedInput) !== false) {
|
|
|
|
|
- // return $mapping['prompt'];
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ // 按归一化画风名匹配(去除中英文空格等差异),表数据与内置映射通用
|
|
|
|
|
+ $mappings = $this->getArtStylePromptMappings();
|
|
|
|
|
+ if (!is_array($mappings)) {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ foreach ($mappings as $artStyleName => $mapping) {
|
|
|
|
|
+ if ($this->normalizeArtStyleInput($artStyleName) === $normalizedInput) {
|
|
|
|
|
+ return (string)getProp($mapping, 'prompt', '');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return '';
|
|
return '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function getArtStyleShortPromptByInput($inputArtStyle) {
|
|
public function getArtStyleShortPromptByInput($inputArtStyle) {
|
|
|
- // 优先从画风表读取;character_prefix/scene_prefix 缺失时用通用 prompt 兜底,均缺失则返回空数组
|
|
|
|
|
- $row = DB::table('mp_art_styles')
|
|
|
|
|
- ->where('art_style', $inputArtStyle)
|
|
|
|
|
|
|
+ $normalizedInput = $this->normalizeArtStyleInput($inputArtStyle);
|
|
|
|
|
+ if ($normalizedInput === '') {
|
|
|
|
|
+ return [];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 优先从画风表读取(按归一化画风名匹配,停用画风保持可用);
|
|
|
|
|
+ // character_prefix/scene_prefix 缺失时用通用 prompt 兜底,均缺失则返回空数组
|
|
|
|
|
+ $row = null;
|
|
|
|
|
+ $dbRows = DB::table('mp_art_styles')
|
|
|
->where('is_deleted', 0)
|
|
->where('is_deleted', 0)
|
|
|
- ->first(['character_prefix', 'scene_prefix', 'prompt']);
|
|
|
|
|
|
|
+ ->get(['art_style', 'character_prefix', 'scene_prefix', 'prompt']);
|
|
|
|
|
+ foreach ($dbRows as $dbRow) {
|
|
|
|
|
+ if ($this->normalizeArtStyleInput($dbRow->art_style) === $normalizedInput) {
|
|
|
|
|
+ $row = $dbRow;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if ($row) {
|
|
if ($row) {
|
|
|
$prompt = (string)$row->prompt;
|
|
$prompt = (string)$row->prompt;
|
|
|
$result = [
|
|
$result = [
|
|
@@ -3215,8 +3224,12 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
|
|
|
]
|
|
]
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
- if (isset($stylePrefixes[$inputArtStyle])) {
|
|
|
|
|
- $item = $stylePrefixes[$inputArtStyle];
|
|
|
|
|
|
|
+ // 内置映射同样按归一化画风名匹配
|
|
|
|
|
+ foreach ($stylePrefixes as $artStyleName => $item) {
|
|
|
|
|
+ if ($this->normalizeArtStyleInput($artStyleName) !== $normalizedInput) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$prompt = (string)($item['prompt'] ?? '');
|
|
$prompt = (string)($item['prompt'] ?? '');
|
|
|
// 前缀缺失时用通用 prompt 兜底
|
|
// 前缀缺失时用通用 prompt 兜底
|
|
|
$result = [
|
|
$result = [
|
|
@@ -15557,7 +15570,7 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
|
|
|
$pic_prompt = getProp($role, 'pic_prompt');
|
|
$pic_prompt = getProp($role, 'pic_prompt');
|
|
|
$description = !empty($pic_prompt) ? trim((string)$pic_prompt) : getProp($role, 'description');
|
|
$description = !empty($pic_prompt) ? trim((string)$pic_prompt) : getProp($role, 'description');
|
|
|
|
|
|
|
|
- $description = "{$character_prefix}。\n主体描述:{$description}\n超高清,高细节,主体突出,构图合理,画面干净,无场景或背景,单人物,无文字,无水印,无字幕,电影级光影,视觉焦点明确";
|
|
|
|
|
|
|
+ $description = buildStylePromptPrefix($character_prefix) . "主体描述:{$description}\n超高清,高细节,主体突出,构图合理,画面干净,无场景或背景,单人物,无文字,无水印,无字幕,电影级光影,视觉焦点明确";
|
|
|
|
|
|
|
|
$update_flag = true;
|
|
$update_flag = true;
|
|
|
|
|
|
|
@@ -15649,7 +15662,7 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
|
|
|
$pic_prompt = getProp($scene, 'pic_prompt');
|
|
$pic_prompt = getProp($scene, 'pic_prompt');
|
|
|
$description = !empty($pic_prompt) ? trim((string)$pic_prompt) : getProp($scene, 'description');
|
|
$description = !empty($pic_prompt) ? trim((string)$pic_prompt) : getProp($scene, 'description');
|
|
|
|
|
|
|
|
- $description = "{$scene_prefix}。\n场景描述:{$description}\n无人物,超高清,高细节,主体突出,构图合理,画面干净,无文字,无水印,无字幕,电影级光影,视觉焦点明确";
|
|
|
|
|
|
|
+ $description = buildStylePromptPrefix($scene_prefix) . "场景描述:{$description}\n无人物,超高清,高细节,主体突出,构图合理,画面干净,无文字,无水印,无字幕,电影级光影,视觉焦点明确";
|
|
|
|
|
|
|
|
$update_flag = true;
|
|
$update_flag = true;
|
|
|
|
|
|
|
@@ -15741,7 +15754,7 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
|
|
|
$pic_prompt = getProp($prop, 'pic_prompt');
|
|
$pic_prompt = getProp($prop, 'pic_prompt');
|
|
|
$description = !empty($pic_prompt) ? trim((string)$pic_prompt) : getProp($prop, 'description');
|
|
$description = !empty($pic_prompt) ? trim((string)$pic_prompt) : getProp($prop, 'description');
|
|
|
|
|
|
|
|
- $description = "{$prop_prefix}。\n道具描述:{$description}\n无人物,超高清,高细节,主体突出,构图合理,画面干净,无文字,无水印,无字幕,电影级光影,视觉焦点明确";
|
|
|
|
|
|
|
+ $description = buildStylePromptPrefix($prop_prefix) . "道具描述:{$description}\n无人物,超高清,高细节,主体突出,构图合理,画面干净,无文字,无水印,无字幕,电影级光影,视觉焦点明确";
|
|
|
|
|
|
|
|
$update_flag = true;
|
|
$update_flag = true;
|
|
|
|
|
|