refactor: Ensure data_input is always a list in RecursiveCharacterTextSplitterComponent
To prevent potential errors, this refactor ensures that the `data_input` attribute in the `RecursiveCharacterTextSplitterComponent` class is always a list. If it is not already a list, it is converted to a list before processing. This change improves the reliability and consistency of the code.
This commit is contained in:
parent
f4ef1d9007
commit
4f7d453abc
1 changed files with 2 additions and 0 deletions
|
|
@ -73,6 +73,8 @@ class RecursiveCharacterTextSplitterComponent(Component):
|
|||
chunk_overlap=self.chunk_overlap,
|
||||
)
|
||||
documents = []
|
||||
if not isinstance(self.data_input, list):
|
||||
self.data_input = [self.data_input]
|
||||
for _input in self.data_input:
|
||||
if isinstance(_input, Data):
|
||||
documents.append(_input.to_lc_document())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue