From 0e0443eab2f0b502972434450db698fe37ca6e42 Mon Sep 17 00:00:00 2001 From: jingrow Date: Tue, 20 May 2025 18:34:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A1=AE=E4=BF=9Dmidjourney=20seed=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=BD=8D=E4=BA=8E=E6=9C=AB=E5=B0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/midjourney/service.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/midjourney/service.py b/apps/midjourney/service.py index 1688e50..d3a6df9 100644 --- a/apps/midjourney/service.py +++ b/apps/midjourney/service.py @@ -406,7 +406,12 @@ class MidjourneyService: if "seed" not in options or not options.get('seed'): 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) + parameter = "" no_value_key = ['relax', 'fast', 'turbo', 'tile'] for key, value in options.items(): @@ -414,7 +419,7 @@ class MidjourneyService: parameter += f" --{key}" else: parameter += f" --{key} {value}" - + if seed: parameter += f" --seed {seed}" logger.info(f"使用的seed值: {seed}") @@ -436,11 +441,7 @@ class MidjourneyService: if new_image_urls: 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']: char_urls = [] characters = config['characters'] if isinstance(config['characters'], list) else [config['characters']]