Changed cascading configuration to reflect old project's method
This commit is contained in:
parent
264c099fad
commit
e47a42370d
35
.gitignore
vendored
35
.gitignore
vendored
@ -1,12 +1,41 @@
|
|||||||
|
# Ignore Python-related directories:
|
||||||
__pycache__/
|
__pycache__/
|
||||||
/venv/
|
/venv/
|
||||||
|
|
||||||
|
# Ignore auto-generated settings.json:
|
||||||
/settings.json
|
/settings.json
|
||||||
/conf/*
|
|
||||||
!/conf/example-workflow.json
|
# Ignore configuration in subdirectories:
|
||||||
!/conf/example-workflow_settings.json
|
/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.*
|
||||||
/*.log.txt
|
/*.log.txt
|
||||||
/*.log.txt.*
|
/*.log.txt.*
|
||||||
|
|
||||||
|
# Ignore statistics logging database:
|
||||||
/database.db
|
/database.db
|
||||||
|
|
||||||
|
# Ignore proposed alternative config directory:
|
||||||
/conf_2
|
/conf_2
|
||||||
|
/conf_2/
|
||||||
|
0
conf/channel_defaults/put_channel_names_or_ids_here
Normal file
0
conf/channel_defaults/put_channel_names_or_ids_here
Normal file
0
conf/defaults/put_channel_topic_tokens_here
Normal file
0
conf/defaults/put_channel_topic_tokens_here
Normal file
0
conf/guild_defaults/put_guild_names_or_ids_here
Normal file
0
conf/guild_defaults/put_guild_names_or_ids_here
Normal file
0
conf/role_defaults/put_role_names_or_ids_here
Normal file
0
conf/role_defaults/put_role_names_or_ids_here
Normal file
0
conf/user_defaults/put_user_names_or_ids_here
Normal file
0
conf/user_defaults/put_user_names_or_ids_here
Normal file
0
conf/workflows/put_comfyui_api_workflows_here
Normal file
0
conf/workflows/put_comfyui_api_workflows_here
Normal file
@ -22,8 +22,6 @@ async def get_comfyui_generations(api_url, workflow):
|
|||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
|
|
||||||
print(resp_json)
|
|
||||||
|
|
||||||
# Read the output history anmd fetch each image:
|
# Read the output history anmd fetch each image:
|
||||||
history = resp_json[prompt_id]
|
history = resp_json[prompt_id]
|
||||||
output_images = []
|
output_images = []
|
||||||
|
@ -64,19 +64,9 @@ async def on_message_or_reaction(client, obj):
|
|||||||
chl_topic_parts = chl.topic.split(",")
|
chl_topic_parts = chl.topic.split(",")
|
||||||
chl_topic_part_1 = chl_topic_parts[0]
|
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_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"
|
try_path = f"{path}.json"
|
||||||
if os.path.isfile(try_path):
|
if os.path.isfile(try_path):
|
||||||
using_workflow_path = try_path
|
using_workflow_path = try_path
|
||||||
@ -90,22 +80,29 @@ async def on_message_or_reaction(client, obj):
|
|||||||
#
|
#
|
||||||
|
|
||||||
setting_paths = [
|
setting_paths = [
|
||||||
f"{CONFIG_DIR}{chl.category.name}",
|
f"{CONFIG_DIR}guild_defaults/{chl.guild.id}",
|
||||||
f"{CONFIG_DIR}{chl.name}",
|
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:
|
for i in chl_topic_parts:
|
||||||
setting_paths = setting_paths + [{CONFIG_DIR} + i.strip()]
|
chl_topic_part = i.strip()
|
||||||
|
setting_paths = setting_paths + [f"{CONFIG_DIR}defaults/{chl_topic_part}"]
|
||||||
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.name}"]
|
||||||
|
|
||||||
|
setting_paths = setting_paths + [
|
||||||
|
f"{CONFIG_DIR}user_defaults/{user.id}",
|
||||||
|
f"{CONFIG_DIR}user_defaults/{user.name}",
|
||||||
|
]
|
||||||
|
|
||||||
for path in setting_paths:
|
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):
|
if os.path.isfile(try_path):
|
||||||
settings = merge_dicts(settings, read_json(try_path, {}))
|
settings = merge_dicts(settings, read_json(try_path, {}))
|
||||||
log.write(f"Merging {log.colors.fg.lightcyan}{try_path}")
|
log.write(f"Merging {log.colors.fg.lightcyan}{try_path}")
|
||||||
|
Loading…
Reference in New Issue
Block a user