fixed bug in change_model

This commit is contained in:
phixxy 2023-07-13 23:19:10 -07:00
parent 85892939f1
commit 43a51e4060

View file

@ -1208,10 +1208,11 @@ async def change_model(ctx, model_choice='0'):
model_id, model_name = model_choices[model_choice] model_id, model_name = model_choices[model_choice]
if current_model != model_id: if current_model != model_id:
payload = {"sd_model_checkpoint": model_id} payload = {"sd_model_checkpoint": model_id}
async with session.post(url=f'{url}/sdapi/v1/options', json=payload) as response: async with aiohttp.ClientSession() as session:
output = "Changed model to: " + model_name async with session.post(url=f'{url}/sdapi/v1/options', json=payload) as response:
await ctx.send(output) output = "Changed model to: " + model_name
return await ctx.send(output)
return
else: else:
await ctx.send(f"Already set to use {model_name}") await ctx.send(f"Already set to use {model_name}")
return return