mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 14:49:10 +03:00
* Change the getEntityDefinitions query to accept list of schemas instead of being hardcoded to public schema. * Add a schema combo box for selecting schemas. * Use the combobox in the SQL editor to select which schemas should be sent to the AI when asking a question. * Add configurable schemas to AiPolicyEditor. * Remove unneeded hook. * Fix the AI settings modal. * Add keys to the entity definitions query. * Fix the AI settings modal which is used by cmdk flow. * Minor fixes. * Address feedback * Some fixes --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
20 lines
553 B
TypeScript
20 lines
553 B
TypeScript
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
|
|
import { LOCAL_STORAGE_KEYS } from 'lib/constants'
|
|
import { Dispatch, SetStateAction } from 'react'
|
|
|
|
/**
|
|
* Returns which schemas are ok to be sent to AI.
|
|
*/
|
|
export function useSchemasForAi(
|
|
ref: string
|
|
): readonly [string[], Dispatch<SetStateAction<string[]>>] {
|
|
const [enabledSchemas, setEnabledSchemas] = useLocalStorageQuery(
|
|
LOCAL_STORAGE_KEYS.SQL_EDITOR_AI_SCHEMA(ref),
|
|
['public']
|
|
)
|
|
|
|
if (!ref) return [[], () => {}]
|
|
|
|
return [enabledSchemas, setEnabledSchemas]
|
|
}
|