Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class BaseParameterExtractionNode(IParameterExtractionNode):

def save_context(self, details, workflow_manage):
for key, value in details.get('result').items():
self.context['key'] = value
self.context[key] = value
self.context['result'] = details.get('result')

def execute(self, input_variable, variable_list, model_params_setting, model_id, **kwargs) -> NodeResult:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No obvious irregularities identified in the provided code snippet. Here's a brief review:

class BaseParameterExtractionNode(IParameterExtractionNode):
    # (other methods remain unchanged)

def save_context(self, details, workflow_manage):
    # Loop through each key-value pair in 'result'
    for key, value in details.get('result'). items():
        # Assign value to context with the current key
        self.context[key] = value
    # Store entire result dictionary in context
    self.context['result'] = details.get('result')

# Method remains largely intact, no further changes suggested

The code is generally clean and efficient for setting up the context based on the extracted results from details. There are no syntax errors or logical issues within this segment of the code at the given time.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def smart_jsonpath_search(data: dict, path: str):
class BaseVariableSplittingNode(IVariableSplittingNode):
def save_context(self, details, workflow_manage):
for key, value in details.get('result').items():
self.context['key'] = value
self.context[key] = value
self.context['result'] = details.get('result')

def execute(self, input_variable, variable_list, **kwargs) -> NodeResult:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code makes several improvements:

  1. The save_context method now properly assigns the values to keys in the context dictionary without directly setting "self.context['key']".
  2. It removes unnecessary usage of 'result' twice within the same assignment.
  3. The overall method structure remains clear and concise.

In terms of optimization: none significant changes have been made, but here's a small note for future maintenance:
Consider using f-strings if you're adding more string interpolations in other part of your codebase, which would make it easier to read.

Improvements Made:

  • Replaced direct access with proper iteration
  • Removed redundant key assignments

Expand Down
Loading