Skip to content

Commit

Permalink
update: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfung committed Dec 18, 2024
1 parent a38b499 commit d9a4868
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions clients/tabby-chat-panel/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export interface ClientApiMethods {
openInEditor: (target: FileLocation) => Promise<boolean>

// Provide all repos found in workspace folders.
readWorkspaceGitRepositories?: () => Promise<GitRepoInfo[]>
readWorkspaceGitRepositories?: () => Promise<GitRepository[]>
}

export interface ClientApi extends ClientApiMethods {
Expand Down Expand Up @@ -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,
},
})
}
Expand Down
6 changes: 3 additions & 3 deletions ee/tabby-ui/app/chat/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export default function ChatPage() {
.then(setSupportsOnApplyInEditorV2)
server?.hasCapability('lookupSymbol').then(setSupportsOnLookupSymbol)
server
?.hasCapability('provideWorkspaceGitRepoInfo')
?.hasCapability('readWorkspaceGitRepositories')
.then(setSupportsProvideWorkspaceGitRepoInfo)
}

Expand Down Expand Up @@ -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
}
/>
Expand Down
16 changes: 8 additions & 8 deletions ee/tabby-ui/components/chat/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
Context,
FileContext,
FileLocation,
GitRepoInfo,
GitRepository,
LookupSymbolHint,
NavigateOpts,
SymbolInfo
Expand Down Expand Up @@ -125,7 +125,7 @@ interface ChatProps extends React.ComponentProps<'div'> {
openInEditor?: (target: FileLocation) => void
chatInputRef: RefObject<HTMLTextAreaElement>
supportsOnApplyInEditorV2: boolean
provideWorkspaceGitRepoInfo?: () => Promise<GitRepoInfo[]>
readWorkspaceGitRepositories?: () => Promise<GitRepository[]>
}

function ChatRenderer(
Expand All @@ -149,7 +149,7 @@ function ChatRenderer(
openInEditor,
chatInputRef,
supportsOnApplyInEditorV2,
provideWorkspaceGitRepoInfo
readWorkspaceGitRepositories
}: ChatProps,
ref: React.ForwardedRef<ChatRef>
) {
Expand Down Expand Up @@ -526,19 +526,19 @@ function ChatRenderer(
}

const fetchWorkspaceGitRepo = () => {
if (provideWorkspaceGitRepoInfo) {
return provideWorkspaceGitRepoInfo()
if (readWorkspaceGitRepositories) {
return readWorkspaceGitRepositories()
} else {
return []
}
}

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)
Expand Down

0 comments on commit d9a4868

Please sign in to comment.