From eb05318074e81c24a6313117a9eb471e39c832d6 Mon Sep 17 00:00:00 2001 From: PingChuan <1259732256@qq.com> Date: Tue, 9 Dec 2025 16:30:33 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E8=B0=83=E6=95=B4dify=E5=86=85?= =?UTF-8?q?=E5=B5=8C=E4=BE=A7=E8=BE=B9=E6=A0=8F=E3=80=81=E5=8F=AC=E5=9B=9E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E3=80=81=E9=A2=84=E8=A7=88=E5=9D=97=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/dify-chat/sidebar.tsx | 4 +- .../area-dataset-config.tsx | 2 +- .../dify-dataset-manager/layout.tsx | 2 +- .../dify-dataset-manager/retrieve-test.tsx | 151 ++++++------------ .../components/dify-dataset-manager/index.css | 14 +- 5 files changed, 67 insertions(+), 106 deletions(-) diff --git a/app/components/dify-chat/sidebar.tsx b/app/components/dify-chat/sidebar.tsx index b15d53f..a3eec13 100644 --- a/app/components/dify-chat/sidebar.tsx +++ b/app/components/dify-chat/sidebar.tsx @@ -407,7 +407,7 @@ const ChatSidebar = forwardRef(({ confirmLoading={renameLoading} okText="确定" cancelText="取消" - destroyOnClose + destroyOnHidden >
(({ okText="删除" cancelText="取消" okType="danger" - destroyOnClose + destroyOnHidden >

确定要删除会话 "{deletingConversation?.name}" 吗?

diff --git a/app/components/dify-dataset-manager/area-dataset-config.tsx b/app/components/dify-dataset-manager/area-dataset-config.tsx index f482750..b611f34 100644 --- a/app/components/dify-dataset-manager/area-dataset-config.tsx +++ b/app/components/dify-dataset-manager/area-dataset-config.tsx @@ -577,7 +577,7 @@ export default function AreaDatasetConfig() { ), value: ds.id, }))} - dropdownStyle={{ maxHeight: '300px' }} + styles={{ popup: { root: { maxHeight: '300px' } } }} /> diff --git a/app/components/dify-dataset-manager/layout.tsx b/app/components/dify-dataset-manager/layout.tsx index dec9eb5..64483e1 100644 --- a/app/components/dify-dataset-manager/layout.tsx +++ b/app/components/dify-dataset-manager/layout.tsx @@ -55,7 +55,7 @@ export default function DatasetLayout({ placeholder="选择知识库" suffixIcon={} popupMatchSelectWidth={false} - dropdownStyle={{ minWidth: 200 }} + styles={{ popup: { root: { minWidth: 200 } } }} > {availableDatasets.map(ds => ( diff --git a/app/components/dify-dataset-manager/retrieve-test.tsx b/app/components/dify-dataset-manager/retrieve-test.tsx index 8a6c7bd..06a8c74 100644 --- a/app/components/dify-dataset-manager/retrieve-test.tsx +++ b/app/components/dify-dataset-manager/retrieve-test.tsx @@ -1,5 +1,5 @@ -import { SearchOutlined, FileSearchOutlined } from '@ant-design/icons'; -import { Button, Tag, Input, Slider, Spin, Select, Flex, Switch, InputNumber, Tooltip } from 'antd'; +import { FileSearchOutlined, SearchOutlined } from '@ant-design/icons'; +import { Button, Card, Flex, Input, InputNumber, Select, Slider, Spin, Switch, Tag, Tooltip } from 'antd'; import type { RetrieveRecord } from '~/api/dify-dataset/type'; import { useRetrieveTest } from '~/hooks/dify-dataset-manager/retrieve-test'; import type { RetrieveTestProps } from '~/types/dify-dataset-manager/retrieve-test'; @@ -25,62 +25,46 @@ function ResultItem({ record, index }: { record: RetrieveRecord; index: number } const scoreColor = record.score > 0.8 ? '#52c41a' : record.score > 0.5 ? '#faad14' : '#666'; return ( - - - - +
+
+
+ {scorePercent}% - - #{index + 1} · {record.segment.word_count} 字 · 命中 {record.segment.hit_count} 次 + #{index + 1} + + {record.segment.word_count} 字 · 命中 {record.segment.hit_count} 次 - +
{record.segment.document && ( - + 来源: {record.segment.document.name} )} - -
+
+
{record.segment.content.length > 500 ? record.segment.content.substring(0, 500) + '...' : record.segment.content}
{record.segment.answer && ( - - +
+ 答案: - + {record.segment.answer.length > 200 ? record.segment.answer.substring(0, 200) + '...' : record.segment.answer} - +
)} -
+
); } @@ -277,63 +261,32 @@ export default function RetrieveTest({ datasetId }: RetrieveTestProps) { {/* 右侧面板 - 结果展示 */} - - {retrieving ? ( - - - - 检索中... - - - ) : retrieveResults.length === 0 ? ( - - - - 召回测试结果将展示在这里 - - - ) : ( - <> - - - 检索结果 +
+ + 检索结果 + + {retrieveResults.length > 0 ? `${retrieveResults.length} 条结果` : '0 条结果'} - - 共找到 {retrieveResults.length} 条结果 - - - +
+ } + className="preview-card" + > + {retrieving ? ( +
+ +
检索中...
+
+ ) : retrieveResults.length === 0 ? ( +
+
+ +
+

召回测试结果将展示在这里

+
+ ) : ( +
{retrieveResults.map((record, index) => ( ))} - - - )} - +
+ )} + +
); } diff --git a/app/styles/components/dify-dataset-manager/index.css b/app/styles/components/dify-dataset-manager/index.css index 2238583..c3339c9 100644 --- a/app/styles/components/dify-dataset-manager/index.css +++ b/app/styles/components/dify-dataset-manager/index.css @@ -6,7 +6,7 @@ .dataset-manager-wrapper { display: flex; flex-direction: column; - height: 100%; + height:90%; max-height: 100%; background: #fff; overflow: hidden; @@ -26,13 +26,14 @@ /* 左侧侧边栏 */ .dataset-sidebar { - width: 200px; - min-width: 200px; + width: 26vh; + min-width: 11vh; background: #fafafa; border-right: 1px solid #f0f0f0; display: flex; flex-direction: column; overflow: hidden; + max-height: 90vh; } /* 返回按钮 */ @@ -229,6 +230,7 @@ /* 右侧主内容区 */ .dataset-main { flex: 1; + height: 85vh; min-width: 0; display: flex; flex-direction: column; @@ -735,6 +737,7 @@ /* 右侧预览面板 */ .preview-panel { + height: 85vh; flex: 1; min-width: 0; background: #f5f5f5; @@ -852,6 +855,11 @@ display: flex; flex-direction: column; gap: 12px; + /* 关键修复:添加高度约束和内部滚动 */ + height: 100%; + min-height: 0; + overflow-y: auto; + overflow-x: hidden; } .segment-item {