Skip to content

Commit

Permalink
update: check capability
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfung committed Dec 2, 2024
1 parent 8f7d75d commit 32bcd9d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ee/tabby-ui/app/chat/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default function ChatPage() {
// server feature support check
const [supportsOnApplyInEditorV2, setSupportsOnApplyInEditorV2] =
useState(false)
const [supportsOnOpenExternal, setSupportsOnOpenExternal] = useState(false)

const sendMessage = (message: ChatMessage) => {
if (chatRef.current) {
Expand Down Expand Up @@ -236,6 +237,8 @@ export default function ChatPage() {
server
?.hasCapability('onApplyInEditorV2')
.then(setSupportsOnApplyInEditorV2)

server?.hasCapability('onOpenExternal').then(setSupportsOnOpenExternal)
}

checkCapabilities()
Expand Down Expand Up @@ -276,9 +279,7 @@ export default function ChatPage() {
}

const onOpenExternal = useMemo(() => {
// FIXME check capability
const hasCapability = true
if (isInEditor && !hasCapability) {
if (isInEditor && !supportsOnOpenExternal) {
return undefined
}

Expand All @@ -290,7 +291,7 @@ export default function ChatPage() {
return !!success
}
}
}, [isInEditor, server])
}, [isInEditor, server, supportsOnOpenExternal])

const refresh = async () => {
setIsRefreshLoading(true)
Expand Down

0 comments on commit 32bcd9d

Please sign in to comment.