@@ -8,6 +8,7 @@ import { ChatNodeResponse } from '../types'
|
||||
export const sendMessage = createAction({
|
||||
auth,
|
||||
name: 'Send Message',
|
||||
turnableInto: undefined,
|
||||
options: option.object({
|
||||
botId: option.string.layout({
|
||||
label: 'Bot ID',
|
||||
|
||||
@@ -67,6 +67,15 @@ export const createChatCompletion = createAction({
|
||||
name: 'Create chat completion',
|
||||
auth,
|
||||
options,
|
||||
turnableInto: [
|
||||
{
|
||||
blockType: 'openai',
|
||||
},
|
||||
{
|
||||
blockType: 'together-ai',
|
||||
},
|
||||
{ blockType: 'open-router' },
|
||||
],
|
||||
getSetVariableIds: (options) =>
|
||||
options.responseMapping?.map((res) => res.variableId).filter(isDefined) ??
|
||||
[],
|
||||
|
||||
@@ -9,7 +9,7 @@ export const auth = {
|
||||
isRequired: true,
|
||||
inputType: 'password',
|
||||
helperText:
|
||||
'You can generate an API key [here](https://console.mistral.ai/user/api-keys/).',
|
||||
'You can generate an API key [here](https://console.mistral.ai/api-keys).',
|
||||
}),
|
||||
}),
|
||||
} satisfies AuthDefinition
|
||||
|
||||
@@ -12,6 +12,15 @@ import { ModelsResponse } from '../types'
|
||||
export const createChatCompletion = createAction({
|
||||
name: 'Create chat completion',
|
||||
auth,
|
||||
turnableInto: [
|
||||
{
|
||||
blockType: 'openai',
|
||||
},
|
||||
{
|
||||
blockType: 'together-ai',
|
||||
},
|
||||
{ blockType: 'mistral' },
|
||||
],
|
||||
options: parseChatCompletionOptions({
|
||||
modelFetchId: 'fetchModels',
|
||||
}),
|
||||
|
||||
@@ -19,6 +19,15 @@ export const createChatCompletion = createAction({
|
||||
modelFetchId: 'fetchModels',
|
||||
}),
|
||||
getSetVariableIds: getChatCompletionSetVarIds,
|
||||
turnableInto: [
|
||||
{
|
||||
blockType: 'open-router',
|
||||
},
|
||||
{
|
||||
blockType: 'together-ai',
|
||||
},
|
||||
{ blockType: 'mistral' },
|
||||
],
|
||||
fetchers: [
|
||||
{
|
||||
id: 'fetchModels',
|
||||
|
||||
@@ -14,6 +14,15 @@ export const createChatCompletion = createAction({
|
||||
modelHelperText:
|
||||
'You can find the list of all the models available [here](https://docs.together.ai/docs/inference-models#chat-models). Copy the model string for API.',
|
||||
}),
|
||||
turnableInto: [
|
||||
{
|
||||
blockType: 'openai',
|
||||
},
|
||||
{
|
||||
blockType: 'open-router',
|
||||
},
|
||||
{ blockType: 'mistral' },
|
||||
],
|
||||
getSetVariableIds: getChatCompletionSetVarIds,
|
||||
run: {
|
||||
server: (params) =>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typebot.io/tsconfig": "workspace:*",
|
||||
"@types/react": "18.2.15"
|
||||
"@types/react": "18.2.15",
|
||||
"@typebot.io/forge-repository": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { SVGProps } from 'react'
|
||||
import { z } from './zod'
|
||||
import { ZodRawShape } from 'zod'
|
||||
import { enabledBlocks } from '@typebot.io/forge-repository'
|
||||
|
||||
export type VariableStore = {
|
||||
get: (variableId: string) => string | (string | null)[] | null | undefined
|
||||
@@ -32,6 +33,14 @@ export type FunctionToExecute = {
|
||||
|
||||
export type ReadOnlyVariableStore = Omit<VariableStore, 'set'>
|
||||
|
||||
export type TurnableIntoParam<T = {}> = {
|
||||
blockType: (typeof enabledBlocks)[number]
|
||||
/**
|
||||
* If defined will be used to convert the existing block options into the new block options.
|
||||
*/
|
||||
customMapping?: (options: T) => any
|
||||
}
|
||||
|
||||
export type ActionDefinition<
|
||||
A extends AuthDefinition,
|
||||
BaseOptions extends z.ZodObject<ZodRawShape> = z.ZodObject<{}>,
|
||||
@@ -40,6 +49,7 @@ export type ActionDefinition<
|
||||
name: string
|
||||
fetchers?: FetcherDefinition<A, z.infer<BaseOptions> & z.infer<Options>>[]
|
||||
options?: Options
|
||||
turnableInto?: TurnableIntoParam<z.infer<Options>>[]
|
||||
getSetVariableIds?: (options: z.infer<Options>) => string[]
|
||||
run?: {
|
||||
server?: (params: {
|
||||
|
||||
Reference in New Issue
Block a user