Parcourir la source

chore: lint code to remove unused imports and variables (#7033)

DDDDD12138 il y a 8 mois
Parent
commit
4c4f6e362f

+ 0 - 1
web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx

@@ -117,7 +117,6 @@ const Panel: FC = () => {
     // eslint-disable-next-line react-hooks/exhaustive-deps
   }, [])
 
-  const [isFold, setFold] = useState(false)
   const [controlShowPopup, setControlShowPopup] = useState<number>(0)
   const showPopup = useCallback(() => {
     setControlShowPopup(Date.now())

+ 1 - 1
web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx

@@ -79,7 +79,7 @@ const EditItem: FC<Props> = ({
                 {!readonly && (
                   <div
                     className='flex items-center space-x-1 leading-[18px] text-xs font-medium text-[#155EEF] cursor-pointer'
-                    onClick={(e) => {
+                    onClick={() => {
                       setIsEdit(true)
                     }}
                   >

+ 1 - 1
web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx

@@ -24,7 +24,7 @@ const ConfirmAddVar: FC<IConfirmAddVarProps> = ({
   varNameArr,
   onConfrim,
   onCancel,
-  onHide,
+  // onHide,
 }) => {
   const { t } = useTranslation()
   const mainContentRef = useRef<HTMLDivElement>(null)

+ 0 - 1
web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx

@@ -69,7 +69,6 @@ const Prompt: FC<ISimplePromptInput> = ({
     hasSetBlockStatus,
     showSelectDataSet,
     externalDataToolsConfig,
-    isAgent,
   } = useContext(ConfigContext)
   const { notify } = useToastContext()
   const { setShowExternalDataToolModal } = useModalContext()

+ 1 - 1
web/app/components/app/overview/appCard.tsx

@@ -53,7 +53,7 @@ function AppCard({
 }: IAppCardProps) {
   const router = useRouter()
   const pathname = usePathname()
-  const { currentWorkspace, isCurrentWorkspaceManager, isCurrentWorkspaceEditor } = useAppContext()
+  const { isCurrentWorkspaceManager, isCurrentWorkspaceEditor } = useAppContext()
   const [showSettingsModal, setShowSettingsModal] = useState(false)
   const [showEmbedded, setShowEmbedded] = useState(false)
   const [showCustomizeModal, setShowCustomizeModal] = useState(false)

+ 0 - 1
web/app/components/base/agent-log-modal/result.tsx

@@ -21,7 +21,6 @@ type ResultPanelProps = {
 }
 
 const ResultPanel: FC<ResultPanelProps> = ({
-  status,
   elapsed_time,
   total_tokens,
   error,

+ 0 - 2
web/app/components/base/block-input/index.tsx

@@ -49,8 +49,6 @@ const BlockInput: FC<IBlockInputProps> = ({
     setCurrentValue(value)
   }, [value])
 
-  const isContentChanged = value !== currentValue
-
   const contentEditableRef = useRef<HTMLTextAreaElement>(null)
   const [isEditing, setIsEditing] = useState<boolean>(false)
   useEffect(() => {

+ 0 - 7
web/app/components/base/chat/chat/thought/index.tsx

@@ -1,14 +1,10 @@
 'use client'
 import type { FC } from 'react'
 import React from 'react'
-import { useContext } from 'use-context-selector'
 import type { ThoughtItem, ToolInfoInThought } from '../type'
 import Tool from '@/app/components/base/chat/chat/thought/tool'
 import type { Emoji } from '@/app/components/tools/types'
 
-import I18n from '@/context/i18n'
-import { getLanguage } from '@/i18n/language'
-
 export type IThoughtProps = {
   thought: ThoughtItem
   allToolIcons: Record<string, string | Emoji>
@@ -31,9 +27,6 @@ const Thought: FC<IThoughtProps> = ({
   allToolIcons,
   isFinished,
 }) => {
-  const { locale } = useContext(I18n)
-  const language = getLanguage(locale)
-
   const [toolNames, isValueArray]: [string[], boolean] = (() => {
     try {
       if (Array.isArray(JSON.parse(thought.tool)))

+ 0 - 3
web/app/components/billing/vector-space-full/index.tsx

@@ -6,13 +6,10 @@ import UpgradeBtn from '../upgrade-btn'
 import VectorSpaceInfo from '../usage-info/vector-space-info'
 import s from './style.module.css'
 import cn from '@/utils/classnames'
-import { useProviderContext } from '@/context/provider-context'
 import GridMask from '@/app/components/base/grid-mask'
 
 const VectorSpaceFull: FC = () => {
   const { t } = useTranslation()
-  const { plan } = useProviderContext()
-  const { total } = plan
 
   return (
     <GridMask wrapperClassName='border border-gray-200 rounded-xl' canvasClassName='rounded-xl' gradientClassName='rounded-xl'>

+ 0 - 3
web/app/components/datasets/hit-testing/textarea.tsx

@@ -1,4 +1,3 @@
-import { useContext } from 'use-context-selector'
 import { useTranslation } from 'react-i18next'
 import Button from '../../base/button'
 import Tag from '../../base/tag'
@@ -6,7 +5,6 @@ import Tooltip from '../../base/tooltip'
 import { getIcon } from '../common/retrieval-method-info'
 import s from './style.module.css'
 import cn from '@/utils/classnames'
-import DatasetDetailContext from '@/context/dataset-detail'
 import type { HitTestingResponse } from '@/models/datasets'
 import { hitTesting } from '@/service/datasets'
 import { asyncRunSafe } from '@/utils'
@@ -40,7 +38,6 @@ const TextAreaWithButton = ({
   onSubmit: _onSubmit,
 }: TextAreaWithButtonIProps) => {
   const { t } = useTranslation()
-  const { indexingTechnique } = useContext(DatasetDetailContext)
 
   function handleTextChange(event: any) {
     setText(event.target.value)