2
0

Add "turn into" option in block context menu

Closes #1302
This commit is contained in:
Baptiste Arnaud
2024-03-05 15:46:28 +01:00
parent 84d6c594af
commit 2fb379b102
16 changed files with 244 additions and 13 deletions

View File

@ -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',

View File

@ -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) ??
[],

View File

@ -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

View File

@ -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',
}),

View File

@ -19,6 +19,15 @@ export const createChatCompletion = createAction({
modelFetchId: 'fetchModels',
}),
getSetVariableIds: getChatCompletionSetVarIds,
turnableInto: [
{
blockType: 'open-router',
},
{
blockType: 'together-ai',
},
{ blockType: 'mistral' },
],
fetchers: [
{
id: 'fetchModels',

View File

@ -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) =>