2
0

📝 Add Contribute docs

This commit is contained in:
Baptiste Arnaud
2024-01-03 16:29:41 +01:00
parent b3957295bd
commit 65f4fb0d7a
66 changed files with 1453 additions and 519 deletions

View File

@@ -25,7 +25,7 @@ export const bookEvent = createAction({
}),
saveBookedDateInVariableId: option.string.layout({
label: 'Save booked date',
input: 'variableDropdown',
inputType: 'variableDropdown',
}),
}),
getSetVariableIds: ({ saveBookedDateInVariableId }) =>

View File

@@ -23,7 +23,7 @@ export const sendMessage = createAction({
message: option.string.layout({
label: 'Message',
placeholder: 'Hi, what can I do with ChatNode',
input: 'textarea',
inputType: 'textarea',
}),
responseMapping: option.saveResponseArray(['Message', 'Thread ID']).layout({
accordion: 'Save response',

View File

@@ -9,7 +9,8 @@ export const auth = {
isRequired: true,
helperText:
'You can generate an API key [here](https://go.chatnode.ai/typebot).',
input: 'password',
inputType: 'password',
withVariableButton: false,
}),
}),
} satisfies AuthDefinition

View File

@@ -8,7 +8,10 @@ import { auth } from '../auth'
import { baseOptions } from '../baseOptions'
const nativeMessageContentSchema = {
content: option.string.layout({ input: 'textarea', placeholder: 'Content' }),
content: option.string.layout({
inputType: 'textarea',
placeholder: 'Content',
}),
}
const systemMessageItemSchema = option
@@ -32,7 +35,7 @@ const assistantMessageItemSchema = option
const dialogueMessageItemSchema = option.object({
role: option.literal('Dialogue'),
dialogueVariableId: option.string.layout({
input: 'variableDropdown',
inputType: 'variableDropdown',
placeholder: 'Dialogue variable',
}),
startsBy: option.enum(['user', 'assistant']).layout({
@@ -75,6 +78,7 @@ export const createChatCompletion = createAction({
name: 'Create chat completion',
auth,
baseOptions,
options,
getSetVariableIds: (options) =>
options.responseMapping?.map((res) => res.variableId).filter(isDefined) ??
[],
@@ -177,5 +181,4 @@ export const createChatCompletion = createAction({
},
},
},
options,
})

View File

@@ -19,14 +19,14 @@ export const createSpeech = createAction({
}),
input: option.string.layout({
label: 'Input',
input: 'textarea',
inputType: 'textarea',
}),
voice: option.enum(openAIVoices).layout({
label: 'Voice',
placeholder: 'Select a voice',
}),
saveUrlInVariableId: option.string.layout({
input: 'variableDropdown',
inputType: 'variableDropdown',
label: 'Save URL in variable',
}),
}),

View File

@@ -29,13 +29,13 @@ export const searchDocuments = createAction({
label: 'System prompt',
moreInfoTooltip:
'System prompt to send to the summarization LLM. This is prepended to the prompt and helps guide system behavior.',
input: 'textarea',
inputType: 'textarea',
}),
prompt: option.string.layout({
accordion: 'Advanced settings',
label: 'Prompt',
moreInfoTooltip: 'Prompt to send to the summarization LLM.',
input: 'textarea',
inputType: 'textarea',
}),
responseMapping: option
.saveResponseArray([

View File

@@ -95,6 +95,7 @@ export const option = {
object: <T extends z.ZodRawShape>(schema: T) => z.object(schema),
literal: <T extends string>(value: T) => z.literal(value),
string: z.string().optional(),
boolean: z.boolean().optional(),
enum: <T extends string>(values: readonly [T, ...T[]]) =>
z.enum(values).optional(),
number: z.number().or(variableStringSchema).optional(),
@@ -123,7 +124,7 @@ export const option = {
defaultValue: items[0],
}),
variableId: z.string().optional().layout({
input: 'variableDropdown',
inputType: 'variableDropdown',
}),
})
)

View File

@@ -117,7 +117,6 @@ export type BlockDefinition<
auth?: Auth
options?: Options | undefined
fetchers?: FetcherDefinition<Auth, Options>[]
isDisabledInPreview?: boolean
actions: ActionDefinition<Auth, Options>[]
}

View File

@@ -8,7 +8,7 @@ export interface ZodLayoutMetadata<
> {
accordion?: string
label?: string
input?: 'variableDropdown' | 'textarea' | 'password'
inputType?: 'variableDropdown' | 'textarea' | 'password'
defaultValue?: T extends ZodDate ? string : TInferred
placeholder?: string
helperText?: string
@@ -18,7 +18,6 @@ export interface ZodLayoutMetadata<
fetcher?: T extends OptionableZodType<ZodString> ? string : never
itemLabel?: T extends OptionableZodType<ZodArray<any>> ? string : never
isOrdered?: T extends OptionableZodType<ZodArray<any>> ? boolean : never
isHidden?: boolean
moreInfoTooltip?: string
}