From 797768a1e0617dd001040b83d2f3f32e57192669 Mon Sep 17 00:00:00 2001 From: Zhiming Ma Date: Mon, 23 Dec 2024 22:05:47 +0800 Subject: [PATCH] fix: lint. --- ee/tabby-ui/app/chat/page.tsx | 2 +- .../app/files/components/chat-side-bar.tsx | 2 +- ee/tabby-ui/components/chat/chat-panel.tsx | 2 +- ee/tabby-ui/components/chat/chat.tsx | 16 ++++++++++------ ee/tabby-ui/components/chat/question-answer.tsx | 8 ++++---- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/ee/tabby-ui/app/chat/page.tsx b/ee/tabby-ui/app/chat/page.tsx index 2a6b1e68bf47..ff2278e6910a 100644 --- a/ee/tabby-ui/app/chat/page.tsx +++ b/ee/tabby-ui/app/chat/page.tsx @@ -53,7 +53,7 @@ export default function ChatPage() { const [activeChatId, setActiveChatId] = useState('') const [pendingCommand, setPendingCommand] = useState() const [pendingRelevantContexts, setPendingRelevantContexts] = useState< - ClientFileContext[] + ClientFileContext[] >([]) const [pendingActiveSelection, setPendingActiveSelection] = useState(null) diff --git a/ee/tabby-ui/app/files/components/chat-side-bar.tsx b/ee/tabby-ui/app/files/components/chat-side-bar.tsx index cf565daef923..a0cfedf8e907 100644 --- a/ee/tabby-ui/app/files/components/chat-side-bar.tsx +++ b/ee/tabby-ui/app/files/components/chat-side-bar.tsx @@ -78,7 +78,7 @@ export const ChatSideBar: React.FC = ({ }, openExternal: async (url: string) => { window.open(url, '_blank') - }, + } }) const getCommand = ({ action }: QuickActionEventPayload) => { diff --git a/ee/tabby-ui/components/chat/chat-panel.tsx b/ee/tabby-ui/components/chat/chat-panel.tsx index cf695881a1f3..0fe704e4a174 100644 --- a/ee/tabby-ui/components/chat/chat-panel.tsx +++ b/ee/tabby-ui/components/chat/chat-panel.tsx @@ -5,7 +5,6 @@ import type { UseChatHelpers } from 'ai/react' import { AnimatePresence, motion } from 'framer-motion' import { compact } from 'lodash-es' import { toast } from 'sonner' -import type { Context } from '@/lib/types' import { SLUG_TITLE_MAX_LENGTH } from '@/lib/constants' import { useCopyToClipboard } from '@/lib/hooks/use-copy-to-clipboard' @@ -13,6 +12,7 @@ import { updateEnableActiveSelection } from '@/lib/stores/chat-actions' import { useChatStore } from '@/lib/stores/chat-store' import { useMutation } from '@/lib/tabby/gql' import { setThreadPersistedMutation } from '@/lib/tabby/query' +import type { Context } from '@/lib/types' import { cn, getTitleFromMessages } from '@/lib/utils' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' diff --git a/ee/tabby-ui/components/chat/chat.tsx b/ee/tabby-ui/components/chat/chat.tsx index 74b112dd76ef..805cb7abeb40 100644 --- a/ee/tabby-ui/components/chat/chat.tsx +++ b/ee/tabby-ui/components/chat/chat.tsx @@ -6,7 +6,7 @@ import type { FileLocation, GitRepository, LookupSymbolHint, - SymbolInfo, + SymbolInfo } from 'tabby-chat-panel' import { useQuery } from 'urql' @@ -27,9 +27,9 @@ import { filename2prism } from '@/lib/language-utils' import { useChatStore } from '@/lib/stores/chat-store' import { ExtendedCombinedError } from '@/lib/types' import { + AssistantMessage, Context, FileContext, - AssistantMessage, MessageActionType, QuestionAnswerPair, UserMessage, @@ -37,10 +37,10 @@ import { } from '@/lib/types/chat' import { cn, - findClosestGitRepository, - getPromptForChatCommand, convertClientFileContext, + findClosestGitRepository, getFileLocationFromContext, + getPromptForChatCommand, nanoid } from '@/lib/utils' @@ -530,8 +530,12 @@ function ChatRenderer( 300 ) - const updateActiveSelection = (clientFileContext: ClientFileContext | null) => { - const context = clientFileContext ? convertClientFileContext(clientFileContext) : null + const updateActiveSelection = ( + clientFileContext: ClientFileContext | null + ) => { + const context = clientFileContext + ? convertClientFileContext(clientFileContext) + : null debouncedUpdateActiveSelection.run(context) } diff --git a/ee/tabby-ui/components/chat/question-answer.tsx b/ee/tabby-ui/components/chat/question-answer.tsx index 9934459d9550..9e69a2ad61a3 100644 --- a/ee/tabby-ui/components/chat/question-answer.tsx +++ b/ee/tabby-ui/components/chat/question-answer.tsx @@ -10,18 +10,18 @@ import { MARKDOWN_CITATION_REGEX } from '@/lib/constants/regex' import { useMe } from '@/lib/hooks/use-me' import { filename2prism } from '@/lib/language-utils' import { - Context, AssistantMessage, AttachmentCodeItem, + Context, QuestionAnswerPair, UserMessage } from '@/lib/types/chat' import { + buildCodeBrowserUrlForContext, cn, - getRangeFromAttachmentCode, - getRangeTextFromAttachmentCode, getFileLocationFromContext, - buildCodeBrowserUrlForContext, + getRangeFromAttachmentCode, + getRangeTextFromAttachmentCode } from '@/lib/utils' import { CopyButton } from '../copy-button'