Skip to content

Commit

Permalink
feat: exclude ai queries from function calling (#39399)
Browse files Browse the repository at this point in the history
## Description

Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

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

### 🔍 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/13457393528>
> Commit: 3216f72
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13457393528&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Anvil`
> Spec:
> <hr>Fri, 21 Feb 2025 13:30:05 UTC
<!-- end of auto-generated comment: Cypress test results  -->


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


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

## Summary by CodeRabbit

- **New Features**
- Enhanced the options available during configuration by refining the
filtering logic for actions. This update streamlines the selection
process, ensuring users see a more focused and relevant list in
configuration controls.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
znamenskii-ilia authored Feb 21, 2025
1 parent 150cab5 commit 6705001
Showing 1 changed file with 27 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,33 @@ export const selectQueryEntityOptions = (
): FunctionCallingEntityTypeOption[] => {
const plugins = getPlugins(state);

return getActions(state)
.map(({ config }) => ({
id: config.id,
name: config.name,
pluginId: config.pluginId,
}))
.map((action) => {
const iconSrc = plugins.find(
(plugin) => plugin.id === action.pluginId,
)?.iconLocation;
return (
getActions(state)
// TODO: Remove filtering once AIChat is a separate entity
.filter(
(action) =>
action.config.pluginType !== "AI" &&
// @ts-expect-error No way to narrow down proper type
action.config.pluginName !== "Appsmith AI",
)
.map(({ config }) => ({
id: config.id,
name: config.name,
pluginId: config.pluginId,
}))
.map((action) => {
const iconSrc = plugins.find(
(plugin) => plugin.id === action.pluginId,
)?.iconLocation;

return {
value: action.id,
label: action.name,
optionGroupType: "Query",
iconSrc,
};
});
return {
value: action.id,
label: action.name,
optionGroupType: "Query",
iconSrc,
};
})
);
};

const selectJsFunctionEntityOptions = (
Expand Down Expand Up @@ -106,8 +115,7 @@ const selectSystemFunctionEntityOptions =

return (
objectKeys(systemFunctions)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore assignRequest doesn't exist in CE repo but added in EE repo
// @ts-expect-error assignRequest doesn't exist in CE repo but added in EE repo
.filter((name) => name !== "assignRequest")
.map((name) => ({
value: name,
Expand Down

0 comments on commit 6705001

Please sign in to comment.