Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: filter empty value in xlsx to improve vector similarity hit (#422)

[email protected]23ef2262bd4b
diff --git a/api/core/index/readers/xlsx_parser.py b/api/core/index/readers/xlsx_parser.py
index 6062e2ef3e6..6b38a1bf168 100644
--- a/api/core/index/readers/xlsx_parser.py
+++ b/api/core/index/readers/xlsx_parser.py
@@ -27,5 +27,7 @@ class XLSXParser(BaseParser):
if keys == []:
keys = list(map(str, row))
else:
- data.append(json.dumps(dict(zip(keys, list(map(str, row)))), ensure_ascii=False))
+ row_dict = dict(zip(keys, row))
+ row_dict = {k: v for k, v in row_dict.items() if v}
+ data.append(json.dumps(row_dict, ensure_ascii=False))
return '\n\n'.join(data)
diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx
index 2db9b7083f4..2ed48d16535 100644
--- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx
+++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx
@@ -124,7 +124,7 @@ const DatasetDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
? (
<>
<div className={s.subTitle}>{relatedApps?.total || '--'} {t('common.datasetMenus.relatedApp')}</div>
- {relatedApps?.data?.map(item => (<LikedItem detail={item} />))}
+ {relatedApps?.data?.map((item, index) => (<LikedItem key={index} detail={item} />))}
</>
)
: (
diff --git a/web/app/components/datasets/hit-testing/index.tsx b/web/app/components/datasets/hit-testing/index.tsx
index fae98b7cefe..ac510b11eab 100644
--- a/web/app/components/datasets/hit-testing/index.tsx
+++ b/web/app/components/datasets/hit-testing/index.tsx
@@ -137,8 +137,9 @@ const HitTesting: FC<Props> = ({ datasetId }: Props) => {
<div className='text-gray-600 font-semibold mb-4'>{t('datasetHitTesting.hit.title')}</div>
<div className='overflow-auto flex-1'>
<div className={s.cardWrapper}>
- {hitResult?.records.map((record) => {
+ {hitResult?.records.map((record, idx) => {
return <SegmentCard
+ key={idx}
loading={false}
detail={record.segment as any}
score={record.score}