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: not return annotation author error happens (#1793)

Joelc3275dfd361c
diff --git a/web/app/components/app/annotation/header-opts/index.tsx b/web/app/components/app/annotation/header-opts/index.tsx
index 6f1296d2524..738aa0bb9c6 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<Props> = ({
)
}
// !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 0bd6971ebf7..3340fc6c648 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<IAnswerProps> = ({
<Markdown className='line-through !text-gray-400' content={content} />
</div>
<EditTitle title={t('appAnnotation.editBy', {
- author: annotation?.logAnnotation.account.name,
+ author: annotation?.logAnnotation.account?.name,
})} />
</div>
)}
diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx
index 32a64ec0ac3..1486aed7e47 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 925adc99fb6..26d17c44052 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<HtmlContentProps>
+ 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({
>
<Popover.Button
ref={buttonRef}
- className={`group ${s.popupBtn} ${open ? '' : 'bg-gray-100'} ${
- !btnClassName
- ? ''
- : typeof btnClassName === 'string'
- ? btnClassName
- : btnClassName?.(open)
+ className={`group ${s.popupBtn} ${open ? '' : 'bg-gray-100'} ${!btnClassName
+ ? ''
+ : typeof btnClassName === 'string'
+ ? btnClassName
+ : btnClassName?.(open)
}`}
>
{btnElement}
@@ -80,7 +82,7 @@ export default function CustomPopover({
>
{({ close }) => (
<div
- className={s.panelContainer}
+ className={cn(s.panelContainer, popupClassName)}
{...(trigger !== 'hover'
? {}
: {