mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-12-02 03:07:59 +08:00
Fix/json format (#465)
This commit is contained in:
parent
d5b42c09ee
commit
c67ecff3fe
@ -36,8 +36,9 @@ class ExcelLoader(BaseLoader):
|
||||
if keys == []:
|
||||
keys = list(map(str, row))
|
||||
else:
|
||||
row_dict = dict(zip(keys, row))
|
||||
row_dict = dict(zip(keys, list(map(str, row))))
|
||||
row_dict = {k: v for k, v in row_dict.items() if v}
|
||||
data.append(json.dumps(row_dict, ensure_ascii=False))
|
||||
item = ''.join(f'{k}:{v}\n' for k, v in row_dict.items())
|
||||
data.append(item)
|
||||
|
||||
return [Document(page_content='\n\n'.join(data))]
|
||||
|
@ -134,6 +134,16 @@ class NotionLoader(BaseLoader):
|
||||
else:
|
||||
value = property_value[type]
|
||||
data[property_name] = value
|
||||
row_dict = {k: v for k, v in data.items() if v}
|
||||
row_content = ''
|
||||
for key, value in row_dict.items():
|
||||
if isinstance(value, dict):
|
||||
value_dict = {k: v for k, v in value.items() if v}
|
||||
value_content = ''.join(f'{k}:{v} ' for k, v in value_dict.items())
|
||||
row_content = row_content + f'{key}:{value_content}\n'
|
||||
else:
|
||||
row_content = row_content + f'{key}:{value}\n'
|
||||
database_content_list.append(row_content)
|
||||
database_content_list.append(json.dumps(data, ensure_ascii=False))
|
||||
|
||||
return "\n\n".join(database_content_list)
|
||||
|
Loading…
Reference in New Issue
Block a user