Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add function calling config form #39252

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

znamenskii-ilia
Copy link
Contributor

@znamenskii-ilia znamenskii-ilia commented Feb 13, 2025

Description

fc.mov

Fixes #39152
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

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13369293716
Commit: 32f0aa4
Cypress dashboard.
Tags: @tag.Anvil
Spec:


Mon, 17 Feb 2025 11:59:23 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Introduced a dynamic configuration interface for managing function calls, allowing users to add, edit, and remove entries.
    • Added interactive components for entering and displaying function call configurations, including an attractive placeholder for when no entries exist.
    • Enhanced selection options for various function types (e.g., query, JS function, system function) and integrated these into the form control system for seamless user experience.

Copy link
Contributor

coderabbitai bot commented Feb 13, 2025

Walkthrough

This pull request adds a set of new React components and related utilities to manage function calling configurations in an AI assistant form. The changes include components for adding, editing, and removing function calls using Redux Form, new selectors and type definitions for entity options, and updates to the form control registry to integrate the new functionality.

Changes

File(s) Change Summary
app/client/.../FunctionCallingConfigControl.tsx, app/client/.../FunctionCallingConfigForm.tsx, app/client/.../FunctionCallingConfigToolField.tsx, app/client/.../FunctionCallingEmpty.tsx Introduced new React components to handle function calling configurations, including dynamic list management, styled UI elements, and Redux state updates.
app/client/.../selectors.ts, app/client/.../types.ts Added new selectors for retrieving function options and types/interfaces to define configuration entities.
app/client/.../index.ts Added a new export to simplify the import path for the FunctionCallingConfigControl component.
app/client/.../FormControlRegistry.tsx, app/client/.../formControlTypes.ts Registered a new form control builder and added a corresponding constant for FUNCTION_CALLING_CONFIG_FORM in the form control configuration.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant FC as FunctionCallingConfigControl
    participant FCF as FunctionCallingConfigForm
    participant Redux as Redux Form
    participant FCTF as FunctionCallingConfigToolField

    U->>FC: Render component
    FC->>FCF: Pass props via FieldArray
    FCF->>Redux: Initialize dynamic function entries
    U->>FCF: Click "Add Function"
    FCF->>Redux: Add new function entry (using uuid)
    Redux-->>FCF: Update form state with new entry
    U->>FCF: Click "Remove Function"
    FCF->>Redux: Remove function entry by index
    Redux-->>FCF: Update form state after removal
Loading

Suggested labels

ok-to-test, IDE Product, IDE Pod

Suggested reviewers

  • KelvinOm
  • jsartisan
  • ApekshaBhosale

Poem

In our code garden, new features take flight,
Function calls bloom in the morning light.
Adding, removing with Redux in tow,
A vibrant dance in our UI show.
Cheers to enhancements that help us grow! 🎉

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Anvil Pod Issue related to Anvil project Task A simple Todo Enhancement New feature or request labels Feb 13, 2025
@znamenskii-ilia
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/13308820067.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 39252.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-39252.dp.appsmith.com

@znamenskii-ilia znamenskii-ilia force-pushed the feat/39152-function-calling-config branch from 6da4429 to ed5f4f6 Compare February 13, 2025 16:08
@znamenskii-ilia znamenskii-ilia force-pushed the feat/39152-function-calling-config branch 2 times, most recently from 1bf2193 to 6a84c42 Compare February 14, 2025 13:07
@znamenskii-ilia
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/13330058464.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 39252.
recreate: .

@znamenskii-ilia znamenskii-ilia force-pushed the feat/39152-function-calling-config branch from 6a84c42 to 715fbdf Compare February 14, 2025 13:29
Copy link

Deploy-Preview-URL: https://ce-39252.dp.appsmith.com

@znamenskii-ilia znamenskii-ilia marked this pull request as ready for review February 14, 2025 14:36
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (5)
app/client/src/components/formControls/FunctionCallingConfigControl/types.ts (1)

8-11: Consider adding documentation for entity types.

The union type is well-defined, but adding JSDoc comments explaining each entity type's purpose would improve maintainability.

app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingEmpty.tsx (1)

19-19: Add descriptive alt text for accessibility.

Empty alt text reduces accessibility. Consider adding descriptive alt text like "Empty function calls illustration".

-      <img alt="" src={getAssetUrl(`${ASSETS_CDN_URL}/empty-state.svg`)} />
+      <img alt="Empty function calls illustration" src={getAssetUrl(`${ASSETS_CDN_URL}/empty-state.svg`)} />
app/client/src/components/formControls/FunctionCallingConfigControl/FunctionCallingConfigControl.tsx (1)

19-22: Consider creating a dedicated type for form props.

The props object passed to FunctionCallingConfigForm could benefit from a dedicated interface.

interface FunctionCallingConfigFormProps {
  formName: string;
  configProperty: string;
}
app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigForm.tsx (1)

33-40: Consider adding validation for maximum number of functions.

The handleAddFunctionButtonClick allows unlimited function additions. Consider adding a maximum limit to prevent performance issues.

 const handleAddFunctionButtonClick = useCallback(() => {
+  const MAX_FUNCTIONS = 10;
+  if (fields.length >= MAX_FUNCTIONS) {
+    return;
+  }
   fields.push({
     id: uuid(),
     description: "",
app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts (1)

63-75: Consider memoizing the flatMap operation.

The selectJsFunctionEntityOptions performs a potentially expensive flatMap operation on every call.

+import { createSelector } from 'reselect';

-const selectJsFunctionEntityOptions = (
+const selectJsFunctionEntityOptions = createSelector(
+  getJSCollections,
   state: AppState,
 ): FunctionCallingEntityTypeOption[] => {
-  return getJSCollections(state).flatMap((jsCollection) => {
+  return (collections) => collections.flatMap((jsCollection) => {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a60eaa and 715fbdf.

📒 Files selected for processing (10)
  • app/client/packages/design-system/ads/src/Select/rc-styles.css (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/FunctionCallingConfigControl.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigForm.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigToolField.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingEmpty.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/index.ts (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/types.ts (1 hunks)
  • app/client/src/utils/formControl/FormControlRegistry.tsx (2 hunks)
  • app/client/src/utils/formControl/formControlTypes.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/components/formControls/FunctionCallingConfigControl/index.ts
🧰 Additional context used
🪛 GitHub Actions: Quality checks
app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigToolField.tsx

[error] 8-8: "../../DropDownControl" has no exported member named 'DropDownGroupedOptionsInterface'. Did you mean 'DropDownGroupedOptions'?

🔇 Additional comments (9)
app/client/packages/design-system/ads/src/Select/rc-styles.css (1)

6-6: LGTM! Good use of design system variable.

The addition of background color using the design system variable maintains consistency with the design system.

app/client/src/components/formControls/FunctionCallingConfigControl/types.ts (2)

1-6: LGTM! Well-structured interface definition.

The interface properties are clearly defined with appropriate optional fields.


13-19: LGTM! Clear and comprehensive interface definition.

The interface captures all necessary fields for function calling configuration.

app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingEmpty.tsx (1)

7-14: LGTM! Clean styled component implementation.

Good use of CSS variables and flex layout for centering content.

app/client/src/utils/formControl/formControlTypes.ts (1)

26-26: LGTM! Consistent with existing pattern.

The new form control type follows the established naming convention.

app/client/src/components/formControls/FunctionCallingConfigControl/FunctionCallingConfigControl.tsx (1)

8-11: LGTM! Well-documented component.

Good use of JSDoc to explain the component's purpose and functionality.

app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigForm.tsx (1)

70-72: Add empty state handling for fields array.

The conditional rendering at line 70 looks good, but consider adding a more descriptive empty state message.

app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts (1)

77-111: LGTM! Well-structured system functions mapping.

The system functions mapping is well-organized and uses proper type safety with const assertions.

app/client/src/utils/formControl/FormControlRegistry.tsx (1)

235-242: LGTM! Control registration follows established pattern.

The registration of FunctionCallingConfigControl follows the same pattern as other controls and is properly implemented.

import { useDispatch, useSelector } from "react-redux";
import { change, formValueSelector } from "redux-form";
import styled from "styled-components";
import type { DropDownGroupedOptionsInterface } from "../../DropDownControl";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix the imported interface name.

The pipeline failure indicates that 'DropDownGroupedOptionsInterface' should be 'DropDownGroupedOptions'.

-import type { DropDownGroupedOptionsInterface } from "../../DropDownControl";
+import type { DropDownGroupedOptions } from "../../DropDownControl";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import type { DropDownGroupedOptionsInterface } from "../../DropDownControl";
import type { DropDownGroupedOptions } from "../../DropDownControl";
🧰 Tools
🪛 GitHub Actions: Quality checks

[error] 8-8: "../../DropDownControl" has no exported member named 'DropDownGroupedOptionsInterface'. Did you mean 'DropDownGroupedOptions'?

Comment on lines 67 to 81
const findEntityType = useCallback(
(entityId: string): string => {
switch (true) {
case findEntityOption(entityId, entityOptions.Query):
return "Query";
case findEntityOption(entityId, entityOptions.JSFunction):
return "JSFunction";
case findEntityOption(entityId, entityOptions.SystemFunction):
return "SystemFunction";
}

return "";
},
[fieldValue.entityId],
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Dependency array in useCallback is incorrect.

The findEntityType callback depends on findEntityOption and entityOptions, but the dependency array only includes fieldValue.entityId.

-    [fieldValue.entityId],
+    [findEntityOption, entityOptions],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const findEntityType = useCallback(
(entityId: string): string => {
switch (true) {
case findEntityOption(entityId, entityOptions.Query):
return "Query";
case findEntityOption(entityId, entityOptions.JSFunction):
return "JSFunction";
case findEntityOption(entityId, entityOptions.SystemFunction):
return "SystemFunction";
}
return "";
},
[fieldValue.entityId],
);
const findEntityType = useCallback(
(entityId: string): string => {
switch (true) {
case findEntityOption(entityId, entityOptions.Query):
return "Query";
case findEntityOption(entityId, entityOptions.JSFunction):
return "JSFunction";
case findEntityOption(entityId, entityOptions.SystemFunction):
return "SystemFunction";
}
return "";
},
[findEntityOption, entityOptions],
);

@znamenskii-ilia znamenskii-ilia force-pushed the feat/39152-function-calling-config branch from 715fbdf to 989b568 Compare February 14, 2025 14:49
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigForm.tsx (2)

32-40: Consider extracting default values to constants.

Extract the default function configuration to a constant to improve maintainability and reusability.

+const DEFAULT_FUNCTION_CONFIG = {
+  description: "",
+  entityId: "",
+  requiresApproval: false,
+  entityType: "Query",
+} as const;

 const handleAddFunctionButtonClick = useCallback(() => {
   fields.push({
     id: uuid(),
-    description: "",
-    entityId: "",
-    requiresApproval: false,
-    entityType: "Query",
+    ...DEFAULT_FUNCTION_CONFIG,
   });
 }, [fields]);

49-89: Consider wrapping with an error boundary.

The form handles dynamic data and user interactions. Adding an error boundary would improve reliability.

app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts (1)

77-111: Improve type safety for labelMap.

The current type assertion doesn't guarantee that all system functions have corresponding labels.

-    const labelMap: Record<keyof typeof systemFunctions, string> = {
+    const labelMap = {
      navigateTo: createMessage(NAVIGATE_TO),
      showAlert: createMessage(SHOW_ALERT),
      // ... other mappings
-    };
+    } satisfies Record<keyof typeof systemFunctions, string>;
app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigToolField.tsx (1)

111-148: Consider fixing FormControl type definitions.

Instead of using @ts-expect-error, consider updating the FormControl component's type definitions to properly support the isSearchable property.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 715fbdf and 989b568.

📒 Files selected for processing (10)
  • app/client/packages/design-system/ads/src/Select/rc-styles.css (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/FunctionCallingConfigControl.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigForm.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigToolField.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingEmpty.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/index.ts (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/types.ts (1 hunks)
  • app/client/src/utils/formControl/FormControlRegistry.tsx (2 hunks)
  • app/client/src/utils/formControl/formControlTypes.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • app/client/src/components/formControls/FunctionCallingConfigControl/index.ts
  • app/client/packages/design-system/ads/src/Select/rc-styles.css
  • app/client/src/utils/formControl/formControlTypes.ts
  • app/client/src/utils/formControl/FormControlRegistry.tsx
  • app/client/src/components/formControls/FunctionCallingConfigControl/FunctionCallingConfigControl.tsx
  • app/client/src/components/formControls/FunctionCallingConfigControl/types.ts
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingEmpty.tsx
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
🔇 Additional comments (3)
app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigForm.tsx (1)

1-13: LGTM! Props interface and imports are well structured.

app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts (1)

113-128: LGTM! Excellent use of createSelector for performance optimization.

app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigToolField.tsx (1)

67-81: Fix useCallback dependencies.

The dependency array is incorrect.

-    [fieldValue.entityId, entityOptions],
+    [findEntityOption, entityOptions],

Comment on lines +83 to +94
useEffect(
// entityType is dependent on entityId
// Every time entityId changes, we need to find the new entityType
function handleEntityTypeChange() {
const entityType = findEntityType(fieldValue.entityId);

dispatch(
change(props.formName, `${props.fieldPath}.entityType`, entityType),
);
},
[fieldValue.entityId],
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing dependencies to useEffect.

The effect's dependency array is missing several dependencies.

-    [fieldValue.entityId],
+    [fieldValue.entityId, dispatch, props.formName, props.fieldPath, findEntityType],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(
// entityType is dependent on entityId
// Every time entityId changes, we need to find the new entityType
function handleEntityTypeChange() {
const entityType = findEntityType(fieldValue.entityId);
dispatch(
change(props.formName, `${props.fieldPath}.entityType`, entityType),
);
},
[fieldValue.entityId],
);
useEffect(
// entityType is dependent on entityId
// Every time entityId changes, we need to find the new entityType
function handleEntityTypeChange() {
const entityType = findEntityType(fieldValue.entityId);
dispatch(
change(props.formName, `${props.fieldPath}.entityType`, entityType),
);
},
[fieldValue.entityId, dispatch, props.formName, props.fieldPath, findEntityType],
);

@znamenskii-ilia znamenskii-ilia force-pushed the feat/39152-function-calling-config branch from 989b568 to 935effe Compare February 17, 2025 11:13
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigForm.tsx (1)

32-40: Consider extracting default values to a constant.

Extract the default function configuration to improve maintainability and reusability.

+const DEFAULT_FUNCTION_CONFIG = {
+  description: "",
+  entityId: "",
+  requiresApproval: false,
+  entityType: "Query",
+} as const;

 const handleAddFunctionButtonClick = useCallback(() => {
   fields.push({
     id: uuid(),
-    description: "",
-    entityId: "",
-    requiresApproval: false,
-    entityType: "Query",
+    ...DEFAULT_FUNCTION_CONFIG,
   });
 }, [fields]);
app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts (1)

38-61: Optimize selectQueryEntityOptions to reduce iterations.

The current implementation maps over the actions twice. This can be optimized into a single map operation.

 export const selectQueryEntityOptions = (
   state: AppState,
 ): FunctionCallingEntityTypeOption[] => {
   const plugins = getPlugins(state);
 
-  return getActions(state)
-    .map(({ config }) => ({
-      id: config.id,
-      name: config.name,
-      pluginId: config.pluginId,
-    }))
-    .map((action) => {
+  return getActions(state).map(({ config }) => {
       const iconSrc = plugins.find(
-        (plugin) => plugin.id === action.pluginId,
+        (plugin) => plugin.id === config.pluginId,
       )?.iconLocation;
 
       return {
-        value: action.id,
-        label: action.name,
+        value: config.id,
+        label: config.name,
         optionGroupType: "Query",
         iconSrc,
       };
-    });
+  });
 };
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 989b568 and 32f0aa4.

📒 Files selected for processing (9)
  • app/client/src/components/formControls/FunctionCallingConfigControl/FunctionCallingConfigControl.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigForm.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigToolField.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingEmpty.tsx (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/index.ts (1 hunks)
  • app/client/src/components/formControls/FunctionCallingConfigControl/types.ts (1 hunks)
  • app/client/src/utils/formControl/FormControlRegistry.tsx (2 hunks)
  • app/client/src/utils/formControl/formControlTypes.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • app/client/src/components/formControls/FunctionCallingConfigControl/index.ts
  • app/client/src/utils/formControl/formControlTypes.ts
  • app/client/src/components/formControls/FunctionCallingConfigControl/FunctionCallingConfigControl.tsx
  • app/client/src/utils/formControl/FormControlRegistry.tsx
  • app/client/src/components/formControls/FunctionCallingConfigControl/types.ts
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingEmpty.tsx
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (6)
app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigForm.tsx (2)

1-26: LGTM! Clean imports and well-structured type definitions.


49-89: LGTM! Clean and well-structured render logic.

Good use of conditional rendering and styled components for layout.

app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts (1)

77-128: LGTM! Well-structured selectors with proper memoization.

Good use of createSelector and comprehensive message mapping for system functions.

app/client/src/components/formControls/FunctionCallingConfigControl/components/FunctionCallingConfigToolField.tsx (3)

83-94: Add missing dependencies to useEffect.

The effect's dependency array is missing several dependencies.

-    [fieldValue.entityId],
+    [fieldValue.entityId, dispatch, props.formName, props.fieldPath, findEntityType],

67-81: Dependency array in useCallback is incorrect.

The findEntityType callback depends on findEntityOption and entityOptions, but the dependency array includes fieldValue.entityId which is not used.

-    [fieldValue.entityId, entityOptions],
+    [findEntityOption, entityOptions],

111-170: LGTM! Well-structured form controls with proper type checking.

Good use of the satisfies operator for type checking the optionGroupConfig.

@znamenskii-ilia znamenskii-ilia added the ok-to-test Required label for CI label Feb 17, 2025
@znamenskii-ilia znamenskii-ilia merged commit e40564d into release Feb 17, 2025
52 checks passed
@znamenskii-ilia znamenskii-ilia deleted the feat/39152-function-calling-config branch February 17, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Anvil Pod Issue related to Anvil project Enhancement New feature or request ok-to-test Required label for CI Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Function Calling config form
4 participants