// 'use client' // import type { FC } from 'react' // import React, { useRef, useState } from 'react' // import { useHover } from 'ahooks' // import { useTranslation } from 'react-i18next' // import cn from '@/utils/classnames' // import { MessageCheckRemove, MessageFastPlus } from '@/app/components/base/icons/src/vender/line/communication' // import { MessageFast } from '@/app/components/base/icons/src/vender/solid/communication' // import { Edit04 } from '@/app/components/base/icons/src/vender/line/general' // import RemoveAnnotationConfirmModal from '@/app/components/app/annotation/remove-annotation-confirm-modal' // import Tooltip from '@/app/components/base/tooltip' // import { addAnnotation, delAnnotation } from '@/service/annotation' // import Toast from '@/app/components/base/toast' // import { useProviderContext } from '@/context/provider-context' // import { useModalContext } from '@/context/modal-context' // type Props = { // appId: string // messageId?: string // annotationId?: string // className?: string // cached: boolean // query: string // answer: string // onAdded: (annotationId: string, authorName: string) => void // onEdit: () => void // onRemoved: () => void // } // const CacheCtrlBtn: FC = ({ // className, // cached, // query, // answer, // appId, // messageId, // annotationId, // onAdded, // onEdit, // onRemoved, // }) => { // const { t } = useTranslation() // const { plan, enableBilling } = useProviderContext() // const isAnnotationFull = (enableBilling && plan.usage.annotatedResponse >= plan.total.annotatedResponse) // const { setShowAnnotationFullModal } = useModalContext() // const [showModal, setShowModal] = useState(false) // const cachedBtnRef = useRef(null) // const isCachedBtnHovering = useHover(cachedBtnRef) // const handleAdd = async () => { // if (isAnnotationFull) { // setShowAnnotationFullModal() // return // } // const res: any = await addAnnotation(appId, { // message_id: messageId, // question: query, // answer, // }) // Toast.notify({ // message: t('common.api.actionSuccess') as string, // type: 'success', // }) // onAdded(res.id, res.account?.name) // } // const handleRemove = async () => { // await delAnnotation(appId, annotationId!) // Toast.notify({ // message: t('common.api.actionSuccess') as string, // type: 'success', // }) // onRemoved() // setShowModal(false) // } // return ( //
//
// {cached // ? ( //
//
setShowModal(true)} // > // {!isCachedBtnHovering // ? ( // <> // //
{t('appDebug.feature.annotation.cached')}
// // ) // : <> // //
{t('appDebug.feature.annotation.remove')}
// } //
//
// ) // : answer // ? ( // //
// //
//
// ) // : null // } // //
// //
//
//
// setShowModal(false)} // onRemove={handleRemove} // /> //
// ) // } // export default React.memo(CacheCtrlBtn) // TODO MARS