@@ -9,5 +9,4 @@ export enum IntegrationBlockType {
|
||||
PABBLY_CONNECT = 'Pabbly',
|
||||
CHATWOOT = 'Chatwoot',
|
||||
PIXEL = 'Pixel',
|
||||
ZEMANTIC_AI = 'Zemantic AI',
|
||||
}
|
||||
|
||||
@@ -7,5 +7,4 @@ export * from './sendEmail'
|
||||
export * from './webhook'
|
||||
export * from './zapier'
|
||||
export * from './pixel'
|
||||
export * from './zemanticAi'
|
||||
export * from './schema'
|
||||
|
||||
@@ -5,7 +5,6 @@ import { googleSheetsBlockSchemas } from './googleSheets'
|
||||
import { openAIBlockSchema } from './openai'
|
||||
import { pixelBlockSchema } from './pixel/schema'
|
||||
import { sendEmailBlockSchema } from './sendEmail'
|
||||
import { zemanticAiBlockSchema } from './zemanticAi'
|
||||
import { zapierBlockSchemas } from './zapier'
|
||||
import { httpBlockSchemas } from './webhook'
|
||||
import { makeComBlockSchemas } from './makeCom'
|
||||
@@ -23,7 +22,6 @@ export const integrationBlockSchemas = {
|
||||
httpBlockSchemas.v5,
|
||||
zapierBlockSchemas.v5,
|
||||
pixelBlockSchema,
|
||||
zemanticAiBlockSchema,
|
||||
],
|
||||
v6: [
|
||||
chatwootBlockSchema,
|
||||
@@ -36,7 +34,6 @@ export const integrationBlockSchemas = {
|
||||
httpBlockSchemas.v6,
|
||||
zapierBlockSchemas.v6,
|
||||
pixelBlockSchema,
|
||||
zemanticAiBlockSchema,
|
||||
],
|
||||
} as const
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import { ZemanticAiBlock } from './schema'
|
||||
|
||||
export const searchResponseValues = ['Summary', 'Results'] as const
|
||||
|
||||
export const defaultZemanticAiOptions = {
|
||||
maxResults: 3,
|
||||
} as const satisfies ZemanticAiBlock['options']
|
||||
|
||||
export const defaultZemanticAiResponseMappingItem = {
|
||||
valueToExtract: 'Summary',
|
||||
} as const
|
||||
@@ -1 +0,0 @@
|
||||
export * from './schema'
|
||||
@@ -1,57 +0,0 @@
|
||||
import { z } from '../../../../zod'
|
||||
import { blockBaseSchema, credentialsBaseSchema } from '../../shared'
|
||||
import { IntegrationBlockType } from '../constants'
|
||||
import { searchResponseValues } from './constants'
|
||||
|
||||
export const zemanticAiOptionsSchema = z.object({
|
||||
credentialsId: z.string().optional(),
|
||||
projectId: z.string().optional(),
|
||||
systemPrompt: z.string().optional(),
|
||||
prompt: z.string().optional(),
|
||||
query: z.string().optional(),
|
||||
maxResults: z.number().int().optional(),
|
||||
responseMapping: z
|
||||
.array(
|
||||
z.object({
|
||||
id: z.string(),
|
||||
valueToExtract: z.preprocess(
|
||||
(val) => (!val ? 'Summary' : val),
|
||||
z.enum(searchResponseValues)
|
||||
),
|
||||
variableId: z.string().optional(),
|
||||
})
|
||||
)
|
||||
.optional(),
|
||||
})
|
||||
|
||||
export const zemanticAiBlockSchema = blockBaseSchema.merge(
|
||||
z.object({
|
||||
type: z.enum([IntegrationBlockType.ZEMANTIC_AI]),
|
||||
blockId: z.string().optional(),
|
||||
options: zemanticAiOptionsSchema.optional(),
|
||||
})
|
||||
)
|
||||
|
||||
export const zemanticAiCredentialsSchema = z
|
||||
.object({
|
||||
type: z.literal('zemanticAi'),
|
||||
data: z.object({
|
||||
apiKey: z.string(),
|
||||
}),
|
||||
})
|
||||
.merge(credentialsBaseSchema)
|
||||
|
||||
export const zemanticSearchResponseSchema = z.object({
|
||||
results: z.array(
|
||||
z.object({
|
||||
documentId: z.string(),
|
||||
text: z.string(),
|
||||
score: z.number(),
|
||||
})
|
||||
),
|
||||
summary: z.string(),
|
||||
})
|
||||
|
||||
export type ZemanticAiResponse = z.infer<typeof zemanticSearchResponseSchema>
|
||||
export type ZemanticAiCredentials = z.infer<typeof zemanticAiCredentialsSchema>
|
||||
export type ZemanticAiBlock = z.infer<typeof zemanticAiBlockSchema>
|
||||
@@ -1,5 +1,4 @@
|
||||
import { z } from '../zod'
|
||||
import { zemanticAiCredentialsSchema } from './blocks'
|
||||
import { stripeCredentialsSchema } from './blocks/inputs/payment/schema'
|
||||
import { googleSheetsCredentialsSchema } from './blocks/integrations/googleSheets/schema'
|
||||
import { smtpCredentialsSchema } from './blocks/integrations/sendEmail'
|
||||
@@ -11,30 +10,19 @@ const credentialsSchema = z.discriminatedUnion('type', [
|
||||
googleSheetsCredentialsSchema,
|
||||
stripeCredentialsSchema,
|
||||
whatsAppCredentialsSchema,
|
||||
zemanticAiCredentialsSchema,
|
||||
...Object.values(forgedCredentialsSchemas),
|
||||
])
|
||||
|
||||
export type Credentials = z.infer<typeof credentialsSchema>
|
||||
|
||||
export type CredentialsWithoutLegacy = Exclude<
|
||||
Credentials,
|
||||
{
|
||||
type: 'zemanticAi'
|
||||
}
|
||||
>
|
||||
|
||||
export const credentialsTypes = [
|
||||
'smtp',
|
||||
'google sheets',
|
||||
'stripe',
|
||||
'whatsApp',
|
||||
'zemanticAi',
|
||||
...(Object.keys(forgedCredentialsSchemas) as Array<
|
||||
keyof typeof forgedCredentialsSchemas
|
||||
>),
|
||||
] as const
|
||||
|
||||
export const credentialsTypeSchema = z.enum(credentialsTypes)
|
||||
|
||||
export const legacyCredentialsTypes = ['zemanticAi']
|
||||
|
||||
Reference in New Issue
Block a user