From d9a486862c0c408fd52437dde3786c5027a31d23 Mon Sep 17 00:00:00 2001 From: liangfung Date: Wed, 18 Dec 2024 13:58:19 +0700 Subject: [PATCH] update: rename --- clients/tabby-chat-panel/src/index.ts | 4 ++-- ee/tabby-ui/app/chat/page.tsx | 6 +++--- ee/tabby-ui/components/chat/chat.tsx | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/clients/tabby-chat-panel/src/index.ts b/clients/tabby-chat-panel/src/index.ts index a14e05653acb..08f419e295f7 100644 --- a/clients/tabby-chat-panel/src/index.ts +++ b/clients/tabby-chat-panel/src/index.ts @@ -233,7 +233,7 @@ export interface ClientApiMethods { openInEditor: (target: FileLocation) => Promise // Provide all repos found in workspace folders. - readWorkspaceGitRepositories?: () => Promise + readWorkspaceGitRepositories?: () => Promise } export interface ClientApi extends ClientApiMethods { @@ -268,7 +268,7 @@ export function createClient(target: HTMLIFrameElement, api: ClientApiMethods): onKeyboardEvent: api.onKeyboardEvent, lookupSymbol: api.lookupSymbol, openInEditor: api.openInEditor, - provideWorkspaceGitRepoInfo: api.provideWorkspaceGitRepoInfo, + readWorkspaceGitRepositories: api.readWorkspaceGitRepositories, }, }) } diff --git a/ee/tabby-ui/app/chat/page.tsx b/ee/tabby-ui/app/chat/page.tsx index 880ea1edc09c..3fdc0d0f2c67 100644 --- a/ee/tabby-ui/app/chat/page.tsx +++ b/ee/tabby-ui/app/chat/page.tsx @@ -243,7 +243,7 @@ export default function ChatPage() { .then(setSupportsOnApplyInEditorV2) server?.hasCapability('lookupSymbol').then(setSupportsOnLookupSymbol) server - ?.hasCapability('provideWorkspaceGitRepoInfo') + ?.hasCapability('readWorkspaceGitRepositories') .then(setSupportsProvideWorkspaceGitRepoInfo) } @@ -402,9 +402,9 @@ export default function ChatPage() { (supportsOnLookupSymbol ? server?.lookupSymbol : undefined) } openInEditor={isInEditor && server?.openInEditor} - provideWorkspaceGitRepoInfo={ + readWorkspaceGitRepositories={ isInEditor && supportsProvideWorkspaceGitRepoInfo - ? server?.provideWorkspaceGitRepoInfo + ? server?.readWorkspaceGitRepositories : undefined } /> diff --git a/ee/tabby-ui/components/chat/chat.tsx b/ee/tabby-ui/components/chat/chat.tsx index 1d55a45c64ad..89b583c4c1ad 100644 --- a/ee/tabby-ui/components/chat/chat.tsx +++ b/ee/tabby-ui/components/chat/chat.tsx @@ -4,7 +4,7 @@ import type { Context, FileContext, FileLocation, - GitRepoInfo, + GitRepository, LookupSymbolHint, NavigateOpts, SymbolInfo @@ -125,7 +125,7 @@ interface ChatProps extends React.ComponentProps<'div'> { openInEditor?: (target: FileLocation) => void chatInputRef: RefObject supportsOnApplyInEditorV2: boolean - provideWorkspaceGitRepoInfo?: () => Promise + readWorkspaceGitRepositories?: () => Promise } function ChatRenderer( @@ -149,7 +149,7 @@ function ChatRenderer( openInEditor, chatInputRef, supportsOnApplyInEditorV2, - provideWorkspaceGitRepoInfo + readWorkspaceGitRepositories }: ChatProps, ref: React.ForwardedRef ) { @@ -526,8 +526,8 @@ function ChatRenderer( } const fetchWorkspaceGitRepo = () => { - if (provideWorkspaceGitRepoInfo) { - return provideWorkspaceGitRepoInfo() + if (readWorkspaceGitRepositories) { + return readWorkspaceGitRepositories() } else { return [] } @@ -535,10 +535,10 @@ function ChatRenderer( React.useEffect(() => { const init = async () => { - const gitRepoInfo = await fetchWorkspaceGitRepo() + const workspaceGitRepositories = await fetchWorkspaceGitRepo() // get default repo - if (gitRepoInfo?.length && repos?.length) { - const defaultGitUrl = gitRepoInfo[0].gitUrl + if (workspaceGitRepositories?.length && repos?.length) { + const defaultGitUrl = workspaceGitRepositories[0].url const targetGirUrl = findClosestRepositoryMatch( defaultGitUrl, repos.map(x => x.gitUrl)