lint and types
This commit is contained in:
parent
97a7649930
commit
95d8ad854c
|
@ -343,12 +343,6 @@ describe("/datasources", () => {
|
|||
type: FieldType.FORMULA,
|
||||
formula: "any formula",
|
||||
},
|
||||
[FieldType.AI]: {
|
||||
name: "ai",
|
||||
type: FieldType.AI,
|
||||
operation: "PROMPT",
|
||||
prompt: "test prompt",
|
||||
},
|
||||
[FieldType.BARCODEQR]: {
|
||||
name: "barcodeqr",
|
||||
type: FieldType.BARCODEQR,
|
||||
|
|
|
@ -206,7 +206,7 @@ describe.each([
|
|||
visible: false,
|
||||
icon: "ic",
|
||||
},
|
||||
} as Record<string, FieldSchema>,
|
||||
} as ViewV2Schema,
|
||||
}
|
||||
|
||||
const createdView = await config.api.viewV2.create(newView)
|
||||
|
@ -250,7 +250,7 @@ describe.each([
|
|||
name: "Category",
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
} as Record<string, FieldSchema>,
|
||||
} as ViewV2Schema,
|
||||
}
|
||||
|
||||
await config.api.viewV2.create(newView, {
|
||||
|
@ -1044,7 +1044,7 @@ describe.each([
|
|||
visible: false,
|
||||
icon: "ic",
|
||||
},
|
||||
} as Record<string, FieldSchema>,
|
||||
} as ViewV2Schema,
|
||||
})
|
||||
|
||||
expect(updatedView).toEqual({
|
||||
|
@ -1078,7 +1078,7 @@ describe.each([
|
|||
name: "Category",
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
} as Record<string, FieldSchema>,
|
||||
} as ViewV2Schema,
|
||||
},
|
||||
{
|
||||
status: 200,
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
AutoFieldSubType,
|
||||
FieldType,
|
||||
OperationFieldTypeEnum,
|
||||
AIFieldMetadata,
|
||||
AIOperationEnum,
|
||||
} from "@budibase/types"
|
||||
import { OperationFields } from "@budibase/shared-core"
|
||||
import tracer from "dd-trace"
|
||||
|
@ -122,10 +122,11 @@ export async function processAIColumns<T extends Row | Row[]>(
|
|||
|
||||
// Check if the type is bindable and pass through HBS if so
|
||||
const operationField =
|
||||
OperationFields[(schema as AIFieldMetadata).operation]
|
||||
OperationFields[schema.operation as AIOperationEnum]
|
||||
for (const key in schema) {
|
||||
const fieldType = operationField[key]
|
||||
const fieldType = operationField[key as keyof typeof operationField]
|
||||
if (fieldType === OperationFieldTypeEnum.BINDABLE_TEXT) {
|
||||
// @ts-ignore
|
||||
schema[key] = processStringSync(schema[key], contextRow)
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +135,7 @@ export async function processAIColumns<T extends Row | Row[]>(
|
|||
|
||||
return tracer.trace("processAIColumn", {}, async span => {
|
||||
span?.addTags({ table_id: table._id, column })
|
||||
const llmResponse = await llm.run(prompt)
|
||||
const llmResponse = await llm.run(prompt!)
|
||||
return {
|
||||
...row,
|
||||
[column]: llmResponse,
|
||||
|
|
|
@ -122,7 +122,7 @@ export interface AIFieldMetadata extends BaseFieldSchema {
|
|||
operation: AIOperationEnum
|
||||
columns?: string[]
|
||||
column?: string
|
||||
categories?: string
|
||||
categories?: string[]
|
||||
prompt?: string
|
||||
language?: string
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue