Skip to content

Commit

Permalink
Merge pull request #113 from zhuzhongshu123/0.6_dev
Browse files Browse the repository at this point in the history
(fix)builder: dict parse with same key
  • Loading branch information
zhuzhongshu123 authored Dec 9, 2024
2 parents 39a27ca + 2ffada9 commit b542252
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions kag/builder/component/record_parser/dict_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ def invoke(self, input: Input, **kwargs) -> List[Output]:
Returns:
List[Output]: A list containing a single Chunk object created from the input dictionary.
"""
chunk_id = input.pop(self.id_col)
chunk_name = input.pop(self.name_col)
chunk_content = input.pop(self.content_col)
chunk_id = input.get(self.id_col)
chunk_name = input.get(self.name_col)
chunk_content = input.get(self.content_col)
if self.id_col in input:
input.pop(self.id_col)
if self.name_col in input:
input.pop(self.name_col)
if self.content_col in input:
input.pop(self.content_col)

return [Chunk(id=chunk_id, name=chunk_name, content=chunk_content, **input)]

0 comments on commit b542252

Please sign in to comment.