确保midjourney seed参数位于末尾

This commit is contained in:
jingrow 2025-05-20 18:34:25 +08:00
parent b523b6975b
commit 0e0443eab2

View File

@ -406,7 +406,12 @@ class MidjourneyService:
if "seed" not in options or not options.get('seed'): if "seed" not in options or not options.get('seed'):
options['seed'] = random.randint(0, 4294967295) options['seed'] = random.randint(0, 4294967295)
if 'image_weight' in config and isinstance(config['image_weight'], (int, float)):
iw = max(0.1, min(config['image_weight'], 3))
options['iw'] = iw
seed = options.pop('seed', None) seed = options.pop('seed', None)
parameter = "" parameter = ""
no_value_key = ['relax', 'fast', 'turbo', 'tile'] no_value_key = ['relax', 'fast', 'turbo', 'tile']
for key, value in options.items(): for key, value in options.items():
@ -414,7 +419,7 @@ class MidjourneyService:
parameter += f" --{key}" parameter += f" --{key}"
else: else:
parameter += f" --{key} {value}" parameter += f" --{key} {value}"
if seed: if seed:
parameter += f" --seed {seed}" parameter += f" --seed {seed}"
logger.info(f"使用的seed值: {seed}") logger.info(f"使用的seed值: {seed}")
@ -436,11 +441,7 @@ class MidjourneyService:
if new_image_urls: if new_image_urls:
prompt = " ".join(new_image_urls) + " " + prompt prompt = " ".join(new_image_urls) + " " + prompt
if 'image_weight' in config and isinstance(config['image_weight'], (int, float)):
iw = max(0.1, min(config['image_weight'], 3))
parameter += f" --iw {iw}"
if 'characters' in config and config['characters']: if 'characters' in config and config['characters']:
char_urls = [] char_urls = []
characters = config['characters'] if isinstance(config['characters'], list) else [config['characters']] characters = config['characters'] if isinstance(config['characters'], list) else [config['characters']]