Skip to content

Commit

Permalink
refac
Browse files Browse the repository at this point in the history
  • Loading branch information
tjbck committed Jun 1, 2024
1 parent 3719644 commit a248b96
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,17 @@ async def load_modules_from_directory(directory):
if os.path.exists(valves_json_path):
with open(valves_json_path, "r") as f:
valves_json = json.load(f)
ValvesModel = pipeline.valves.__class__
# Create a ValvesModel instance using default values and overwrite with valves_json
combined_valves = {
**pipeline.valves.model_dump(),
**valves_json,
}
valves = ValvesModel(**combined_valves)
pipeline.valves = valves
if hasattr(pipeline, "valves"):
ValvesModel = pipeline.valves.__class__
# Create a ValvesModel instance using default values and overwrite with valves_json
combined_valves = {
**pipeline.valves.model_dump(),
**valves_json,
}
valves = ValvesModel(**combined_valves)
pipeline.valves = valves

logging.info(f"Updated valves for module: {module_name}")
logging.info(f"Updated valves for module: {module_name}")

pipeline_id = pipeline.id if hasattr(pipeline, "id") else module_name
PIPELINE_MODULES[pipeline_id] = pipeline
Expand Down

0 comments on commit a248b96

Please sign in to comment.