mirror of
https://github.com/baptisteArno/typebot.io.git
synced 2026-06-19 21:04:33 +08:00
🧑💻 (forge) Pass creds and variables to web parsers
Some checks failed
Create Tag / create-tag (push) Has been cancelled
Some checks failed
Create Tag / create-tag (push) Has been cancelled
This commit is contained in:
parent
dc870fcfad
commit
f613ce366b
@ -136,7 +136,10 @@ export const executeForgedBlock = async (
|
||||
clientSideActions.push({
|
||||
type: 'codeToExecute',
|
||||
codeToExecute: action?.run?.web?.parseFunction({
|
||||
credentials: credentialsData ?? {},
|
||||
options: parsedOptions,
|
||||
variables,
|
||||
logs: logsStore,
|
||||
}),
|
||||
})
|
||||
}
|
||||
@ -151,14 +154,23 @@ export const executeForgedBlock = async (
|
||||
type: 'custom-embed',
|
||||
content: {
|
||||
url: action.run.web.displayEmbedBubble.parseUrl({
|
||||
credentials: credentialsData ?? {},
|
||||
options: parsedOptions,
|
||||
variables,
|
||||
logs: logsStore,
|
||||
}),
|
||||
initFunction: action.run.web.displayEmbedBubble.parseInitFunction({
|
||||
credentials: credentialsData ?? {},
|
||||
options: parsedOptions,
|
||||
variables,
|
||||
logs: logsStore,
|
||||
}),
|
||||
waitForEventFunction:
|
||||
action.run.web.displayEmbedBubble.waitForEvent?.parseFunction?.({
|
||||
credentials: credentialsData ?? {},
|
||||
options: parsedOptions,
|
||||
variables,
|
||||
logs: logsStore,
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ export const createChatMessage = createAction({
|
||||
getSetVariableIds: ({ responseMapping }) =>
|
||||
responseMapping?.map((res) => res.variableId).filter(isDefined) ?? [],
|
||||
run: {
|
||||
server: async ({ credentials: { apiKey }, options, variables, logs }) => {
|
||||
server: async ({ credentials: { apiKey }, options, variables }) => {
|
||||
const modelName = options.model ?? defaultAnthropicOptions.model
|
||||
const model = createAnthropic({
|
||||
apiKey,
|
||||
|
||||
@ -79,22 +79,34 @@ export type ActionDefinition<
|
||||
* Used to determine the URL to be displayed as a text bubble in runtimes where the code can't be executed. (i.e. WhatsApp)
|
||||
*/
|
||||
parseUrl: (params: {
|
||||
credentials: CredentialsFromAuthDef<A>
|
||||
options: z.infer<BaseOptions> & z.infer<Options>
|
||||
variables: VariableStore
|
||||
logs: LogsStore
|
||||
}) => string | undefined
|
||||
waitForEvent?: {
|
||||
getSaveVariableId?: (
|
||||
options: z.infer<BaseOptions> & z.infer<Options>
|
||||
) => string | undefined
|
||||
parseFunction: (params: {
|
||||
credentials: CredentialsFromAuthDef<A>
|
||||
options: z.infer<BaseOptions> & z.infer<Options>
|
||||
variables: VariableStore
|
||||
logs: LogsStore
|
||||
}) => FunctionToExecute
|
||||
}
|
||||
parseInitFunction: (params: {
|
||||
credentials: CredentialsFromAuthDef<A>
|
||||
options: z.infer<BaseOptions> & z.infer<Options>
|
||||
variables: VariableStore
|
||||
logs: LogsStore
|
||||
}) => FunctionToExecute
|
||||
}
|
||||
parseFunction?: (params: {
|
||||
credentials: CredentialsFromAuthDef<A>
|
||||
options: z.infer<BaseOptions> & z.infer<Options>
|
||||
variables: VariableStore
|
||||
logs: LogsStore
|
||||
}) => FunctionToExecute
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user