From c3275dfd361cfcf8e03effd2d17e2c25ea14ebf1 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 19 Dec 2023 17:22:54 +0800 Subject: [PATCH] fix: not return annotation author error happens (#1793) --- .../app/annotation/header-opts/index.tsx | 3 ++- web/app/components/app/chat/answer/index.tsx | 2 +- web/app/components/app/log/list.tsx | 2 +- web/app/components/base/popover/index.tsx | 16 +++++++++------- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/web/app/components/app/annotation/header-opts/index.tsx b/web/app/components/app/annotation/header-opts/index.tsx index 6f1296d252..738aa0bb9c 100644 --- a/web/app/components/app/annotation/header-opts/index.tsx +++ b/web/app/components/app/annotation/header-opts/index.tsx @@ -114,7 +114,8 @@ const HeaderOptions: FC = ({ ) } // !w-[208px] - className={'!w-[131px] h-fit !z-20'} + className={'!w-[135px] h-fit !z-20'} + popupClassName='!w-full' manualClose /> {showAddModal && ( diff --git a/web/app/components/app/chat/answer/index.tsx b/web/app/components/app/chat/answer/index.tsx index 0bd6971ebf..3340fc6c64 100644 --- a/web/app/components/app/chat/answer/index.tsx +++ b/web/app/components/app/chat/answer/index.tsx @@ -247,7 +247,7 @@ const Answer: FC = ({ )} diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx index 32a64ec0ac..1486aed7e4 100644 --- a/web/app/components/app/log/list.tsx +++ b/web/app/components/app/log/list.tsx @@ -100,7 +100,7 @@ const getFormattedChatList = (messages: ChatMessage[]) => { if (item.annotation_hit_history) { return { id: item.annotation_hit_history.annotation_id, - authorName: item.annotation_hit_history.annotation_create_account.name, + authorName: item.annotation_hit_history.annotation_create_account?.name || 'N/A', created_at: item.annotation_hit_history.created_at, } } diff --git a/web/app/components/base/popover/index.tsx b/web/app/components/base/popover/index.tsx index 925adc99fb..26d17c4405 100644 --- a/web/app/components/base/popover/index.tsx +++ b/web/app/components/base/popover/index.tsx @@ -1,5 +1,6 @@ import { Popover, Transition } from '@headlessui/react' import { Fragment, cloneElement, useRef } from 'react' +import cn from 'classnames' import s from './style.module.css' export type HtmlContentProps = { @@ -10,6 +11,7 @@ export type HtmlContentProps = { type IPopover = { className?: string htmlContent: React.ReactElement + popupClassName?: string trigger?: 'click' | 'hover' position?: 'bottom' | 'br' btnElement?: string | React.ReactNode @@ -23,6 +25,7 @@ export default function CustomPopover({ trigger = 'hover', position = 'bottom', htmlContent, + popupClassName, btnElement, className, btnClassName, @@ -57,12 +60,11 @@ export default function CustomPopover({ > {btnElement} @@ -80,7 +82,7 @@ export default function CustomPopover({ > {({ close }) => (