From cd7b66fa37e557162d9038c3e301f25d96b2e4f4 Mon Sep 17 00:00:00 2001 From: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:37:09 +0530 Subject: [PATCH] fix: Anthropic plugin config updated with better file structure (#36223) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Reverting the Anthropic file structure to the previous structure. This also means the UI will get updated to the new shared design. Fixes #35485 ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!CAUTION] > 🔴 🔴 🔴 Some tests have failed. > Workflow run: > Commit: b7a718460edaae4b37de29169b971b88e2dd5b67 > Cypress dashboard. > Tags: @tag.All > Spec: > The following are new failures, please fix them before merging the PR:
    >
  1. cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts >
  2. cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts
> List of identified flaky tests. >
Wed, 11 Sep 2024 08:07:04 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No ## Summary by CodeRabbit - **New Features** - Introduced a new chat interface configuration for AI-driven interactions, enhancing user engagement with dynamic input fields. - Added a new configuration for vision capabilities, allowing users to interact with vision-based AI models through a structured interface. - **Changes** - Simplified the editor's configuration by renaming sections and removing unnecessary controls, streamlining the user experience. - Updated file management structure to enhance modularity with external references to configuration files. --- .../src/main/resources/editor/chat.json | 130 ++++++++ .../src/main/resources/editor/root.json | 313 +----------------- .../src/main/resources/editor/vision.json | 142 ++++++++ 3 files changed, 275 insertions(+), 310 deletions(-) create mode 100644 app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/chat.json create mode 100644 app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/vision.json diff --git a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/chat.json b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/chat.json new file mode 100644 index 00000000000..a1621376380 --- /dev/null +++ b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/chat.json @@ -0,0 +1,130 @@ +{ + "identifier": "CHAT", + "controlType": "SECTION_V2", + "conditionals": { + "show": "{{actionConfiguration.formData.command.data === 'CHAT'}}" + }, + "children": [ + { + "controlType": "DOUBLE_COLUMN_ZONE", + "children": [ + { + "label": "Models", + "tooltipText": "Select the model for response generation", + "subtitle": "ID of the model to use.", + "isRequired": true, + "propertyName": "chat_model_id", + "configProperty": "actionConfiguration.formData.chatModel.data", + "controlType": "DROP_DOWN", + "initialValue": "", + "options": [], + "placeholderText": "All models will be fetched.", + "fetchOptionsConditionally": true, + "setFirstOptionAsDefault": true, + "alternateViewTypes": ["json"], + "conditionals": { + "enable": "{{true}}", + "fetchDynamicValues": { + "condition": "{{actionConfiguration.formData.command.data === 'CHAT'}}", + "config": { + "params": { + "requestType": "CHAT_MODELS", + "displayType": "DROP_DOWN" + } + } + } + } + }, + { + "label": "Max Tokens", + "tooltipText": "The maximum number of tokens to generate in the chat completion.", + "subtitle": "The maximum number of tokens to generate in the chat completion.", + "Description": "Put a positive integer value", + "configProperty": "actionConfiguration.formData.maxTokens", + "controlType": "INPUT_TEXT", + "initialValue": "256", + "isRequired": true, + "dataType": "NUMBER", + "customStyles": { + "width": "270px", + "minWidth": "270px" + } + } + ] + }, + { + "controlType": "SINGLE_COLUMN_ZONE", + "children": [ + { + "label": "System Prompt", + "Description": "Provide additional instructions for the AI model as system prompt", + "subtitle": "Provide additional instructions for the AI model as system prompt", + "configProperty": "actionConfiguration.formData.systemPrompt.data", + "controlType": "QUERY_DYNAMIC_TEXT", + "placeholderText": "Write some text or use {{ }} to reference a dynamic text value", + "initialValue": "", + "isRequired": false, + "customStyles": { + "width": "590px", + "minWidth": "400px" + } + }, + { + "label": "Messages", + "tooltipText": "Ask a question", + "subtitle": "A list of messages comprising the conversation so far.", + "propertyName": "messages", + "isRequired": true, + "configProperty": "actionConfiguration.formData.messages.data", + "controlType": "ARRAY_FIELD", + "addMoreButtonLabel": "Add message", + "alternateViewTypes": ["json"], + "schema": [ + { + "label": "Role", + "key": "role", + "controlType": "DROP_DOWN", + "initialValue": "Human", + "options": [ + { + "label": "Human", + "value": "Human" + }, + { + "label": "Assistant", + "value": "Assistant" + } + ] + }, + { + "label": "Content", + "key": "content", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "placeholderText": "{{ UserInput.text }}" + } + ] + } + ] + }, + { + "controlType": "DOUBLE_COLUMN_ZONE", + "children": [ + { + "label": "Temperature", + "tooltipText": "Put a value between 0 and 1", + "Description": "Put a value between 0 and 1", + "subtitle": "Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical / multiple choice, and closer to 1 for creative and generative tasks.", + "configProperty": "actionConfiguration.formData.temperature", + "controlType": "INPUT_TEXT", + "dataType": "NUMBER", + "initialValue": "1", + "isRequired": false, + "customStyles": { + "width": "270px", + "minWidth": "270px" + } + } + ] + } + ] +} diff --git a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/root.json b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/root.json index 2b674a2fc49..abc010dddc7 100644 --- a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/root.json +++ b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/root.json @@ -2,7 +2,7 @@ "editor": [ { "controlType": "SECTION_V2", - "identifier": "SECTION-ONE", + "identifier": "SELECTOR", "children": [ { "controlType": "DOUBLE_COLUMN_ZONE", @@ -27,316 +27,9 @@ ] } ] - }, - { - "controlType": "DOUBLE_COLUMN_ZONE", - "identifier": "SO-Z2", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'CHAT'}}" - }, - "children": [ - { - "label": "Models", - "tooltipText": "Select the model for response generation", - "subtitle": "ID of the model to use.", - "isRequired": true, - "propertyName": "chat_model_id", - "configProperty": "actionConfiguration.formData.chatModel.data", - "controlType": "DROP_DOWN", - "initialValue": "", - "options": [], - "placeholderText": "All models will be fetched.", - "fetchOptionsConditionally": true, - "setFirstOptionAsDefault": true, - "alternateViewTypes": ["json"], - "conditionals": { - "enable": "{{true}}", - "fetchDynamicValues": { - "condition": "{{actionConfiguration.formData.command.data === 'CHAT'}}", - "config": { - "params": { - "requestType": "CHAT_MODELS", - "displayType": "DROP_DOWN" - } - } - } - } - }, - { - "label": "Max Tokens", - "tooltipText": "The maximum number of tokens to generate in the chat completion.", - "subtitle": "The maximum number of tokens to generate in the chat completion.", - "Description": "Put a positive integer value", - "configProperty": "actionConfiguration.formData.maxTokens", - "controlType": "INPUT_TEXT", - "initialValue": "256", - "isRequired": true, - "dataType": "NUMBER", - "customStyles": { - "width": "270px", - "minWidth": "270px" - } - } - ] - }, - { - "controlType": "SINGLE_COLUMN_ZONE", - "identifier": "SO-Z3", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'CHAT'}}" - }, - "children": [ - { - "label": "System Prompt", - "Description": "Provide additional instructions for the AI model as system prompt", - "subtitle": "Provide additional instructions for the AI model as system prompt", - "configProperty": "actionConfiguration.formData.systemPrompt.data", - "controlType": "QUERY_DYNAMIC_TEXT", - "placeholderText": "Write some text or use {{ }} to reference a dynamic text value", - "initialValue": "", - "isRequired": false, - "customStyles": { - "width": "590px", - "minWidth": "400px" - } - } - ] - }, - { - "controlType": "DOUBLE_COLUMN_ZONE", - "identifier": "SO-Z4", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'VISION'}}" - }, - "children": [ - { - "label": "Models", - "tooltipText": "Select the model for response generation", - "subtitle": "ID of the model to use.", - "isRequired": true, - "propertyName": "vision_model_id", - "configProperty": "actionConfiguration.formData.visionModel.data", - "controlType": "DROP_DOWN", - "initialValue": "", - "options": [], - "placeholderText": "All models will be fetched.", - "fetchOptionsConditionally": true, - "setFirstOptionAsDefault": true, - "alternateViewTypes": ["json"], - "conditionals": { - "enable": "{{true}}", - "fetchDynamicValues": { - "condition": "{{actionConfiguration.formData.command.data === 'VISION'}}", - "config": { - "params": { - "requestType": "VISION_MODELS", - "displayType": "DROP_DOWN" - } - } - } - } - }, - { - "label": "Max Tokens", - "tooltipText": "The maximum number of tokens to generate in the chat completion.", - "subtitle": "The maximum number of tokens to generate in the chat completion.", - "Description": "Put a positive integer value", - "configProperty": "actionConfiguration.formData.maxTokens", - "controlType": "INPUT_TEXT", - "initialValue": "256", - "isRequired": true, - "dataType": "NUMBER", - "customStyles": { - "width": "270px", - "minWidth": "270px" - } - } - ] - }, - { - "controlType": "SINGLE_COLUMN_ZONE", - "identifier": "SO-Z5", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'VISION'}}" - }, - "children": [ - { - "label": "System Prompt", - "Description": "Provide additional instructions for the AI model as system prompt", - "subtitle": "Provide additional instructions for the AI model as system prompt", - "configProperty": "actionConfiguration.formData.systemPrompt.data", - "controlType": "QUERY_DYNAMIC_TEXT", - "placeholderText": "Write some text or use {{ }} to reference a dynamic text value", - "initialValue": "", - "isRequired": false - } - ] - } - ] - }, - { - "controlType": "SECTION_V2", - "identifier": "SECTION-TWO", - "children": [ - { - "controlType": "SINGLE_COLUMN_ZONE", - "identifier": "ST-Z1", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'CHAT'}}" - }, - "children": [ - { - "label": "Messages", - "tooltipText": "Ask a question", - "subtitle": "A list of messages comprising the conversation so far.", - "propertyName": "messages", - "isRequired": true, - "configProperty": "actionConfiguration.formData.messages.data", - "controlType": "ARRAY_FIELD", - "addMoreButtonLabel": "Add message", - "alternateViewTypes": ["json"], - "schema": [ - { - "label": "Role", - "key": "role", - "controlType": "DROP_DOWN", - "initialValue": "Human", - "options": [ - { - "label": "Human", - "value": "Human" - }, - { - "label": "Assistant", - "value": "Assistant" - } - ] - }, - { - "label": "Content", - "key": "content", - "controlType": "QUERY_DYNAMIC_INPUT_TEXT", - "placeholderText": "{{ UserInput.text }}" - } - ] - } - ] - }, - { - "controlType": "SINGLE_COLUMN_ZONE", - "identifier": "ST-Z2", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'VISION'}}" - }, - "children": [ - { - "label": "Messages", - "tooltipText": "Ask a question", - "subtitle": "A list of messages comprising the conversation so far. You can pass base64 encoded image directly in the request.", - "propertyName": "messages", - "isRequired": true, - "configProperty": "actionConfiguration.formData.messages.data", - "controlType": "ARRAY_FIELD", - "addMoreButtonLabel": "Add message", - "alternateViewTypes": ["json"], - "schema": [ - { - "label": "Role", - "key": "role", - "controlType": "DROP_DOWN", - "initialValue": "Human", - "options": [ - { - "label": "Human", - "value": "Human" - }, - { - "label": "Assistant", - "value": "Assistant" - } - ] - }, - { - "label": "Type", - "key": "type", - "controlType": "DROP_DOWN", - "initialValue": "text", - "options": [ - { - "label": "Text", - "value": "text" - }, - { - "label": "Image", - "value": "image" - } - ] - }, - { - "label": "Content", - "key": "content", - "controlType": "QUERY_DYNAMIC_INPUT_TEXT", - "placeholderText": "{{Img1.image}} or {{Input1.text}}" - } - ] - } - ] - } - ] - }, - { - "controlType": "SECTION_V2", - "identifier": "SECTION-THREE", - "children": [ - { - "controlType": "DOUBLE_COLUMN_ZONE", - "identifier": "STH-Z1", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'CHAT'}}" - }, - "children": [ - { - "label": "Temperature", - "tooltipText": "Put a value between 0 and 1", - "Description": "Put a value between 0 and 1", - "subtitle": "Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical / multiple choice, and closer to 1 for creative and generative tasks.", - "configProperty": "actionConfiguration.formData.temperature", - "controlType": "INPUT_TEXT", - "dataType": "NUMBER", - "initialValue": "1", - "isRequired": false, - "customStyles": { - "width": "270px", - "minWidth": "270px" - } - } - ] - }, - { - "controlType": "DOUBLE_COLUMN_ZONE", - "identifier": "STH-Z2", - "conditionals": { - "show": "{{actionConfiguration.formData.command.data === 'VISION'}}" - }, - "children": [ - { - "label": "Temperature", - "tooltipText": "Put a value between 0 and 1", - "Description": "Put a value between 0 and 1", - "subtitle": "Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical / multiple choice, and closer to 1 for creative and generative tasks.", - "configProperty": "actionConfiguration.formData.temperature", - "controlType": "INPUT_TEXT", - "dataType": "NUMBER", - "initialValue": "1", - "isRequired": false, - "customStyles": { - "width": "270px", - "minWidth": "270px" - } - } - ] } ] } - ] + ], + "files": ["chat.json", "vision.json"] } diff --git a/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/vision.json b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/vision.json new file mode 100644 index 00000000000..282ddac5355 --- /dev/null +++ b/app/server/appsmith-plugins/anthropicPlugin/src/main/resources/editor/vision.json @@ -0,0 +1,142 @@ +{ + "identifier": "VISION", + "controlType": "SECTION_V2", + "conditionals": { + "show": "{{actionConfiguration.formData.command.data === 'VISION'}}" + }, + "children": [ + { + "controlType": "DOUBLE_COLUMN_ZONE", + "children": [ + { + "label": "Models", + "tooltipText": "Select the model for response generation", + "subtitle": "ID of the model to use.", + "isRequired": true, + "propertyName": "vision_model_id", + "configProperty": "actionConfiguration.formData.visionModel.data", + "controlType": "DROP_DOWN", + "initialValue": "", + "options": [], + "placeholderText": "All models will be fetched.", + "fetchOptionsConditionally": true, + "setFirstOptionAsDefault": true, + "alternateViewTypes": ["json"], + "conditionals": { + "enable": "{{true}}", + "fetchDynamicValues": { + "condition": "{{actionConfiguration.formData.command.data === 'VISION'}}", + "config": { + "params": { + "requestType": "VISION_MODELS", + "displayType": "DROP_DOWN" + } + } + } + } + }, + { + "label": "Max Tokens", + "tooltipText": "The maximum number of tokens to generate in the chat completion.", + "subtitle": "The maximum number of tokens to generate in the chat completion.", + "Description": "Put a positive integer value", + "configProperty": "actionConfiguration.formData.maxTokens", + "controlType": "INPUT_TEXT", + "initialValue": "256", + "isRequired": true, + "dataType": "NUMBER", + "customStyles": { + "width": "270px", + "minWidth": "270px" + } + } + ] + }, + { + "controlType": "SINGLE_COLUMN_ZONE", + "children": [ + { + "label": "System Prompt", + "Description": "Provide additional instructions for the AI model as system prompt", + "subtitle": "Provide additional instructions for the AI model as system prompt", + "configProperty": "actionConfiguration.formData.systemPrompt.data", + "controlType": "QUERY_DYNAMIC_TEXT", + "placeholderText": "Write some text or use {{ }} to reference a dynamic text value", + "initialValue": "", + "isRequired": false + }, + { + "label": "Messages", + "tooltipText": "Ask a question", + "subtitle": "A list of messages comprising the conversation so far. You can pass base64 encoded image directly in the request.", + "propertyName": "messages", + "isRequired": true, + "configProperty": "actionConfiguration.formData.messages.data", + "controlType": "ARRAY_FIELD", + "addMoreButtonLabel": "Add message", + "alternateViewTypes": ["json"], + "schema": [ + { + "label": "Role", + "key": "role", + "controlType": "DROP_DOWN", + "initialValue": "Human", + "options": [ + { + "label": "Human", + "value": "Human" + }, + { + "label": "Assistant", + "value": "Assistant" + } + ] + }, + { + "label": "Type", + "key": "type", + "controlType": "DROP_DOWN", + "initialValue": "text", + "options": [ + { + "label": "Text", + "value": "text" + }, + { + "label": "Image", + "value": "image" + } + ] + }, + { + "label": "Content", + "key": "content", + "controlType": "QUERY_DYNAMIC_INPUT_TEXT", + "placeholderText": "{{Img1.image}} or {{Input1.text}}" + } + ] + } + ] + }, + { + "controlType": "DOUBLE_COLUMN_ZONE", + "children": [ + { + "label": "Temperature", + "tooltipText": "Put a value between 0 and 1", + "Description": "Put a value between 0 and 1", + "subtitle": "Defaults to 1. Ranges from 0 to 1. Use temp closer to 0 for analytical / multiple choice, and closer to 1 for creative and generative tasks.", + "configProperty": "actionConfiguration.formData.temperature", + "controlType": "INPUT_TEXT", + "dataType": "NUMBER", + "initialValue": "1", + "isRequired": false, + "customStyles": { + "width": "270px", + "minWidth": "270px" + } + } + ] + } + ] +}