lint
This commit is contained in:
parent
9a4a788283
commit
2dff149aa9
|
@ -106,7 +106,8 @@
|
|||
let optionsValid = true
|
||||
|
||||
$: rowGoldenSample = RowUtils.generateGoldenSample($rows)
|
||||
$: aiEnabled = $licensing.customAIConfigsEnabled || $licensing.budibaseAIEnabled
|
||||
$: aiEnabled =
|
||||
$licensing.customAIConfigsEnabled || $licensing.budibaseAIEnabled
|
||||
$: if (primaryDisplay) {
|
||||
editableColumn.constraints.presence = { allowEmpty: false }
|
||||
}
|
||||
|
|
|
@ -1,71 +1,12 @@
|
|||
<script>
|
||||
import { Input, Helpers, Multiselect, Select, TextArea } from "@budibase/bbui"
|
||||
import { Helpers, Multiselect, Select } from "@budibase/bbui"
|
||||
import ServerBindingPanel from "components/common/bindings/ServerBindingPanel.svelte"
|
||||
import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte"
|
||||
|
||||
const AIOperations = {
|
||||
SUMMARISE_TEXT: {
|
||||
label: "Summarise Text",
|
||||
value: "SUMMARISE_TEXT",
|
||||
},
|
||||
CLEAN_DATA: {
|
||||
label: "Clean Data",
|
||||
value: "CLEAN_DATA",
|
||||
},
|
||||
TRANSLATE: {
|
||||
label: "Translate",
|
||||
value: "TRANSLATE",
|
||||
},
|
||||
CATEGORISE_TEXT: {
|
||||
label: "Categorise Text",
|
||||
value: "CATEGORISE_TEXT",
|
||||
},
|
||||
SENTIMENT_ANALYSIS: {
|
||||
label: "Sentiment Analysis",
|
||||
value: "SENTIMENT_ANALYSIS",
|
||||
},
|
||||
PROMPT: {
|
||||
label: "Prompt",
|
||||
value: "PROMPT",
|
||||
},
|
||||
SEARCH_WEB: {
|
||||
label: "Search Web",
|
||||
value: "SEARCH_WEB",
|
||||
},
|
||||
}
|
||||
|
||||
const OperationFieldTypes = {
|
||||
MULTI_COLUMN: "columns",
|
||||
COLUMN: "column",
|
||||
BINDABLE_TEXT: "prompt",
|
||||
// LANGUAGE: "language",
|
||||
}
|
||||
|
||||
const OperationFields = {
|
||||
SUMMARISE_TEXT: {
|
||||
columns: OperationFieldTypes.MULTI_COLUMN,
|
||||
},
|
||||
CLEAN_DATA: {
|
||||
column: OperationFieldTypes.COLUMN,
|
||||
},
|
||||
TRANSLATE: {
|
||||
column: OperationFieldTypes.COLUMN,
|
||||
language: OperationFieldTypes.BINDABLE_TEXT,
|
||||
},
|
||||
CATEGORISE_TEXT: {
|
||||
columns: OperationFieldTypes.MULTI_COLUMN,
|
||||
categories: OperationFieldTypes.BINDABLE_TEXT,
|
||||
},
|
||||
SENTIMENT_ANALYSIS: {
|
||||
column: OperationFieldTypes.COLUMN,
|
||||
},
|
||||
PROMPT: {
|
||||
prompt: OperationFieldTypes.BINDABLE_TEXT,
|
||||
},
|
||||
SEARCH_WEB: {
|
||||
columns: OperationFieldTypes.MULTI_COLUMN,
|
||||
},
|
||||
}
|
||||
import {
|
||||
AIOperations,
|
||||
OperationFields,
|
||||
OperationFieldTypes,
|
||||
} from "@budibase/shared-core"
|
||||
|
||||
const AIFieldConfigOptions = Object.keys(AIOperations).map(key => ({
|
||||
label: AIOperations[key].label,
|
||||
|
@ -78,8 +19,6 @@
|
|||
export let aiField = {}
|
||||
|
||||
$: OperationField = OperationFields[aiField.operation] || null
|
||||
$: console.log(aiField)
|
||||
$: console.log(schema)
|
||||
$: schemaWithoutRelations = Object.keys(schema).filter(
|
||||
key => schema[key].type !== "link"
|
||||
)
|
||||
|
|
|
@ -42,11 +42,7 @@
|
|||
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
class="long-form-cell"
|
||||
on:click={open}
|
||||
bind:this={anchor}
|
||||
>
|
||||
<div class="long-form-cell" on:click={open} bind:this={anchor}>
|
||||
<div class="value">
|
||||
{value || ""}
|
||||
</div>
|
||||
|
|
|
@ -15,9 +15,7 @@ import {
|
|||
import { EventType, updateLinks } from "../../../../db/linkedRows"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
import isEqual from "lodash/isEqual"
|
||||
import {
|
||||
runStaticFormulaChecks,
|
||||
} from "../../../../api/controllers/table/bulkFormula"
|
||||
import { runStaticFormulaChecks } from "../../../../api/controllers/table/bulkFormula"
|
||||
import { context } from "@budibase/backend-core"
|
||||
import { findDuplicateInternalColumns } from "@budibase/shared-core"
|
||||
import { getTable } from "../getters"
|
||||
|
|
|
@ -8,7 +8,10 @@ import {
|
|||
FormulaType,
|
||||
AutoFieldSubType,
|
||||
FieldType,
|
||||
OperationFieldTypeEnum,
|
||||
AIFieldMetadata,
|
||||
} from "@budibase/types"
|
||||
import { OperationFields } from "@budibase/shared-core"
|
||||
import tracer from "dd-trace"
|
||||
import { context } from "@budibase/backend-core"
|
||||
import * as pro from "@budibase/pro"
|
||||
|
@ -116,12 +119,13 @@ export async function processAIColumns<T extends Row | Row[]>(
|
|||
|
||||
const rowUpdates = rows.map((row, i) => {
|
||||
const contextRow = contextRows ? contextRows[i] : row
|
||||
// TODO: Map the prompts with string-templates
|
||||
// grab the operation based on the schema
|
||||
// then check the types in the fields, and decide whether to pass them through string templates
|
||||
// TODO: cleaner way to map to the schema, move things into BB types and check against the AI schema
|
||||
|
||||
// Check if the type is bindable and pass through HBS if so
|
||||
const operationField =
|
||||
OperationFields[(schema as AIFieldMetadata).operation]
|
||||
for (const key in schema) {
|
||||
if (["prompt", "categories"].includes(key)) {
|
||||
const fieldType = operationField[key]
|
||||
if (fieldType === OperationFieldTypeEnum.BINDABLE_TEXT) {
|
||||
schema[key] = processStringSync(schema[key], contextRow)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
import {
|
||||
AIOperationEnum,
|
||||
OperationFieldsType,
|
||||
OperationFieldTypeEnum,
|
||||
} from "@budibase/types"
|
||||
|
||||
const AIOperations = {
|
||||
SUMMARISE_TEXT: {
|
||||
label: "Summarise Text",
|
||||
value: "SUMMARISE_TEXT",
|
||||
},
|
||||
CLEAN_DATA: {
|
||||
label: "Clean Data",
|
||||
value: "CLEAN_DATA",
|
||||
},
|
||||
TRANSLATE: {
|
||||
label: "Translate",
|
||||
value: "TRANSLATE",
|
||||
},
|
||||
CATEGORISE_TEXT: {
|
||||
label: "Categorise Text",
|
||||
value: "CATEGORISE_TEXT",
|
||||
},
|
||||
SENTIMENT_ANALYSIS: {
|
||||
label: "Sentiment Analysis",
|
||||
value: "SENTIMENT_ANALYSIS",
|
||||
},
|
||||
PROMPT: {
|
||||
label: "Prompt",
|
||||
value: "PROMPT",
|
||||
},
|
||||
SEARCH_WEB: {
|
||||
label: "Search Web",
|
||||
value: "SEARCH_WEB",
|
||||
},
|
||||
}
|
||||
|
||||
export const OperationFieldTypes = {
|
||||
MULTI_COLUMN: "columns",
|
||||
COLUMN: "column",
|
||||
BINDABLE_TEXT: "prompt",
|
||||
}
|
||||
|
||||
export const OperationFields: OperationFieldsType = {
|
||||
[AIOperationEnum.SUMMARISE_TEXT]: {
|
||||
columns: OperationFieldTypeEnum.MULTI_COLUMN,
|
||||
},
|
||||
[AIOperationEnum.CLEAN_DATA]: {
|
||||
column: OperationFieldTypeEnum.COLUMN,
|
||||
},
|
||||
[AIOperationEnum.TRANSLATE]: {
|
||||
column: OperationFieldTypeEnum.COLUMN,
|
||||
language: OperationFieldTypeEnum.BINDABLE_TEXT,
|
||||
},
|
||||
[AIOperationEnum.CATEGORISE_TEXT]: {
|
||||
columns: OperationFieldTypeEnum.MULTI_COLUMN,
|
||||
categories: OperationFieldTypeEnum.BINDABLE_TEXT,
|
||||
},
|
||||
[AIOperationEnum.SENTIMENT_ANALYSIS]: {
|
||||
column: OperationFieldTypeEnum.COLUMN,
|
||||
},
|
||||
[AIOperationEnum.PROMPT]: {
|
||||
prompt: OperationFieldTypeEnum.BINDABLE_TEXT,
|
||||
},
|
||||
[AIOperationEnum.SEARCH_WEB]: {
|
||||
columns: OperationFieldTypeEnum.MULTI_COLUMN,
|
||||
},
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
export * from "./ai"
|
||||
export * from "./api"
|
||||
export * from "./fields"
|
||||
export * from "./rows"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
export * from "./ai"
|
||||
export * from "./app"
|
||||
export * from "./automation"
|
||||
export * from "./datasource"
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
JsonFieldSubType,
|
||||
RelationshipType,
|
||||
} from "./constants"
|
||||
import { AIOperationEnum } from "../ai"
|
||||
import { AIOperationEnum } from "../../../sdk/ai"
|
||||
|
||||
export interface UIFieldMetadata {
|
||||
order?: number
|
||||
|
|
|
@ -8,13 +8,13 @@ export enum AIOperationEnum {
|
|||
SEARCH_WEB = "SEARCH_WEB",
|
||||
}
|
||||
|
||||
enum OperationFieldTypeEnum {
|
||||
export enum OperationFieldTypeEnum {
|
||||
MULTI_COLUMN = "columns",
|
||||
COLUMN = "column",
|
||||
BINDABLE_TEXT = "prompt",
|
||||
}
|
||||
|
||||
type OperationFieldsType = {
|
||||
export type OperationFieldsType = {
|
||||
[AIOperationEnum.SUMMARISE_TEXT]: {
|
||||
columns: OperationFieldTypeEnum.MULTI_COLUMN
|
||||
}
|
||||
|
@ -40,17 +40,6 @@ type OperationFieldsType = {
|
|||
}
|
||||
}
|
||||
|
||||
// Define the AI operations with just their labels (no need for separate 'value' property)
|
||||
const AIOperations: { [key in AIOperationEnum]: string } = {
|
||||
[AIOperationEnum.SUMMARISE_TEXT]: "Summarise Text",
|
||||
[AIOperationEnum.CLEAN_DATA]: "Clean Data",
|
||||
[AIOperationEnum.TRANSLATE]: "Translate",
|
||||
[AIOperationEnum.CATEGORISE_TEXT]: "Categorise Text",
|
||||
[AIOperationEnum.SENTIMENT_ANALYSIS]: "Sentiment Analysis",
|
||||
[AIOperationEnum.PROMPT]: "Prompt",
|
||||
[AIOperationEnum.SEARCH_WEB]: "Search Web",
|
||||
}
|
||||
|
||||
type BaseSchema = {
|
||||
operation: AIOperationEnum
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
export * from "./ai"
|
||||
export * from "./automations"
|
||||
export * from "./hosting"
|
||||
export * from "./context"
|
||||
|
|
Loading…
Reference in New Issue