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

This commit is contained in:
DDDDD12138 2024-08-07 13:04:44 +08:00 committed by GitHub
parent 1a302ca957
commit 4c4f6e362f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 3 additions and 21 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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