Skip to content
Merged
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
2 changes: 1 addition & 1 deletion apps/application/serializers/application_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def paragraph_list_to_string(paragraph_list):
@staticmethod
def to_row(row: Dict):
details = row.get('details') or {}
padding_problem_text = ' '.join(node.get("answer", "") for key, node in details.items() if
padding_problem_text = ' '.join((node.get("answer", "") or "") for key, node in details.items() if
node.get("type") == 'question-node')
search_dataset_node_list = [(key, node) for key, node in details.items() if
node.get("type") == 'search-dataset-node' or node.get(
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 has a small issue with string formatting. The use of " ".join(...) is correct, but using or "" will result in an extra space between strings when there are non-empty answers. To avoid this, you could modify the line inside the join to:

... ("" if node.get("answer") else "") for ...

This way, if there's no answer (`None'), it skips adding extra whitespace.

Additionally, while there are no significant performance improvements or obvious issues in the basic functionality of the method, consider using list comprehensions and generator expressions more efficiently. However, the current implementation seems straightforward enough, so these might be minor optimizations.

Expand Down
Loading