Compare commits

...

2 Commits

12 changed files with 52 additions and 25 deletions

35
.gitignore vendored
View File

@ -1,12 +1,41 @@
# Ignore Python-related directories:
__pycache__/
/venv/
# Ignore auto-generated settings.json:
/settings.json
/conf/*
!/conf/example-workflow.json
!/conf/example-workflow_settings.json
# Ignore configuration in subdirectories:
/conf/category_defaults/*
/conf/channel_defaults/*
/conf/defaults/*
/conf/guild_defaults/*
/conf/role_defaults/*
/conf/user_defaults/*
/conf/workflows/*
# Keep stubs for directory structure:
!/conf/category_defaults/put_category_names_or_ids_here
!/conf/channel_defaults/put_channel_names_or_ids_here
!/conf/defaults/put_channel_topic_tokens_here
!/conf/guild_defaults/put_guild_names_or_ids_here
!/conf/role_defaults/put_role_names_or_ids_here
!/conf/user_defaults/put_user_names_or_ids_here
!/conf/workflows/put_comfyui_api_workflows_here
# Keep example .json files:
!/conf/defaults/example-workflow.json
!/conf/workflows/example-workflow.json
# Ignore rotating logs:
/log.txt
/log.txt.*
/*.log.txt
/*.log.txt.*
# Ignore statistics logging database:
/database.db
# Ignore proposed alternative config directory:
/conf_2
/conf_2/

View File

@ -22,8 +22,6 @@ async def get_comfyui_generations(api_url, workflow):
continue
break
print(resp_json)
# Read the output history anmd fetch each image:
history = resp_json[prompt_id]
output_images = []

View File

@ -64,19 +64,9 @@ async def on_message_or_reaction(client, obj):
chl_topic_parts = chl.topic.split(",")
chl_topic_part_1 = chl_topic_parts[0]
# Try different paths to find workflow .json file:
workflow_paths = [
f"{CONFIG_DIR}{chl.category.name}/{chl_topic_part_1}",
f"{CONFIG_DIR}{chl.category.name}/{chl.name}",
f"{CONFIG_DIR}{chl_topic_part_1}",
f"{CONFIG_DIR}{chl.name}",
f"{CONFIG_DIR}{chl.category.name}",
]
using_workflow_path = None
using_settings_path = None
for path in workflow_paths:
for path in [f"{CONFIG_DIR}workflows/{chl_topic_part_1}"]:
try_path = f"{path}.json"
if os.path.isfile(try_path):
using_workflow_path = try_path
@ -90,22 +80,32 @@ async def on_message_or_reaction(client, obj):
#
setting_paths = [
f"{CONFIG_DIR}{chl.category.name}",
f"{CONFIG_DIR}{chl.name}",
f"{CONFIG_DIR}guild_defaults/{chl.guild.id}",
f"{CONFIG_DIR}guild_defaults/{chl.guild.name}",
f"{CONFIG_DIR}category_defaults/{chl.category.id}",
f"{CONFIG_DIR}category_defaults/{chl.category.name}",
f"{CONFIG_DIR}channel_defaults/{chl.id}",
f"{CONFIG_DIR}channel_defaults/{chl.name}",
]
for i in chl_topic_parts:
setting_paths = setting_paths + [{CONFIG_DIR} + i.strip()]
setting_paths = setting_paths + [f"{CONFIG_DIR}{chl.category.name}/{chl.name}"]
for i in chl_topic_parts:
setting_paths = setting_paths + [f"{CONFIG_DIR}{chl.category.name}/" + i.strip()]
chl_topic_part = i.strip()
setting_paths = setting_paths + [f"{CONFIG_DIR}defaults/{chl_topic_part}"]
for r in roles:
setting_paths = setting_paths + [
f"{CONFIG_DIR}role_defaults/{r.id}",
f"{CONFIG_DIR}role_defaults/{r.name}",
]
setting_paths = setting_paths + [
f"{CONFIG_DIR}user_defaults/{user.id}",
f"{CONFIG_DIR}user_defaults/{user.name}",
]
for path in setting_paths:
try_path = f"{path}_settings.json"
try_path = f"{path}.json"
log.write(f"Seeking {try_path}")
if os.path.isfile(try_path):
settings = merge_dicts(settings, read_json(try_path, {}))
log.write(f"Merging {log.colors.fg.lightcyan}{try_path}")