feat: action redesign, UQI upgrade Open AI plugin config to dual zone format (#36087)

## Description
Upgrade Open AI plugin config to new format using SECTION_V2,
SINGLE_COLUMN_ZONE, and DOUBLE_COLUMN_ZONE.

Fixes #35498 

## Automation

/ok-to-test tags="@tag.All"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10717573805>
> Commit: 0db98de71d8166d292d725ba57494ad577ea38de
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10717573805&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Thu, 05 Sep 2024 10:22:31 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **New Features**
- Updated chat, embeddings, root, and vision configurations to enhance
user interface layout and organization.
- Introduced new control types for a more responsive and visually
structured design.
- **Bug Fixes**
- Improved clarity and usability of configuration elements through
logical grouping and restructuring.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Alex 2024-09-06 12:21:11 +03:00 committed by GitHub
parent 7a53aff29e
commit d37e8d2a47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 265 additions and 234 deletions

View File

@ -1,92 +1,99 @@
{ {
"identifier": "CHAT", "identifier": "CHAT",
"controlType": "SECTION", "controlType": "SECTION_V2",
"conditionals": { "conditionals": {
"show": "{{actionConfiguration.formData.command.data === 'CHAT'}}" "show": "{{actionConfiguration.formData.command.data === 'CHAT'}}"
}, },
"children": [ "children": [
{ {
"label": "Models", "controlType": "DOUBLE_COLUMN_ZONE",
"tooltipText": "Select the model for response generation", "children": [
"subtitle": "ID of the model to use.", {
"isRequired": true, "label": "Models",
"propertyName": "chat_model_id", "tooltipText": "Select the model for response generation",
"configProperty": "actionConfiguration.formData.chatModel.data", "subtitle": "ID of the model to use.",
"controlType": "DROP_DOWN", "isRequired": true,
"initialValue": "", "propertyName": "chat_model_id",
"options": [], "configProperty": "actionConfiguration.formData.chatModel.data",
"placeholderText": "All models will be fetched.", "controlType": "DROP_DOWN",
"fetchOptionsConditionally": true, "initialValue": "",
"setFirstOptionAsDefault": true, "options": [],
"alternateViewTypes": ["json"], "placeholderText": "All models will be fetched.",
"conditionals": { "fetchOptionsConditionally": true,
"enable": "{{true}}", "setFirstOptionAsDefault": true,
"fetchDynamicValues": { "alternateViewTypes": ["json"],
"condition": "{{actionConfiguration.formData.command.data === 'CHAT'}}", "conditionals": {
"config": { "enable": "{{true}}",
"params": { "fetchDynamicValues": {
"requestType": "CHAT_MODELS", "condition": "{{actionConfiguration.formData.command.data === 'CHAT'}}",
"displayType": "DROP_DOWN" "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": "16",
"isRequired": true,
"dataType": "NUMBER",
"customStyles": {
"width": "270px",
"minWidth": "270px"
}
},
{
"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",
"alternateViewTypes": ["json"],
"addMoreButtonLabel": "Add message",
"schema": [
{
"label": "Role",
"key": "role",
"controlType": "QUERY_DYNAMIC_INPUT_TEXT",
"placeholderText": "user OR system",
"initialValue": "user"
}, },
{ {
"label": "Content", "label": "Max Tokens",
"key": "content", "tooltipText": "The maximum number of tokens to generate in the chat completion.",
"controlType": "QUERY_DYNAMIC_INPUT_TEXT", "subtitle": "The maximum number of tokens to generate in the chat completion.",
"placeholderText": "{{ UserInput.text }}" "Description": "Put a positive integer value",
"configProperty": "actionConfiguration.formData.maxTokens",
"controlType": "INPUT_TEXT",
"initialValue": "16",
"isRequired": true,
"dataType": "NUMBER"
} }
] ]
}, },
{ {
"label": "Temperature", "controlType": "SINGLE_COLUMN_ZONE",
"tooltipText": "Put a value between 0 and 2", "children": [
"Description": "Put a value between 0 and 2", {
"subtitle": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.", "label": "Messages",
"configProperty": "actionConfiguration.formData.temperature", "tooltipText": "Ask a question",
"controlType": "INPUT_TEXT", "subtitle": "A list of messages comprising the conversation so far.",
"dataType": "NUMBER", "propertyName": "messages",
"initialValue": "0", "isRequired": true,
"isRequired": false, "configProperty": "actionConfiguration.formData.messages.data",
"customStyles": { "controlType": "ARRAY_FIELD",
"width": "270px", "alternateViewTypes": ["json"],
"minWidth": "270px" "addMoreButtonLabel": "Add message",
} "schema": [
{
"label": "Role",
"key": "role",
"controlType": "QUERY_DYNAMIC_INPUT_TEXT",
"placeholderText": "user OR system",
"initialValue": "user"
},
{
"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 2",
"Description": "Put a value between 0 and 2",
"subtitle": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.",
"configProperty": "actionConfiguration.formData.temperature",
"controlType": "INPUT_TEXT",
"dataType": "NUMBER",
"initialValue": "0",
"isRequired": false
}
]
} }
] ]
} }

View File

@ -1,63 +1,78 @@
{ {
"identifier": "EMBEDDINGS", "identifier": "EMBEDDINGS",
"controlType": "SECTION", "controlType": "SECTION_V2",
"conditionals": { "conditionals": {
"show": "{{actionConfiguration.formData.command.data === 'EMBEDDINGS'}}" "show": "{{actionConfiguration.formData.command.data === 'EMBEDDINGS'}}"
}, },
"children": [ "children": [
{ {
"label": "Models", "controlType": "DOUBLE_COLUMN_ZONE",
"tooltipText": "Select the model for embedding generation", "children": [
"subtitle": "ID of the model to use.", {
"isRequired": true, "label": "Models",
"propertyName": "embedding_model_id", "tooltipText": "Select the model for embedding generation",
"configProperty": "actionConfiguration.formData.embeddingsModel.data", "subtitle": "ID of the model to use.",
"controlType": "DROP_DOWN", "isRequired": true,
"initialValue": "", "propertyName": "embedding_model_id",
"options": [], "configProperty": "actionConfiguration.formData.embeddingsModel.data",
"placeholderText": "All models will be fetched.", "controlType": "DROP_DOWN",
"fetchOptionsConditionally": true, "initialValue": "",
"setFirstOptionAsDefault": true, "options": [],
"alternateViewTypes": ["json"], "placeholderText": "All models will be fetched.",
"conditionals": { "fetchOptionsConditionally": true,
"enable": "{{true}}", "setFirstOptionAsDefault": true,
"fetchDynamicValues": { "alternateViewTypes": ["json"],
"condition": "{{actionConfiguration.formData.command.data === 'EMBEDDINGS'}}", "conditionals": {
"config": { "enable": "{{true}}",
"params": { "fetchDynamicValues": {
"requestType": "EMBEDDING_MODELS", "condition": "{{actionConfiguration.formData.command.data === 'EMBEDDINGS'}}",
"displayType": "DROP_DOWN" "config": {
"params": {
"requestType": "EMBEDDING_MODELS",
"displayType": "DROP_DOWN"
}
}
} }
} }
} }
} ]
}, },
{ {
"label": "Input", "controlType": "SINGLE_COLUMN_ZONE",
"tooltipText": "Provide the string or array of strings", "children": [
"subtitle": "Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays.", {
"propertyName": "input", "label": "Input",
"configProperty": "actionConfiguration.formData.input", "tooltipText": "Provide the string or array of strings",
"controlType": "QUERY_DYNAMIC_TEXT", "subtitle": "Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays.",
"isRequired": true, "propertyName": "input",
"placeholderText": "Hello World! OR ['hello', 'world']" "configProperty": "actionConfiguration.formData.input",
"controlType": "QUERY_DYNAMIC_TEXT",
"isRequired": true,
"placeholderText": "Hello World! OR ['hello', 'world']"
}
]
}, },
{ {
"label": "Encoding Format", "controlType": "DOUBLE_COLUMN_ZONE",
"tooltipText": "Defaults to float", "children": [
"subtitle": "The format to return the embeddings in. Can be either float or base64",
"configProperty": "actionConfiguration.formData.encodingFormat",
"controlType": "DROP_DOWN",
"isRequired": false,
"initialValue": "float",
"options": [
{ {
"label": "float", "label": "Encoding Format",
"value": "float" "tooltipText": "Defaults to float",
}, "subtitle": "The format to return the embeddings in. Can be either float or base64",
{ "configProperty": "actionConfiguration.formData.encodingFormat",
"label": "base64", "controlType": "DROP_DOWN",
"value": "base64" "isRequired": false,
"initialValue": "float",
"options": [
{
"label": "float",
"value": "float"
},
{
"label": "base64",
"value": "base64"
}
]
} }
] ]
} }

View File

@ -1,28 +1,33 @@
{ {
"editor": [ "editor": [
{ {
"controlType": "SECTION", "controlType": "SECTION_V2",
"identifier": "SELECTOR", "identifier": "SELECTOR",
"children": [ "children": [
{ {
"label": "Command", "controlType": "DOUBLE_COLUMN_ZONE",
"description": "Choose the method you would like to use", "children": [
"configProperty": "actionConfiguration.formData.command.data",
"controlType": "DROP_DOWN",
"isRequired": true,
"initialValue": "CHAT",
"options": [
{ {
"label": "Chat", "label": "Command",
"value": "CHAT" "description": "Choose the method you would like to use",
}, "configProperty": "actionConfiguration.formData.command.data",
{ "controlType": "DROP_DOWN",
"label": "Embeddings", "isRequired": true,
"value": "EMBEDDINGS" "initialValue": "CHAT",
}, "options": [
{ {
"label": "Vision", "label": "Chat",
"value": "VISION" "value": "CHAT"
},
{
"label": "Embeddings",
"value": "EMBEDDINGS"
},
{
"label": "Vision",
"value": "VISION"
}
]
} }
] ]
} }

View File

@ -1,124 +1,128 @@
{ {
"identifier": "VISION", "identifier": "VISION",
"controlType": "SECTION", "controlType": "SECTION_V2",
"conditionals": { "conditionals": {
"show": "{{actionConfiguration.formData.command.data === 'VISION'}}" "show": "{{actionConfiguration.formData.command.data === 'VISION'}}"
}, },
"children": [ "children": [
{ {
"label": "Models", "controlType": "DOUBLE_COLUMN_ZONE",
"tooltipText": "Select the model for response generation", "children": [
"subtitle": "ID of the model to use.", {
"isRequired": true, "label": "Models",
"propertyName": "vision_model_id", "tooltipText": "Select the model for response generation",
"configProperty": "actionConfiguration.formData.visionModel.data", "subtitle": "ID of the model to use.",
"controlType": "DROP_DOWN", "isRequired": true,
"initialValue": "", "propertyName": "vision_model_id",
"options": [], "configProperty": "actionConfiguration.formData.visionModel.data",
"placeholderText": "All models will be fetched.", "controlType": "DROP_DOWN",
"fetchOptionsConditionally": true, "initialValue": "",
"setFirstOptionAsDefault": true, "options": [],
"alternateViewTypes": ["json"], "placeholderText": "All models will be fetched.",
"conditionals": { "fetchOptionsConditionally": true,
"enable": "{{true}}", "setFirstOptionAsDefault": true,
"fetchDynamicValues": { "alternateViewTypes": ["json"],
"condition": "{{actionConfiguration.formData.command.data === 'VISION'}}", "conditionals": {
"config": { "enable": "{{true}}",
"params": { "fetchDynamicValues": {
"requestType": "VISION_MODELS", "condition": "{{actionConfiguration.formData.command.data === 'VISION'}}",
"displayType": "DROP_DOWN" "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": "16",
"isRequired": true,
"dataType": "NUMBER",
"customStyles": {
"width": "270px",
"minWidth": "270px"
}
},
{
"label": "System Messages",
"tooltipText": "Provide system instructions to the assistant",
"subtitle": "A list of messages for Assistant as instructions",
"propertyName": "systemMessages",
"isRequired": false,
"configProperty": "actionConfiguration.formData.systemMessages.data",
"controlType": "ARRAY_FIELD",
"alternateViewTypes": ["json"],
"addMoreButtonLabel": "Add System Message",
"customStyles": {
"width": "40vw"
},
"schema": [
{ {
"label": "Content", "label": "Max Tokens",
"key": "content", "tooltipText": "The maximum number of tokens to generate in the chat completion.",
"controlType": "QUERY_DYNAMIC_INPUT_TEXT", "subtitle": "The maximum number of tokens to generate in the chat completion.",
"placeholderText": "{{ UserInput.text }}", "Description": "Put a positive integer value",
"initialValue": "As an OCR expert your skills are unparalleled. Respond with just the text in the image" "configProperty": "actionConfiguration.formData.maxTokens",
"controlType": "INPUT_TEXT",
"initialValue": "16",
"isRequired": true,
"dataType": "NUMBER"
} }
] ]
}, },
{ {
"label": "User Messages", "controlType": "SINGLE_COLUMN_ZONE",
"tooltipText": "Provide User queries", "children": [
"subtitle": "A list of user messages or images. You can pass a link to the image or the base64 encoded image directly in the request.",
"propertyName": "userMessages",
"isRequired": true,
"configProperty": "actionConfiguration.formData.userMessages.data",
"controlType": "ARRAY_FIELD",
"alternateViewTypes": ["json"],
"addMoreButtonLabel": "Add User message or Image",
"schema": [
{ {
"label": "Type", "label": "System Messages",
"key": "type", "tooltipText": "Provide system instructions to the assistant",
"controlType": "DROP_DOWN", "subtitle": "A list of messages for Assistant as instructions",
"initialValue": "text", "propertyName": "systemMessages",
"options": [ "isRequired": false,
"configProperty": "actionConfiguration.formData.systemMessages.data",
"controlType": "ARRAY_FIELD",
"alternateViewTypes": ["json"],
"addMoreButtonLabel": "Add System Message",
"schema": [
{ {
"label": "Text", "label": "Content",
"value": "text" "key": "content",
}, "controlType": "QUERY_DYNAMIC_INPUT_TEXT",
{ "placeholderText": "{{ UserInput.text }}",
"label": "Image", "initialValue": "As an OCR expert your skills are unparalleled. Respond with just the text in the image"
"value": "image"
} }
] ]
}, },
{ {
"label": "Content", "label": "User Messages",
"key": "content", "tooltipText": "Provide User queries",
"controlType": "QUERY_DYNAMIC_INPUT_TEXT", "subtitle": "A list of user messages or images. You can pass a link to the image or the base64 encoded image directly in the request.",
"placeholderText": "{{Img1.image}} or {{Input1.text}}" "propertyName": "userMessages",
"isRequired": true,
"configProperty": "actionConfiguration.formData.userMessages.data",
"controlType": "ARRAY_FIELD",
"alternateViewTypes": ["json"],
"addMoreButtonLabel": "Add User message or Image",
"schema": [
{
"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}}"
}
]
} }
] ]
}, },
{ {
"label": "Temperature", "controlType": "DOUBLE_COLUMN_ZONE",
"tooltipText": "Put a value between 0 and 2", "children": [
"Description": "Put a value between 0 and 2", {
"subtitle": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.", "label": "Temperature",
"configProperty": "actionConfiguration.formData.temperature", "tooltipText": "Put a value between 0 and 2",
"controlType": "INPUT_TEXT", "Description": "Put a value between 0 and 2",
"dataType": "NUMBER", "subtitle": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.",
"initialValue": "0", "configProperty": "actionConfiguration.formData.temperature",
"isRequired": false, "controlType": "INPUT_TEXT",
"customStyles": { "dataType": "NUMBER",
"width": "270px", "initialValue": "0",
"minWidth": "270px" "isRequired": false
} }
]
} }
] ]
} }