From 2bd71d722b190fb05e100898ba0c6d7fab4ea468 Mon Sep 17 00:00:00 2001 From: balibabu Date: Fri, 13 Sep 2024 12:31:31 +0800 Subject: [PATCH] feat: Modify the style of the answer card on the search page #2247 (#2412) ### What problem does this PR solve? feat: Modify the style of the answer card on the search page #2247 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- .../components/highlight-markdown/index.tsx | 4 +- web/src/locales/en.ts | 1 + web/src/locales/zh-traditional.ts | 1 + web/src/locales/zh.ts | 1 + web/src/pages/search/index.less | 18 +++++-- web/src/pages/search/index.tsx | 50 ++++++++++++------- 6 files changed, 51 insertions(+), 24 deletions(-) diff --git a/web/src/components/highlight-markdown/index.tsx b/web/src/components/highlight-markdown/index.tsx index faad4bf0c..57eda455e 100644 --- a/web/src/components/highlight-markdown/index.tsx +++ b/web/src/components/highlight-markdown/index.tsx @@ -8,16 +8,14 @@ import styles from './index.less'; const HightLightMarkdown = ({ children, - className, }: { children: string | null | undefined; - className?: string; }) => { return ( p { + background: rgb(232 242 251 / 70%); + box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.08); + :global(.ant-card-head) { + background-color: #e6f4ff; + } + & p { margin: 0; } } diff --git a/web/src/pages/search/index.tsx b/web/src/pages/search/index.tsx index f236c8c70..3cba299ab 100644 --- a/web/src/pages/search/index.tsx +++ b/web/src/pages/search/index.tsx @@ -25,13 +25,14 @@ import { Spin, Tag, } from 'antd'; +import DOMPurify from 'dompurify'; +import { isEmpty } from 'lodash'; import { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import MarkdownContent from '../chat/markdown-content'; import { useFetchBackgroundImage, useSendQuestion } from './hooks'; -import SearchSidebar from './sidebar'; - import styles from './index.less'; +import SearchSidebar from './sidebar'; const { Content } = Layout; const { Search } = Input; @@ -123,16 +124,28 @@ const SearchPage = () => { className={isMindMapEmpty ? styles.largeMain : styles.main} > {InputSearch} - {answer.answer && ( -
- -
- )} + + + {t('chat.answerTitle')} + + } + className={styles.answerWrapper} + > + {isEmpty(answer) && sendingLoading ? ( + + ) : ( + answer.answer && ( + + ) + )} + { } > -
- - {item.highlight} - -
+