Co-authored-by: siqiuchen <siqiu.chen2@dentsplysirona.com>
This commit is contained in:
@@ -191,6 +191,7 @@ function DetailPanel({ detail, onFeedback }: IDetailPanel) {
|
|||||||
const { userProfile: { timezone } } = useAppContext()
|
const { userProfile: { timezone } } = useAppContext()
|
||||||
const { formatTime } = useTimestamp()
|
const { formatTime } = useTimestamp()
|
||||||
const { onClose, appDetail } = useContext(DrawerContext)
|
const { onClose, appDetail } = useContext(DrawerContext)
|
||||||
|
const { notify } = useContext(ToastContext)
|
||||||
const { currentLogItem, setCurrentLogItem, showMessageLogModal, setShowMessageLogModal, showPromptLogModal, setShowPromptLogModal, currentLogModalActiveTab } = useAppStore(useShallow(state => ({
|
const { currentLogItem, setCurrentLogItem, showMessageLogModal, setShowMessageLogModal, showPromptLogModal, setShowPromptLogModal, currentLogModalActiveTab } = useAppStore(useShallow(state => ({
|
||||||
currentLogItem: state.currentLogItem,
|
currentLogItem: state.currentLogItem,
|
||||||
setCurrentLogItem: state.setCurrentLogItem,
|
setCurrentLogItem: state.setCurrentLogItem,
|
||||||
@@ -312,18 +313,34 @@ function DetailPanel({ detail, onFeedback }: IDetailPanel) {
|
|||||||
return item
|
return item
|
||||||
}))
|
}))
|
||||||
}, [allChatItems])
|
}, [allChatItems])
|
||||||
const handleAnnotationRemoved = useCallback((index: number) => {
|
const handleAnnotationRemoved = useCallback(async (index: number): Promise<boolean> => {
|
||||||
setAllChatItems(allChatItems.map((item, i) => {
|
const annotation = allChatItems[index]?.annotation
|
||||||
if (i === index) {
|
|
||||||
return {
|
try {
|
||||||
...item,
|
if (annotation?.id) {
|
||||||
content: item.content,
|
const { delAnnotation } = await import('@/service/annotation')
|
||||||
annotation: undefined,
|
await delAnnotation(appDetail?.id || '', annotation.id)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return item
|
|
||||||
}))
|
setAllChatItems(allChatItems.map((item, i) => {
|
||||||
}, [allChatItems])
|
if (i === index) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
content: item.content,
|
||||||
|
annotation: undefined,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
}))
|
||||||
|
|
||||||
|
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}, [allChatItems, appDetail?.id, t])
|
||||||
|
|
||||||
const fetchInitiated = useRef(false)
|
const fetchInitiated = useRef(false)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user