Skip to content

fix: assistant list UX improvements#3881

Open
mdshamoon wants to merge 24 commits intomasterfrom
issue/4963
Open

fix: assistant list UX improvements#3881
mdshamoon wants to merge 24 commits intomasterfrom
issue/4963

Conversation

@mdshamoon
Copy link
Copy Markdown
Member

@mdshamoon mdshamoon commented Apr 8, 2026

Assistant list UX fixes: default sort by updated_at desc, disable save when no changes, remove KB name, fix delete mutation variable, remove no-evals text, add copy icon for assistant ID. Note: assistantId search requires backend AssistantFilter update.

Summary by CodeRabbit

  • New Features

    • Added copy-to-clipboard button for assistant IDs in the assistant list.
    • Introduced knowledge base file management with upload, attachment, and removal capabilities.
    • Enhanced assistant search to include ID matching alongside name matching.
  • Improvements

    • Assistant list now defaults to sorting by "Last Updated" in descending order.
    • Save button is now disabled when there are no pending changes.
  • Tests

    • Updated test assertions to reflect new identifier formats.

mdshamoon and others added 9 commits April 7, 2026 20:53
- Default sort by last modified (updated_at) descending
- Disable Save button when no changes have been made
- Remove knowledge base name display, keep only vector store ID
- Add assistantId to search parameters for backend filtering
- Fix delete assistant (use deleteAssistantId variable, not id)
- Remove 'No evals run' placeholder text
- Add copy icon before assistant ID in list page
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR introduces a new KnowledgeBaseOptions component to replace AssistantOptions in the assistant configuration flow, enabling file management with queued uploads, retry logic with exponential backoff, and a 20MB per-file size limit. The assistant list is enhanced with a copy-to-clipboard button for the display ID and updated to sort by updated_at descending while searching across name and assistant ID. The ConfigEditor component switches to the new component and adds hasUnsavedChanges to the Save button's disable condition. Supporting CSS styling, test expectations, and mock data are updated accordingly.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • Unified API: Upload Files #3779: Replaces the legacy AssistantOptions upload flow with a new KAAPI-based knowledge-base approach, introducing the KnowledgeBaseOptions component with UPLOAD_FILE_TO_KAAPI and CREATE_KNOWLEDGE_BASE mutations.
  • Assistant Detail Page with Version Management #3860: Updates AssistantDetail/ConfigEditor.tsx to switch from AssistantOptions to KnowledgeBaseOptions and modifies the Save button disable logic directly in the same file.
  • feat: queued assistant file uploads #3854: Implements a similar queued, concurrent, and abortable per-file upload workflow with retry and backoff logic for assistant knowledge-base file management.

Suggested labels

staging

Suggested reviewers

  • rvignesh89
  • priyanshu6238

Poem

🐰 Knowledge files hop in the queue so neat,
With retries bouncing, oh what a treat!
Uploads dance in parallel delight,
Copy that ID with a button so bright!
The assistants now manage their base just right!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix: assistant list UX improvements' accurately describes the primary changes, which focus on improving the assistant list user experience through sorting, search, copy functionality, and UI refinements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue/4963

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 8, 2026

Not up to standards ⛔

🔴 Issues 24 high · 9 medium · 10 minor

Alerts:
⚠ 43 issues (≤ 0 issues of at least minor severity)

Results:
43 new issues

Category Results
UnusedCode 2 medium
BestPractice 5 medium
2 minor
12 high
ErrorProne 12 high
CodeStyle 8 minor
Performance 2 medium

View in Codacy

🟢 Metrics 406 complexity

Metric Results
Complexity 406

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

@github-actions github-actions bot temporarily deployed to pull request April 8, 2026 17:55 Inactive
Copy link
Copy Markdown

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/containers/Assistants/AssistantOptions/AssistantOptions.tsx (1)

483-486: ⚠️ Potential issue | 🟡 Minor

Remove duplicate setFieldValue call.

setFieldValue('knowledgeBaseVersionId', ...) is called twice consecutively on lines 483 and 484. The second call is redundant and should be removed.

🔧 Proposed fix
         setFieldValue('knowledgeBaseVersionId', knowledgeBaseData.knowledgeBase.knowledgeBaseVersionId);
-        setFieldValue('knowledgeBaseVersionId', knowledgeBaseData.knowledgeBase.knowledgeBaseVersionId);
         setTimeout(() => validateForm(), 0);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantOptions/AssistantOptions.tsx` around lines
483 - 486, Remove the duplicate setFieldValue call for 'knowledgeBaseVersionId'
— in the block where you call setFieldValue('knowledgeBaseVersionId',
knowledgeBaseData.knowledgeBase.knowledgeBaseVersionId) twice, delete the
redundant second invocation so only one setFieldValue remains; keep the
surrounding calls (the setTimeout(() => validateForm(), 0) and
setFieldValue('knowledgeBaseName', ...)) intact to preserve flow.
🧹 Nitpick comments (5)
src/containers/Assistants/AssistantList/AssistantList.module.css (1)

40-48: Consider a larger hit area for the copy action.

Line 41 uses very tight padding and a 12px icon; increasing the button target improves click/touch accessibility without changing behavior.

Suggested tweak
 .CopyButton {
-  padding: 2px !important;
+  min-width: 24px;
+  min-height: 24px;
+  padding: 4px;
+  display: inline-flex;
+  align-items: center;
+  justify-content: center;
   color: `#6b7280`;
 
   svg {
     width: 12px;
     height: 12px;
   }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantList/AssistantList.module.css` around
lines 40 - 48, The .CopyButton styling uses very small padding and a 12px SVG
which makes the hit target too small for touch/click; update the .CopyButton
rules to increase the interactive area (e.g., raise padding to ~6–8px or add a
min-width/min-height) and increase the nested svg size to around 16px so the
visual remains proportional while improving accessibility; keep color and other
visual styles unchanged and ensure any !important usage is preserved only if
necessary.
src/containers/Assistants/AssistantDetail/ConfigEditor.tsx (1)

149-150: Consider wrapping JSON.parse in try-catch for defensive error handling.

If version.settings contains a malformed JSON string, JSON.parse will throw and crash the component. While this may be unlikely if the backend is consistent, adding defensive error handling would improve resilience.

🛡️ Proposed defensive parsing
     const rawSettings = version.settings ?? {};
-    const settings = typeof rawSettings === 'string' ? JSON.parse(rawSettings) : rawSettings;
+    let settings = rawSettings;
+    if (typeof rawSettings === 'string') {
+      try {
+        settings = JSON.parse(rawSettings);
+      } catch {
+        settings = {};
+      }
+    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantDetail/ConfigEditor.tsx` around lines 149
- 150, The parsing of version.settings is unguarded: when rawSettings (from
version.settings) is a string the code calls JSON.parse(rawSettings) which can
throw on malformed JSON; wrap the parse in a try-catch inside ConfigEditor.tsx
(around the JSON.parse call that assigns settings) and on error fall back to a
safe default (e.g., {} or rawSettings) and optionally surface/log the error (use
existing logger or console.error) so the component does not crash.
src/routes/AuthenticatedRoute/AuthenticatedRoute.tsx (2)

77-87: Naming deviates from coding guidelines.

The variable was renamed from routeStaff to staffRoutes. As per coding guidelines, route trees should use routeStaff for Staff role and routeAdmin for Manager/Admin/Glific_admin roles.

Consider keeping the original naming convention for consistency with the documented patterns.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/routes/AuthenticatedRoute/AuthenticatedRoute.tsx` around lines 77 - 87,
The variable staffRoutes deviates from the project's naming convention for route
trees; rename staffRoutes back to routeStaff and update all references where
it's imported/used (e.g., in AuthenticatedRoute component or any JSX/exports) to
match the original convention; also verify other route trees follow the pattern
(routeAdmin for Admin/Manager/Glific_admin) and update exports/uses accordingly
to keep names consistent across the codebase.

89-165: Same naming deviation applies here.

routeAdmin was renamed to adminRoutes. Additionally, the conversion from <Routes> wrapper to a React fragment (<>) is necessary for the conditional route injection pattern used below.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/routes/AuthenticatedRoute/AuthenticatedRoute.tsx` around lines 89 - 165,
The admin route block was renamed from routeAdmin to adminRoutes and must be
consistently used and wrapped as a fragment (<>...</>) to support conditional
route injection; update the AuthenticatedRoute component to reference
adminRoutes (not routeAdmin) wherever injected and ensure the block declared as
const adminRoutes uses a React fragment instead of a <Routes> wrapper so it can
be conditionally inserted into the main <Routes> tree (look for symbols
adminRoutes and AuthenticatedRoute to locate the changes).
src/containers/Assistants/AssistantOptions/AssistantOptions.module.css (1)

85-127: Stylelint :global warnings are false positives.

The :global pseudo-class is valid CSS Modules syntax for escaping local scoping. The Stylelint errors can be suppressed by configuring selector-pseudo-class-no-unknown to allow :global:

{
  "selector-pseudo-class-no-unknown": [true, { "ignorePseudoClasses": ["global"] }]
}

However, consider these concerns:

  1. Fixed dimensions (663px width, 510px min-height) may cause issues on smaller viewports or mobile devices.
  2. Heavy !important usage indicates fighting MUI defaults—consider using MUI's sx prop or theme overrides for cleaner integration.
  3. :has() selector requires modern browser support (Chrome 105+, Safari 15.4+, Firefox 121+). Verify this aligns with your browser support matrix.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantOptions/AssistantOptions.module.css`
around lines 85 - 127, Stylelint is flagging valid CSS Modules :global usage and
the stylesheet also uses rigid fixed sizes and many !important overrides; update
the lint configuration to allow the pseudo-class (add
"selector-pseudo-class-no-unknown": [true, { "ignorePseudoClasses": ["global"]
}]) and then refactor the CSS selectors such as :global .kb-dialog-content and
:global(.MuiDialog-paper):has(.kb-dialog-content) to be responsive and avoid
!important: replace fixed width/min-height (663px / 510px) with responsive
constraints (e.g., max-width and width using vw or clamp/min() functions or
media queries), remove unnecessary !important by moving overrides into MUI theme
overrides or Dialog PaperProps/sx, and either remove or provide a fallback for
the :has() usage (or ensure supported browsers per your support matrix) so
selectors like :global(.MuiDialog-paper):has(.kb-dialog-content) degrade safely.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/containers/Assistants/AssistantOptions/AssistantOptions.tsx`:
- Around line 483-486: Remove the duplicate setFieldValue call for
'knowledgeBaseVersionId' — in the block where you call
setFieldValue('knowledgeBaseVersionId',
knowledgeBaseData.knowledgeBase.knowledgeBaseVersionId) twice, delete the
redundant second invocation so only one setFieldValue remains; keep the
surrounding calls (the setTimeout(() => validateForm(), 0) and
setFieldValue('knowledgeBaseName', ...)) intact to preserve flow.

---

Nitpick comments:
In `@src/containers/Assistants/AssistantDetail/ConfigEditor.tsx`:
- Around line 149-150: The parsing of version.settings is unguarded: when
rawSettings (from version.settings) is a string the code calls
JSON.parse(rawSettings) which can throw on malformed JSON; wrap the parse in a
try-catch inside ConfigEditor.tsx (around the JSON.parse call that assigns
settings) and on error fall back to a safe default (e.g., {} or rawSettings) and
optionally surface/log the error (use existing logger or console.error) so the
component does not crash.

In `@src/containers/Assistants/AssistantList/AssistantList.module.css`:
- Around line 40-48: The .CopyButton styling uses very small padding and a 12px
SVG which makes the hit target too small for touch/click; update the .CopyButton
rules to increase the interactive area (e.g., raise padding to ~6–8px or add a
min-width/min-height) and increase the nested svg size to around 16px so the
visual remains proportional while improving accessibility; keep color and other
visual styles unchanged and ensure any !important usage is preserved only if
necessary.

In `@src/containers/Assistants/AssistantOptions/AssistantOptions.module.css`:
- Around line 85-127: Stylelint is flagging valid CSS Modules :global usage and
the stylesheet also uses rigid fixed sizes and many !important overrides; update
the lint configuration to allow the pseudo-class (add
"selector-pseudo-class-no-unknown": [true, { "ignorePseudoClasses": ["global"]
}]) and then refactor the CSS selectors such as :global .kb-dialog-content and
:global(.MuiDialog-paper):has(.kb-dialog-content) to be responsive and avoid
!important: replace fixed width/min-height (663px / 510px) with responsive
constraints (e.g., max-width and width using vw or clamp/min() functions or
media queries), remove unnecessary !important by moving overrides into MUI theme
overrides or Dialog PaperProps/sx, and either remove or provide a fallback for
the :has() usage (or ensure supported browsers per your support matrix) so
selectors like :global(.MuiDialog-paper):has(.kb-dialog-content) degrade safely.

In `@src/routes/AuthenticatedRoute/AuthenticatedRoute.tsx`:
- Around line 77-87: The variable staffRoutes deviates from the project's naming
convention for route trees; rename staffRoutes back to routeStaff and update all
references where it's imported/used (e.g., in AuthenticatedRoute component or
any JSX/exports) to match the original convention; also verify other route trees
follow the pattern (routeAdmin for Admin/Manager/Glific_admin) and update
exports/uses accordingly to keep names consistent across the codebase.
- Around line 89-165: The admin route block was renamed from routeAdmin to
adminRoutes and must be consistently used and wrapped as a fragment (<>...</>)
to support conditional route injection; update the AuthenticatedRoute component
to reference adminRoutes (not routeAdmin) wherever injected and ensure the block
declared as const adminRoutes uses a React fragment instead of a <Routes>
wrapper so it can be conditionally inserted into the main <Routes> tree (look
for symbols adminRoutes and AuthenticatedRoute to locate the changes).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a51a1c82-1234-4874-b98b-0a9554e800a0

📥 Commits

Reviewing files that changed from the base of the PR and between 866843c and 401f549.

📒 Files selected for processing (20)
  • src/containers/Assistants/AssistantDetail/AssistantDetail.test.tsx
  • src/containers/Assistants/AssistantDetail/AssistantDetail.tsx
  • src/containers/Assistants/AssistantDetail/ConfigEditor.test.tsx
  • src/containers/Assistants/AssistantDetail/ConfigEditor.tsx
  • src/containers/Assistants/AssistantList/AssistantList.module.css
  • src/containers/Assistants/AssistantList/AssistantList.test.tsx
  • src/containers/Assistants/AssistantList/AssistantList.tsx
  • src/containers/Assistants/AssistantOptions/AssistantOptions.module.css
  • src/containers/Assistants/AssistantOptions/AssistantOptions.test.tsx
  • src/containers/Assistants/AssistantOptions/AssistantOptions.tsx
  • src/containers/Assistants/Assistants.test.tsx
  • src/containers/Assistants/Assistants.tsx
  • src/graphql/queries/Organization.ts
  • src/i18n/en/en.json
  • src/i18n/hi/hi.json
  • src/mocks/Assistants.ts
  • src/mocks/Organization.tsx
  • src/routes/AuthenticatedRoute/AuthenticatedRoute.test.tsx
  • src/routes/AuthenticatedRoute/AuthenticatedRoute.tsx
  • src/services/AuthService.tsx

@cypress
Copy link
Copy Markdown

cypress bot commented Apr 8, 2026

Glific    Run #8417

Run Properties:  status check failed Failed #8417  •  git commit 8cbc614b32 ℹ️: Merge f32dd06ecd3d2cb1cdfc1502a3c4b3bc648f0107 into 9079e102134b2ff83314a0e7f663...
Project Glific
Branch Review issue/4963
Run status status check failed Failed #8417
Run duration 12m 52s
Commit git commit 8cbc614b32 ℹ️: Merge f32dd06ecd3d2cb1cdfc1502a3c4b3bc648f0107 into 9079e102134b2ff83314a0e7f663...
Committer Mohd Shamoon
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 1
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 97
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/e2e/filesearch/Filesearch.spec.ts • 1 failed test

View Output

Test Artifacts
File search > should create a new assistant with file upload Test Replay Screenshots
Flakiness  cypress/e2e/chat/ChatCollection.spec.ts • 1 flaky test

View Output

Test Artifacts
ChatCollection > should send the emoji to collection Test Replay Screenshots

@mdshamoon mdshamoon changed the base branch from master to issue/4948 April 8, 2026 18:21
Base automatically changed from issue/4948 to master April 8, 2026 18:28
@github-actions github-actions bot temporarily deployed to pull request April 8, 2026 18:31 Inactive
@github-actions github-actions bot temporarily deployed to pull request April 9, 2026 09:34 Inactive
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.17%. Comparing base (a83f43e) to head (bbca7c0).

Files with missing lines Patch % Lines
...tainers/Assistants/AssistantList/AssistantList.tsx 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3881      +/-   ##
==========================================
- Coverage   82.18%   82.17%   -0.02%     
==========================================
  Files         311      311              
  Lines       13146    13148       +2     
  Branches     3038     3037       -1     
==========================================
  Hits        10804    10804              
- Misses       1396     1399       +3     
+ Partials      946      945       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

{...queries}
{...columnAttributes}
searchParameter={['name']}
searchParameter={['name', 'assistantId']}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lets combine this values

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

@github-actions github-actions bot temporarily deployed to pull request April 9, 2026 11:15 Inactive
@github-actions github-actions bot temporarily deployed to pull request April 9, 2026 16:57 Inactive
…ant UI

- Copy AssistantOptions into KnowledgeBaseOptions with new dialog design
  (Manage Knowledge Base title, Proceed button, two-column layout)
- Revert AssistantOptions to pre-PR state for legacy CreateAssistant
- ConfigEditor now uses KnowledgeBaseOptions
- Show knowledgeBaseName as fallback when vectorStoreId not yet available
- Show 'Knowledge Base upload in progress...' while awaiting refetch
- Remove sort-by-name from AssistantList (sort by last updated only)
- Fix filterAssistantsMock variables to match actual sort config
- Fix Assistants test assertion (vectorStore ID replaces removed name display)
- Use name_or_assistant_id as single search parameter
@github-actions github-actions bot temporarily deployed to pull request April 10, 2026 09:50 Inactive
Copy link
Copy Markdown

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

🧹 Nitpick comments (4)
src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.tsx (3)

97-100: Use const with a conditional expression instead of let reassignment.

The fileUploadDisabled variable is reassigned immediately after declaration. This can be simplified to a single expression.

Proposed fix
-  let fileUploadDisabled = false;
-  if (isLegacyVectorStore || disabled) {
-    fileUploadDisabled = true;
-  }
+  const fileUploadDisabled = isLegacyVectorStore || disabled;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.tsx` around
lines 97 - 100, Replace the mutable let with an immutable const by computing
fileUploadDisabled in one expression: change the current two-step assignment
that declares fileUploadDisabled then reassigns it based on isLegacyVectorStore
or disabled to a single const fileUploadDisabled = isLegacyVectorStore ||
disabled; so references to fileUploadDisabled in KnowledgeBaseOptions.tsx remain
unchanged but the variable is no longer reassigned.

389-392: Parameter error shadows component state variable.

The error parameter in the catch block shadows the error state variable declared at line 87. While this works correctly here, renaming for clarity would improve readability.

Proposed fix
-      .catch((error) => {
-        if (isAbortError(error)) return;
-        console.error('Error uploading files:', error);
+      .catch((uploadError) => {
+        if (isAbortError(uploadError)) return;
+        console.error('Error uploading files:', uploadError);
       })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.tsx` around
lines 389 - 392, The catch block in the uploadFiles promise uses a parameter
named error which shadows the component's error state (declared as error in
KnowledgeBaseOptions). Rename the catch parameter (e.g., to uploadError or err)
in the .catch(...) callback and update the console.error call to use the new
name, ensuring isAbortError(uploadError) (or isAbortError(err)) check and the
log reference are updated so the component state variable is no longer shadowed.

22-33: Props interface uses any types, reducing type safety.

The formikValues, formikErrors, and formikTouched props are typed as any, which bypasses TypeScript's type checking. Consider defining proper types based on the form's shape from ConfigEditor.tsx.

Proposed type definitions
+interface AssistantFormValues {
+  name: string;
+  model: any;
+  instructions: string;
+  temperature: number;
+  knowledgeBaseVersionId: string;
+  knowledgeBaseName: string;
+  versionDescription: string;
+  initialFiles: UploadedFile[];
+}
+
 interface KnowledgeBaseOptionsProps {
-  formikValues: any;
+  formikValues: AssistantFormValues;
   setFieldValue: (field: string, value: any) => void;
-  formikErrors: any;
-  formikTouched: any;
+  formikErrors: Partial<Record<keyof AssistantFormValues, string>>;
+  formikTouched: Partial<Record<keyof AssistantFormValues, boolean>>;
   knowledgeBaseId: string | null;
   isLegacyVectorStore: boolean;
   onFilesChange: (hasChanges: boolean) => void;
   vectorStoreId: string;
   validateForm: () => void;
   disabled: boolean;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.tsx` around
lines 22 - 33, The props interface KnowledgeBaseOptionsProps currently uses
loose any types for formikValues, formikErrors, and formikTouched; replace these
with precise types derived from the form shape defined in ConfigEditor.tsx (or
import Formik's typed helpers) so TypeScript can enforce correctness. Update
KnowledgeBaseOptionsProps to reference a concrete FormValues interface (e.g.,
ConfigFormValues) for formikValues and use FormikErrors<ConfigFormValues> and
FormikTouched<ConfigFormValues> for formikErrors and formikTouched; also align
setFieldValue's signature with Formik's SetFieldValue type if applicable. Ensure
you import or declare the ConfigFormValues type from ConfigEditor.tsx (or a
shared types file) and update all usages in KnowledgeBaseOptions component to
match the new typed props.
src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.module.css (1)

85-126: Consider reducing !important overrides and leveraging MUI theme.

The :global selectors are valid CSS Modules syntax (static analysis warnings are false positives). However, the extensive use of !important to override MUI dialog styles is heavy-handed. Consider using MUI's sx prop or slotProps on the DialogBox component to apply these styles, which would integrate better with the theme system and avoid specificity wars.

Additionally, hardcoded color values (e.g., #cccccc, #191c1a, #119656) could be replaced with theme variables from src/config/theme.tsx for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.module.css`
around lines 85 - 126, The CSS file overuses !important on selectors like
:global(.MuiDialog-paper):has(.kb-dialog-content), :global .kb-dialog-content,
and :global(.MuiDialog-paper) :global(.MuiDialogTitle-root); replace these heavy
overrides by moving styling into the Dialog component via MUI props (use sx or
slotProps on the Dialog/DialogPaper/DialogTitle/DialogActions) to set width,
padding, border, radius, boxShadow and alignment without !important, and swap
hardcoded colors (`#cccccc`, `#191c1a`, `#119656`) for theme tokens from
src/config/theme.tsx so styles inherit the app theme and avoid specificity wars.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.tsx`:
- Around line 710-731: The number input's disabled prop is inconsistent with the
Slider: update the input (role="sliderDisplay") so its disabled logic matches
the Slider by using disabled={disabled} (remove the && !isLegacyVectorStore
condition), ensuring both Slider and input are disabled together; locate the
input using formikValues.temperature, setFieldValue, and isLegacyVectorStore
symbols to change only the disabled prop.
- Around line 483-484: Remove the duplicate call to setFieldValue by keeping a
single invocation of setFieldValue('knowledgeBaseVersionId',
knowledgeBaseData.knowledgeBase.knowledgeBaseVersionId) in the AssistantOptions
component; delete the redundant repeated line so the field is only set once
(verify there are no other intended different fields to set in place of the
duplicate).
- Around line 712-714: The input element using role="sliderDisplay"
(name="sliderDisplay") is using an invalid ARIA role; remove that invalid role
and replace it with a test identifier (data-testid="sliderDisplay") and either
omit the role entirely or use a valid ARIA role such as "spinbutton" if you need
an explicit role for accessibility — update the <input name="sliderDisplay"> in
the KnowledgeBaseOptions component accordingly so tests can target data-testid
and accessibility uses a valid role.
- Around line 720-728: The onChange handler for the temperature input uses
parseFloat and only checks value < 0 || value > 2, which allows NaN to pass and
be set via setFieldValue; update the handler (the onChange that calls setError
and setFieldValue for 'temperature') to explicitly detect NaN (e.g.,
Number.isNaN(value) or isNaN(valueString) after parsing), treat it as invalid
(setError(true) and return), and only call setFieldValue('temperature', value)
when value is a valid number within [0,2]; ensure setError(false) is only
reached after both the NaN and range checks pass.
- Around line 102-108: Add a cleanup effect that aborts in-flight uploads and
prevents state updates after unmount: create a ref (e.g.,
activeUploadControllersRef) to store AbortController instances for each upload,
ensure the upload starter code (the functions that initiate uploads referenced
by isUploadDialogOpenRef and any upload handlers) registers its controller in
activeUploadControllersRef and passes controller.signal to fetch/axios, and add
a useEffect with a return cleanup that calls abort() on all controllers and
clears the ref (and optionally sets isUploadDialogOpenRef.current = false); also
guard state-updating callbacks (e.g., setFiles) to no-op if the request was
aborted (check controller.signal.aborted) so resolved promises won’t update
state after unmount.

---

Nitpick comments:
In `@src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.module.css`:
- Around line 85-126: The CSS file overuses !important on selectors like
:global(.MuiDialog-paper):has(.kb-dialog-content), :global .kb-dialog-content,
and :global(.MuiDialog-paper) :global(.MuiDialogTitle-root); replace these heavy
overrides by moving styling into the Dialog component via MUI props (use sx or
slotProps on the Dialog/DialogPaper/DialogTitle/DialogActions) to set width,
padding, border, radius, boxShadow and alignment without !important, and swap
hardcoded colors (`#cccccc`, `#191c1a`, `#119656`) for theme tokens from
src/config/theme.tsx so styles inherit the app theme and avoid specificity wars.

In `@src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.tsx`:
- Around line 97-100: Replace the mutable let with an immutable const by
computing fileUploadDisabled in one expression: change the current two-step
assignment that declares fileUploadDisabled then reassigns it based on
isLegacyVectorStore or disabled to a single const fileUploadDisabled =
isLegacyVectorStore || disabled; so references to fileUploadDisabled in
KnowledgeBaseOptions.tsx remain unchanged but the variable is no longer
reassigned.
- Around line 389-392: The catch block in the uploadFiles promise uses a
parameter named error which shadows the component's error state (declared as
error in KnowledgeBaseOptions). Rename the catch parameter (e.g., to uploadError
or err) in the .catch(...) callback and update the console.error call to use the
new name, ensuring isAbortError(uploadError) (or isAbortError(err)) check and
the log reference are updated so the component state variable is no longer
shadowed.
- Around line 22-33: The props interface KnowledgeBaseOptionsProps currently
uses loose any types for formikValues, formikErrors, and formikTouched; replace
these with precise types derived from the form shape defined in ConfigEditor.tsx
(or import Formik's typed helpers) so TypeScript can enforce correctness. Update
KnowledgeBaseOptionsProps to reference a concrete FormValues interface (e.g.,
ConfigFormValues) for formikValues and use FormikErrors<ConfigFormValues> and
FormikTouched<ConfigFormValues> for formikErrors and formikTouched; also align
setFieldValue's signature with Formik's SetFieldValue type if applicable. Ensure
you import or declare the ConfigFormValues type from ConfigEditor.tsx (or a
shared types file) and update all usages in KnowledgeBaseOptions component to
match the new typed props.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f6bd1b7f-be46-4ab3-bd0b-ce5b36d27ff8

📥 Commits

Reviewing files that changed from the base of the PR and between 1bbb122 and b1a692b.

📒 Files selected for processing (4)
  • src/containers/Assistants/AssistantDetail/ConfigEditor.tsx
  • src/containers/Assistants/AssistantList/AssistantList.tsx
  • src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.module.css
  • src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/containers/Assistants/AssistantDetail/ConfigEditor.tsx
  • src/containers/Assistants/AssistantList/AssistantList.tsx

Comment on lines +102 to +108
useEffect(() => {
setFiles(formikValues.initialFiles.map(mapInitialFileToAssistantFile));
}, [formikValues.initialFiles]);

useEffect(() => {
isUploadDialogOpenRef.current = showUploadDialog;
}, [showUploadDialog]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing cleanup effect to abort uploads on component unmount.

If the component unmounts while uploads are in progress (e.g., user navigates away), the upload promises will still resolve and attempt to update state, causing React warnings about state updates on unmounted components. Add a cleanup effect to cancel active requests.

Proposed fix
   useEffect(() => {
     setFiles(formikValues.initialFiles.map(mapInitialFileToAssistantFile));
   }, [formikValues.initialFiles]);

   useEffect(() => {
     isUploadDialogOpenRef.current = showUploadDialog;
   }, [showUploadDialog]);

+  useEffect(() => {
+    return () => {
+      cancelActiveRequests();
+      pendingUploadQueueRef.current = [];
+    };
+  }, []);
📝 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(() => {
setFiles(formikValues.initialFiles.map(mapInitialFileToAssistantFile));
}, [formikValues.initialFiles]);
useEffect(() => {
isUploadDialogOpenRef.current = showUploadDialog;
}, [showUploadDialog]);
useEffect(() => {
setFiles(formikValues.initialFiles.map(mapInitialFileToAssistantFile));
}, [formikValues.initialFiles]);
useEffect(() => {
isUploadDialogOpenRef.current = showUploadDialog;
}, [showUploadDialog]);
useEffect(() => {
return () => {
cancelActiveRequests();
pendingUploadQueueRef.current = [];
};
}, []);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.tsx` around
lines 102 - 108, Add a cleanup effect that aborts in-flight uploads and prevents
state updates after unmount: create a ref (e.g., activeUploadControllersRef) to
store AbortController instances for each upload, ensure the upload starter code
(the functions that initiate uploads referenced by isUploadDialogOpenRef and any
upload handlers) registers its controller in activeUploadControllersRef and
passes controller.signal to fetch/axios, and add a useEffect with a return
cleanup that calls abort() on all controllers and clears the ref (and optionally
sets isUploadDialogOpenRef.current = false); also guard state-updating callbacks
(e.g., setFiles) to no-op if the request was aborted (check
controller.signal.aborted) so resolved promises won’t update state after
unmount.

Comment on lines +710 to +731
disabled={disabled}
/>
<input
role="sliderDisplay"
name="sliderDisplay"
type="number"
step={0.1}
min={0}
max={2}
value={formikValues.temperature}
onChange={(event) => {
const value = parseFloat(event.target.value);
if (value < 0 || value > 2) {
setError(true);
return;
}
setError(false);
setFieldValue('temperature', value);
}}
className={`${styles.SliderDisplay} ${error ? styles.Error : ''}`}
disabled={disabled && !isLegacyVectorStore}
/>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Apr 10, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inconsistent disabled logic between Slider and input.

The Slider is disabled when disabled is true (line 710), but the number input is disabled only when disabled && !isLegacyVectorStore (line 730). This means when viewing a legacy vector store assistant, users can edit the temperature via the input but not the slider, which seems unintentional.

Proposed fix for consistent behavior
             <input
               role="sliderDisplay"
               name="sliderDisplay"
               type="number"
               step={0.1}
               min={0}
               max={2}
               value={formikValues.temperature}
               onChange={(event) => {
                 const value = parseFloat(event.target.value);
                 if (value < 0 || value > 2) {
                   setError(true);
                   return;
                 }
                 setError(false);
                 setFieldValue('temperature', value);
               }}
               className={`${styles.SliderDisplay} ${error ? styles.Error : ''}`}
-              disabled={disabled && !isLegacyVectorStore}
+              disabled={disabled}
             />
📝 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
disabled={disabled}
/>
<input
role="sliderDisplay"
name="sliderDisplay"
type="number"
step={0.1}
min={0}
max={2}
value={formikValues.temperature}
onChange={(event) => {
const value = parseFloat(event.target.value);
if (value < 0 || value > 2) {
setError(true);
return;
}
setError(false);
setFieldValue('temperature', value);
}}
className={`${styles.SliderDisplay} ${error ? styles.Error : ''}`}
disabled={disabled && !isLegacyVectorStore}
/>
disabled={disabled}
/>
<input
role="sliderDisplay"
name="sliderDisplay"
type="number"
step={0.1}
min={0}
max={2}
value={formikValues.temperature}
onChange={(event) => {
const value = parseFloat(event.target.value);
if (value < 0 || value > 2) {
setError(true);
return;
}
setError(false);
setFieldValue('temperature', value);
}}
className={`${styles.SliderDisplay} ${error ? styles.Error : ''}`}
disabled={disabled}
/>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.tsx` around
lines 710 - 731, The number input's disabled prop is inconsistent with the
Slider: update the input (role="sliderDisplay") so its disabled logic matches
the Slider by using disabled={disabled} (remove the && !isLegacyVectorStore
condition), ensuring both Slider and input are disabled together; locate the
input using formikValues.temperature, setFieldValue, and isLegacyVectorStore
symbols to change only the disabled prop.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mdshamoon can you fix this?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Comment on lines +712 to +714
<input
role="sliderDisplay"
name="sliderDisplay"
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Apr 10, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Invalid ARIA role sliderDisplay.

The role="sliderDisplay" attribute is not a valid ARIA role. This appears to be used as a test identifier—use data-testid instead. Valid roles for this context would be spinbutton (default for type="number" inputs) or no explicit role.

Proposed fix
             <input
-              role="sliderDisplay"
+              data-testid="sliderDisplay"
               name="sliderDisplay"
               type="number"
📝 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
<input
role="sliderDisplay"
name="sliderDisplay"
<input
data-testid="sliderDisplay"
name="sliderDisplay"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.tsx` around
lines 712 - 714, The input element using role="sliderDisplay"
(name="sliderDisplay") is using an invalid ARIA role; remove that invalid role
and replace it with a test identifier (data-testid="sliderDisplay") and either
omit the role entirely or use a valid ARIA role such as "spinbutton" if you need
an explicit role for accessibility — update the <input name="sliderDisplay"> in
the KnowledgeBaseOptions component accordingly so tests can target data-testid
and accessibility uses a valid role.

Copy link
Copy Markdown
Collaborator

@priyanshu6238 priyanshu6238 Apr 10, 2026

Choose a reason for hiding this comment

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

@mdshamoon can you pls fix this one also ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Comment on lines +720 to +728
onChange={(event) => {
const value = parseFloat(event.target.value);
if (value < 0 || value > 2) {
setError(true);
return;
}
setError(false);
setFieldValue('temperature', value);
}}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Missing NaN validation for temperature input.

parseFloat returns NaN for non-numeric input (e.g., empty string or letters). Since NaN < 0 and NaN > 2 are both false, the validation passes and NaN gets set as the temperature value.

Proposed fix
               onChange={(event) => {
                 const value = parseFloat(event.target.value);
-                if (value < 0 || value > 2) {
+                if (Number.isNaN(value) || value < 0 || value > 2) {
                   setError(true);
                   return;
                 }
                 setError(false);
                 setFieldValue('temperature', value);
               }}
📝 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
onChange={(event) => {
const value = parseFloat(event.target.value);
if (value < 0 || value > 2) {
setError(true);
return;
}
setError(false);
setFieldValue('temperature', value);
}}
onChange={(event) => {
const value = parseFloat(event.target.value);
if (Number.isNaN(value) || value < 0 || value > 2) {
setError(true);
return;
}
setError(false);
setFieldValue('temperature', value);
}}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/containers/Assistants/AssistantOptions/KnowledgeBaseOptions.tsx` around
lines 720 - 728, The onChange handler for the temperature input uses parseFloat
and only checks value < 0 || value > 2, which allows NaN to pass and be set via
setFieldValue; update the handler (the onChange that calls setError and
setFieldValue for 'temperature') to explicitly detect NaN (e.g.,
Number.isNaN(value) or isNaN(valueString) after parsing), treat it as invalid
(setError(true) and return), and only call setFieldValue('temperature', value)
when value is a valid number within [0,2]; ensure setError(false) is only
reached after both the NaN and range checks pass.

@github-actions github-actions bot temporarily deployed to pull request April 10, 2026 09:53 Inactive
@github-actions github-actions bot temporarily deployed to pull request April 10, 2026 09:56 Inactive
Old CreateAssistant continues to use the original dialog (Manage Files,
Save button, drag-drop upload). New AssistantDetail uses KnowledgeBaseOptions
with the new design. Reverts dialog title assertions in Assistants.test.tsx.
@github-actions github-actions bot temporarily deployed to pull request April 10, 2026 10:01 Inactive
@github-actions github-actions bot temporarily deployed to pull request April 10, 2026 10:51 Inactive
@github-actions github-actions bot temporarily deployed to pull request April 10, 2026 10:55 Inactive
@github-actions github-actions bot temporarily deployed to pull request April 10, 2026 11:07 Inactive
@@ -0,0 +1,739 @@
import { useMutation } from '@apollo/client';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We are not writing any tests for this page?

Copy link
Copy Markdown
Collaborator

@priyanshu6238 priyanshu6238 left a comment

Choose a reason for hiding this comment

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

LGTM other then few minor issue

Copy link
Copy Markdown
Collaborator

@priyanshu6238 priyanshu6238 left a comment

Choose a reason for hiding this comment

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

UI test case is failing ,can you fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants