mirror of
https://github.com/teableio/teable.git
synced 2026-03-23 00:04:56 +08:00
Synced from teableio/teable-ee@9c0fd6f Co-authored-by: Aries X <caoxing9@gmail.com>
This commit is contained in:
parent
90e3561ac6
commit
9d20ee508d
@ -1,13 +1,14 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { getAIConfig } from '@teable/openapi';
|
||||
import { useBaseId } from '@teable/sdk/hooks';
|
||||
import { useBaseId, useIsReadOnlyPreview } from '@teable/sdk/hooks';
|
||||
|
||||
export function useAI() {
|
||||
const baseId = useBaseId() as string;
|
||||
const isReadOnlyPreview = useIsReadOnlyPreview();
|
||||
const { data } = useQuery({
|
||||
queryKey: ['ai-config', baseId],
|
||||
queryFn: () => getAIConfig(baseId).then(({ data }) => data),
|
||||
enabled: Boolean(baseId),
|
||||
enabled: Boolean(baseId) && !isReadOnlyPreview,
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user