Add flags

This commit is contained in:
Adria Navarro 2025-04-11 12:19:18 +02:00
parent 21a55d5b93
commit f4b6c6084e
2 changed files with 14 additions and 4 deletions

View File

@ -1,9 +1,13 @@
<script lang="ts">
import { API } from "@/api"
import { featureFlag } from "@/helpers"
import { ActionButton, Input } from "@budibase/bbui"
import { FeatureFlag } from "@budibase/types"
let prompt: string
$: isEnabled = featureFlag.isEnabled(FeatureFlag.AI_TABLE_GENERATION)
async function submitPrompt(message: string) {
await API.generateTables(message)
}
@ -23,17 +27,21 @@
bind:value={prompt}
placeholder="Generate data using AI..."
on:keydown={onInputKeydown}
disabled={!isEnabled}
/>
</div>
{#each ["Create a table called tickets with title, description, status fields", "Create a table called students with name and address fields"] as prompt}
<ActionButton on:click={() => submitPrompt(prompt)}>{prompt}</ActionButton>
{/each}
{#if isEnabled}
{#each ["Create a table called tickets with title, description, status fields", "Create a table called students with name and address fields"] as prompt}
<ActionButton on:click={() => submitPrompt(prompt)}>{prompt}</ActionButton
>
{/each}
{/if}
</div>
<style>
.ai-generation {
max-width: 753px;
width: 753px;
display: grid;
gap: 10px;

View File

@ -1,6 +1,7 @@
export enum FeatureFlag {
USE_ZOD_VALIDATOR = "USE_ZOD_VALIDATOR",
AI_JS_GENERATION = "AI_JS_GENERATION",
AI_TABLE_GENERATION = "AI_TABLE_GENERATION",
// Account-portal
DIRECT_LOGIN_TO_ACCOUNT_PORTAL = "DIRECT_LOGIN_TO_ACCOUNT_PORTAL",
@ -9,6 +10,7 @@ export enum FeatureFlag {
export const FeatureFlagDefaults: Record<FeatureFlag, boolean> = {
[FeatureFlag.USE_ZOD_VALIDATOR]: false,
[FeatureFlag.AI_JS_GENERATION]: false,
[FeatureFlag.AI_TABLE_GENERATION]: false,
// Account-portal
[FeatureFlag.DIRECT_LOGIN_TO_ACCOUNT_PORTAL]: false,