Compare commits

..

No commits in common. "7f9bb11f8f998b02109df2bb922251c6832fd50e" and "264c099fad43bdc8688e002b671c47ec8a161d31" have entirely different histories.

12 changed files with 26 additions and 53 deletions

35
.gitignore vendored
View File

@ -1,41 +1,12 @@
# Ignore Python-related directories:
__pycache__/
/venv/
# Ignore auto-generated settings.json:
/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:
/conf/*
!/conf/example-workflow.json
!/conf/example-workflow_settings.json
/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,6 +22,8 @@ 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,9 +64,19 @@ async def on_message_or_reaction(client, obj):
chl_topic_parts = chl.topic.split(",")
chl_topic_part_1 = chl_topic_parts[0]
using_workflow_path = None
# 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}",
]
for path in [f"{CONFIG_DIR}workflows/{chl_topic_part_1}"]:
using_workflow_path = None
using_settings_path = None
for path in workflow_paths:
try_path = f"{path}.json"
if os.path.isfile(try_path):
using_workflow_path = try_path
@ -80,32 +90,22 @@ async def on_message_or_reaction(client, obj):
#
setting_paths = [
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}",
f"{CONFIG_DIR}{chl.category.name}",
f"{CONFIG_DIR}{chl.name}",
]
for i in chl_topic_parts:
chl_topic_part = i.strip()
setting_paths = setting_paths + [f"{CONFIG_DIR}defaults/{chl_topic_part}"]
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()]
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}.json"
log.write(f"Seeking {try_path}")
try_path = f"{path}_settings.json"
if os.path.isfile(try_path):
settings = merge_dicts(settings, read_json(try_path, {}))
log.write(f"Merging {log.colors.fg.lightcyan}{try_path}")