feat: Add a GigaChat Bundle#10464
Conversation
…bundle # Conflicts: # src/lfx/src/lfx/_assets/component_index.json
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis PR introduces a comprehensive GigaChat integration including backend components for text generation and embeddings, frontend icons and sidebar registration, configuration constants, unit tests, and documentation pages with a new runtime dependency. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 4❌ Failed checks (1 error, 3 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (3)
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py (1)
30-45: Consider adding test for max_tokens range validation.The component defines
max_tokenswith a range of 0-128000, but the test doesn't verify that this constraint is properly enforced in the template. Consider adding a test case to validate the range_spec is correctly set.src/lfx/src/lfx/components/gigachat/gigachat_models.py (1)
70-77: Clarify the default "USERNAME" value.The default value
"USERNAME"for theuserinput is a string literal placeholder, which might be confusing. Consider usingNoneas the default and updating the info text to clarify that a username should be provided if required by the API.Consider this adjustment:
StrInput( name="user", display_name="GigaChat User", - info="The GigaChat API Username to use.", + info="The GigaChat API Username to use (if required by your authentication method).", advanced=True, - value="USERNAME", + value=None, required=False, ),src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py (1)
59-66: Clarify the default "USERNAME" value.Similar to the models component, the default value
"USERNAME"is a string literal placeholder that might be confusing. Consider usingNoneand updating the info text to clarify when a username is needed.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
src/frontend/src/icons/GigaChat/gigachat.svgis excluded by!**/*.svguv.lockis excluded by!**/*.lock
📒 Files selected for processing (15)
docs/docs/Components/bundles-gigachat.mdx(1 hunks)docs/sidebars.js(1 hunks)pyproject.toml(2 hunks)src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py(1 hunks)src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py(1 hunks)src/frontend/src/icons/GigaChat/GigaChatIcon.jsx(1 hunks)src/frontend/src/icons/GigaChat/index.tsx(1 hunks)src/frontend/src/icons/eagerIconImports.ts(2 hunks)src/frontend/src/icons/lazyIconImports.ts(1 hunks)src/frontend/src/utils/styleUtils.ts(2 hunks)src/lfx/src/lfx/base/models/gigachat_constants.py(1 hunks)src/lfx/src/lfx/components/__init__.py(3 hunks)src/lfx/src/lfx/components/gigachat/__init__.py(1 hunks)src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py(1 hunks)src/lfx/src/lfx/components/gigachat/gigachat_models.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (17)
docs/**/*.{md,mdx}
📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)
docs/**/*.{md,mdx}: All Markdown/MDX pages must start with front matter including at least title and description; include sidebar_position for docs pages when applicable
Code blocks must specify a language and may include a title (```lang title="…")
Use sentence case for headings and keep paragraphs short and scannable
Write in second person, present tense, with a professional but approachable tone
Use inline code with backticks for code terms; use bold for UI elements and italics for emphasis; keep lists in parallel structure
Ensure internal links are functional and navigation works (update cross-references as needed)
Verify all code examples in docs and blog actually run as shown
Use correct terminology capitalization: Langflow, Component, Flow, API, JSON
Reference images with absolute paths under /img/... and provide descriptive alt text
Files:
docs/docs/Components/bundles-gigachat.mdx
docs/docs/**/*.{md,mdx}
📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)
Use Docusaurus admonitions (:::+tip|warning|danger) instead of custom callouts in docs pages
Files:
docs/docs/Components/bundles-gigachat.mdx
src/frontend/src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)
src/frontend/src/**/*.{ts,tsx,js,jsx}: All frontend TypeScript and JavaScript code should be located under src/frontend/src/ and organized into components, pages, icons, stores, types, utils, hooks, services, and assets directories as per the specified directory layout.
Use React 18 with TypeScript for all UI components in the frontend.
Format all TypeScript and JavaScript code using the make format_frontend command.
Lint all TypeScript and JavaScript code using the make lint command.
Files:
src/frontend/src/icons/eagerIconImports.tssrc/frontend/src/icons/lazyIconImports.tssrc/frontend/src/icons/GigaChat/index.tsxsrc/frontend/src/utils/styleUtils.tssrc/frontend/src/icons/GigaChat/GigaChatIcon.jsx
src/frontend/src/icons/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)
Use Lucide React for icons in the frontend.
Files:
src/frontend/src/icons/eagerIconImports.tssrc/frontend/src/icons/lazyIconImports.tssrc/frontend/src/icons/GigaChat/index.tsxsrc/frontend/src/icons/GigaChat/GigaChatIcon.jsx
src/frontend/src/icons/lazyIconImports.ts
📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)
Add your icon to the
lazyIconsMappingobject insrc/frontend/src/icons/lazyIconImports.tswith a key that matches the backend icon string exactly.
Files:
src/frontend/src/icons/lazyIconImports.ts
src/frontend/src/icons/*/*.@(js|jsx|ts|tsx)
📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)
Create a new directory for your icon in
src/frontend/src/icons/YourIconName/and add your SVG as a React component (e.g.,YourIconName.jsx). The SVG component must use theisDarkprop to support both light and dark mode.
Files:
src/frontend/src/icons/GigaChat/index.tsxsrc/frontend/src/icons/GigaChat/GigaChatIcon.jsx
src/frontend/src/icons/*/index.tsx
📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)
Create an
index.tsxin your icon directory that exports your icon usingforwardRefand passes theisDarkprop.
Files:
src/frontend/src/icons/GigaChat/index.tsx
docs/sidebars.js
📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)
Keep sidebars.js updated to include new/changed docs sections and items using Docusaurus category structure
Files:
docs/sidebars.js
src/frontend/src/utils/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)
All utility functions should be placed in the utils directory.
Files:
src/frontend/src/utils/styleUtils.ts
src/backend/tests/unit/components/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)
src/backend/tests/unit/components/**/*.py: Mirror the component directory structure for unit tests in src/backend/tests/unit/components/
Use ComponentTestBaseWithClient or ComponentTestBaseWithoutClient as base classes for component unit tests
Provide file_names_mapping for backward compatibility in component tests
Create comprehensive unit tests for all new components
Files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.pysrc/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
{src/backend/**/*.py,tests/**/*.py,Makefile}
📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)
{src/backend/**/*.py,tests/**/*.py,Makefile}: Run make format_backend to format Python code before linting or committing changes
Run make lint to perform linting checks on backend Python code
Files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.pysrc/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
src/backend/tests/unit/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)
Test component integration within flows using create_flow, build_flow, and get_build_events utilities
Files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.pysrc/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
src/backend/tests/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)
src/backend/tests/**/*.py: Unit tests for backend code must be located in the 'src/backend/tests/' directory, with component tests organized by component subdirectory under 'src/backend/tests/unit/components/'.
Test files should use the same filename as the component under test, with an appropriate test prefix or suffix (e.g., 'my_component.py' → 'test_my_component.py').
Use the 'client' fixture (an async httpx.AsyncClient) for API tests in backend Python tests, as defined in 'src/backend/tests/conftest.py'.
When writing component tests, inherit from the appropriate base class in 'src/backend/tests/base.py' (ComponentTestBase, ComponentTestBaseWithClient, or ComponentTestBaseWithoutClient) and provide the required fixtures: 'component_class', 'default_kwargs', and 'file_names_mapping'.
Each test in backend Python test files should have a clear docstring explaining its purpose, and complex setups or mocks should be well-commented.
Test both sync and async code paths in backend Python tests, using '@pytest.mark.asyncio' for async tests.
Mock external dependencies appropriately in backend Python tests to isolate unit tests from external services.
Test error handling and edge cases in backend Python tests, including using 'pytest.raises' and asserting error messages.
Validate input/output behavior and test component initialization and configuration in backend Python tests.
Use the 'no_blockbuster' pytest marker to skip the blockbuster plugin in tests when necessary.
Be aware of ContextVar propagation in async tests; test both direct event loop execution and 'asyncio.to_thread' scenarios to ensure proper context isolation.
Test error handling by mocking internal functions using monkeypatch in backend Python tests.
Test resource cleanup in backend Python tests by using fixtures that ensure proper initialization and cleanup of resources.
Test timeout and performance constraints in backend Python tests using 'asyncio.wait_for' and timing assertions.
Test Langflow's Messag...
Files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.pysrc/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
src/backend/**/*component*.py
📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)
In your Python component class, set the
iconattribute to a string matching the frontend icon mapping exactly (case-sensitive).
Files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
src/backend/**/components/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)
In your Python component class, set the
iconattribute to a string matching the frontend icon mapping exactly (case-sensitive).
Files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.pysrc/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
**/{test_*.py,*.test.ts,*.test.tsx}
📄 CodeRabbit inference engine (coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt)
**/{test_*.py,*.test.ts,*.test.tsx}: Check if tests have too many mock objects that obscure what’s actually being tested
Warn when mocks are used instead of testing real behavior and interactions
Suggest using real objects or simpler test doubles when mocks become excessive
Ensure mocks are used only for external dependencies, not core business logic
Recommend integration tests when unit tests become overly mocked
Check that test files follow the project’s naming conventions (backend: test_*.py; frontend: *.test.ts/tsx)
Verify that tests actually exercise the new or changed functionality, not placeholder assertions
Test files should have descriptive test function names explaining what is being tested
Organize tests logically with proper setup and teardown
Include edge cases and error conditions for comprehensive coverage
Verify tests cover both positive (success) and negative (failure) scenarios
Ensure tests are not mere smoke tests; they should validate behavior thoroughly
Ensure tests follow the project’s testing frameworks (pytest for backend, Playwright for frontend)
Files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.pysrc/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
**/test_*.py
📄 CodeRabbit inference engine (coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt)
**/test_*.py: Backend tests must be named test_*.py and use proper pytest structure (fixtures, assertions)
For async backend code, use proper pytest async patterns (e.g., pytest-asyncio)
For API endpoints, include tests for both success and error responses
Files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.pysrc/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
🧠 Learnings (29)
📚 Learning: 2025-09-07T05:44:46.715Z
Learnt from: TensorNull
Repo: langflow-ai/langflow PR: 9735
File: docs/docs/Components/bundles-cometapi.mdx:9-9
Timestamp: 2025-09-07T05:44:46.715Z
Learning: In Langflow bundle documentation files (docs/docs/Components/bundles-*.mdx), the standard link pattern for referencing the main Bundles page is [Bundles](/components-bundle-components), not /components-bundles. This pattern is used consistently across all 37+ bundle documentation files.
Applied to files:
docs/docs/Components/bundles-gigachat.mdx
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Use 'MockLanguageModel' for testing language model components without external API calls in backend Python tests.
Applied to files:
src/lfx/src/lfx/components/gigachat/gigachat_models.py
📚 Learning: 2025-08-11T16:52:26.755Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 9336
File: src/backend/base/langflow/base/models/openai_constants.py:29-33
Timestamp: 2025-08-11T16:52:26.755Z
Learning: The "gpt-5-chat-latest" model in the OpenAI models configuration does not support tool calling, so tool_calling should be set to False for this model in src/backend/base/langflow/base/models/openai_constants.py.
Applied to files:
src/lfx/src/lfx/components/gigachat/gigachat_models.py
📚 Learning: 2025-07-28T15:56:47.865Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-07-28T15:56:47.865Z
Learning: Applies to src/frontend/src/icons/lazyIconImports.ts : Add your icon to the `lazyIconsMapping` object in `src/frontend/src/icons/lazyIconImports.ts` with a key that matches the backend icon string exactly.
Applied to files:
src/frontend/src/icons/eagerIconImports.tssrc/frontend/src/icons/lazyIconImports.tssrc/frontend/src/icons/GigaChat/index.tsxsrc/frontend/src/utils/styleUtils.ts
📚 Learning: 2025-07-18T18:27:12.609Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-07-18T18:27:12.609Z
Learning: Applies to src/frontend/src/icons/**/*.{ts,tsx,js,jsx} : Use Lucide React for icons in the frontend.
Applied to files:
src/frontend/src/icons/eagerIconImports.tssrc/frontend/src/icons/lazyIconImports.tssrc/frontend/src/icons/GigaChat/index.tsxsrc/frontend/src/utils/styleUtils.tssrc/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-07-28T15:56:47.865Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-07-28T15:56:47.865Z
Learning: Applies to src/frontend/src/icons/*/index.tsx : Create an `index.tsx` in your icon directory that exports your icon using `forwardRef` and passes the `isDark` prop.
Applied to files:
src/frontend/src/icons/eagerIconImports.tssrc/frontend/src/icons/lazyIconImports.tssrc/frontend/src/icons/GigaChat/index.tsxsrc/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-07-28T15:56:47.865Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-07-28T15:56:47.865Z
Learning: Applies to src/frontend/src/icons/*/*.@(js|jsx|ts|tsx) : Create a new directory for your icon in `src/frontend/src/icons/YourIconName/` and add your SVG as a React component (e.g., `YourIconName.jsx`). The SVG component must use the `isDark` prop to support both light and dark mode.
Applied to files:
src/frontend/src/icons/eagerIconImports.tssrc/frontend/src/icons/lazyIconImports.tssrc/frontend/src/icons/GigaChat/index.tsxsrc/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: The frontend icon mapping key (in 'lazyIconsMapping') must match the backend 'icon' attribute string exactly, including case sensitivity, to ensure correct icon rendering.
Applied to files:
src/frontend/src/icons/lazyIconImports.ts
📚 Learning: 2025-08-11T16:52:17.902Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 9336
File: src/backend/base/langflow/base/models/openai_constants.py:5-33
Timestamp: 2025-08-11T16:52:17.902Z
Learning: In the Langflow codebase (src/backend/base/langflow/base/models/openai_constants.py), GPT-5 series models (gpt-5, gpt-5-mini, gpt-5-nano, gpt-5-chat-latest) are reasoning models and should have the reasoning=True flag set, which places them in OPENAI_REASONING_MODEL_NAMES rather than OPENAI_CHAT_MODEL_NAMES.
Applied to files:
src/lfx/src/lfx/base/models/gigachat_constants.py
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: Export custom icon components in React using React.forwardRef to ensure proper ref forwarding and compatibility with parent components.
Applied to files:
src/frontend/src/icons/GigaChat/index.tsxsrc/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-06-16T11:14:04.200Z
Learnt from: dolfim-ibm
Repo: langflow-ai/langflow PR: 8394
File: src/frontend/src/icons/Docling/index.tsx:4-6
Timestamp: 2025-06-16T11:14:04.200Z
Learning: The Langflow codebase consistently uses `React.PropsWithChildren<{}>` as the prop type for all icon components using forwardRef, rather than `React.SVGProps<SVGSVGElement>`. This is an established pattern across hundreds of icon files in src/frontend/src/icons/.
Applied to files:
src/frontend/src/icons/GigaChat/index.tsxsrc/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-07-18T18:27:12.609Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-07-18T18:27:12.609Z
Learning: Applies to src/frontend/src/components/**/@(FlowGraph|nodes)/**/*.{ts,tsx,js,jsx} : Use React Flow for flow graph visualization components.
Applied to files:
src/frontend/src/icons/GigaChat/index.tsx
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: When implementing a new component icon in Langflow, ensure the icon name is clear, recognizable, and used consistently across both backend (Python 'icon' attribute) and frontend (React/TypeScript mapping).
Applied to files:
src/frontend/src/icons/GigaChat/index.tsx
📚 Learning: 2025-09-30T00:09:51.631Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-09-30T00:09:51.631Z
Learning: Applies to docs/sidebars.js : Keep sidebars.js updated to include new/changed docs sections and items using Docusaurus category structure
Applied to files:
docs/sidebars.js
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/base/langflow/components/**/__init__.py : Update __init__.py with alphabetical imports when adding new components
Applied to files:
src/lfx/src/lfx/components/gigachat/__init__.pysrc/lfx/src/lfx/components/__init__.py
📚 Learning: 2025-07-28T15:56:47.865Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-07-28T15:56:47.865Z
Learning: Always use clear, recognizable, and consistent icon names for both backend and frontend (e.g., "AstraDB", "Postgres", "OpenAI").
Applied to files:
src/frontend/src/utils/styleUtils.ts
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: Custom SVG icon components in React should always support both light and dark mode by accepting an 'isdark' prop and adjusting colors accordingly.
Applied to files:
src/frontend/src/icons/GigaChat/GigaChatIcon.jsx
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Create comprehensive unit tests for all new components
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.pysrc/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : When writing component tests, inherit from the appropriate base class in 'src/backend/tests/base.py' (ComponentTestBase, ComponentTestBaseWithClient, or ComponentTestBaseWithoutClient) and provide the required fixtures: 'component_class', 'default_kwargs', and 'file_names_mapping'.
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-08-05T22:51:27.961Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 0
File: :0-0
Timestamp: 2025-08-05T22:51:27.961Z
Learning: The TestComposioComponentAuth test in src/backend/tests/unit/components/bundles/composio/test_base_composio.py demonstrates proper integration testing patterns for external API components, including real API calls with mocking for OAuth completion, comprehensive resource cleanup, and proper environment variable handling with pytest.skip() fallbacks.
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test component configuration updates in backend Python tests by asserting correct updates to build configuration objects.
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.pysrc/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Mirror the component directory structure for unit tests in src/backend/tests/unit/components/
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Use ComponentTestBaseWithClient or ComponentTestBaseWithoutClient as base classes for component unit tests
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-18T18:25:54.487Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.487Z
Learning: Applies to src/backend/tests/unit/**/*.py : Test component integration within flows using create_flow, build_flow, and get_build_events utilities
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test components that require external APIs using appropriate pytest markers (e.g., 'api_key_required', 'no_blockbuster') and environment variables for API keys.
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test files should use the same filename as the component under test, with an appropriate test prefix or suffix (e.g., 'my_component.py' → 'test_my_component.py').
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Validate input/output behavior and test component initialization and configuration in backend Python tests.
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.pysrc/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Test Langflow's Message objects and chat functionality in backend Python tests by asserting correct instantiation and property values.
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.pysrc/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
📚 Learning: 2025-07-21T14:16:14.125Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-07-21T14:16:14.125Z
Learning: Applies to src/backend/tests/**/*.py : Mock external dependencies appropriately in backend Python tests to isolate unit tests from external services.
Applied to files:
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py
🧬 Code graph analysis (6)
src/lfx/src/lfx/components/gigachat/gigachat_models.py (3)
src/lfx/src/lfx/base/models/model.py (1)
LCModelComponent(25-375)src/lfx/src/lfx/inputs/inputs.py (7)
BoolInput(414-426)DropdownInput(465-490)FloatInput(379-411)IntInput(344-376)SecretStrInput(286-341)SliderInput(642-643)StrInput(126-182)src/lfx/src/lfx/custom/custom_component/component.py (1)
get_base_inputs(167-170)
src/frontend/src/icons/eagerIconImports.ts (1)
src/frontend/src/icons/GigaChat/index.tsx (1)
GigaChatIcon(5-10)
src/frontend/src/icons/GigaChat/index.tsx (1)
src/frontend/src/icons/GigaChat/GigaChatIcon.jsx (1)
GigaChatSVG(1-17)
src/lfx/src/lfx/components/gigachat/__init__.py (2)
src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py (1)
GigaChatEmbeddingsComponent(11-103)src/lfx/src/lfx/components/gigachat/gigachat_models.py (1)
GigaChatComponent(14-145)
src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py (2)
src/lfx/src/lfx/field_typing/constants.py (1)
Embeddings(49-50)src/lfx/src/lfx/inputs/inputs.py (4)
BoolInput(414-426)IntInput(344-376)SecretStrInput(286-341)StrInput(126-182)
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py (2)
src/lfx/src/lfx/components/gigachat/gigachat_models.py (2)
GigaChatComponent(14-145)build_model(128-145)src/backend/tests/base.py (1)
ComponentTestBaseWithoutClient(166-167)
🔇 Additional comments (14)
pyproject.toml (1)
140-140: LGTM! Dependency addition is correct.The new
langchain-gigachat>=0.3.12dependency is properly added to support the GigaChat integration. The version constraint and alphabetical placement are appropriate.src/lfx/src/lfx/base/models/gigachat_constants.py (1)
1-45: LGTM! Constants are well-structured and consistent.The GigaChat model constants follow the established patterns in the codebase:
- Deprecated models are properly flagged and filtered from GIGACHAT_CHAT_MODEL_NAMES
- Current GigaChat-2 series models include tool_calling support
- Provider, icon, and scope constants are consistently defined
- Tests validate these constants comprehensively
src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py (1)
12-49: LGTM! Comprehensive test coverage.The test suite thoroughly validates the GigaChat constants:
- Tests verify list is non-empty, contains strings, has no duplicates, and includes expected models
- MODEL_NAMES alias is validated with both equality and identity checks
- Scopes are validated to ensure required API scopes are present
src/frontend/src/icons/eagerIconImports.ts (1)
36-36: LGTM! Icon import follows conventions.The GigaChat icon is correctly imported and mapped in eagerIconsMapping, maintaining alphabetical order and matching the backend icon string exactly.
Also applies to: 158-158
src/frontend/src/utils/styleUtils.ts (2)
280-280: LGTM! Sidebar bundle entry is correct.The GigaChat bundle is properly added to SIDEBAR_BUNDLES with the correct structure and alphabetical placement.
442-443: LGTM! Node icon mappings are correct.GigaChatModel and GigaChatEmbeddings are correctly mapped to the "GigaChat" icon, maintaining consistency with the backend component names and frontend icon system.
docs/sidebars.js (1)
316-316: LGTM! Documentation sidebar entry is correct.The GigaChat bundle is properly added to the documentation sidebar in alphabetical order, following the established pattern for component bundles.
src/frontend/src/icons/lazyIconImports.ts (1)
168-169: LGTM! Lazy icon import follows conventions.The GigaChat lazy import is correctly configured with the proper module path and export name, maintaining alphabetical order and consistency with the backend icon string. Based on learnings.
src/lfx/src/lfx/components/__init__.py (1)
46-46: LGTM! Component module integration is correct.The gigachat module is properly integrated into the dynamic import system with:
- TYPE_CHECKING import for static analysis
- Dynamic import mapping for lazy loading
- Public exposure via
__all__All additions maintain alphabetical order and follow established patterns.
Also applies to: 149-149, 280-280
docs/docs/Components/bundles-gigachat.mdx (1)
1-52: Documentation looks comprehensive and well-structured.The documentation page follows Docusaurus conventions, includes proper front matter, uses correct link patterns, and provides clear descriptions of both text generation and embeddings components with complete parameter tables.
src/lfx/src/lfx/components/gigachat/gigachat_models.py (1)
14-145: Component implementation follows best practices.The GigaChatComponent properly extends LCModelComponent, defines comprehensive inputs with appropriate constraints and defaults, and correctly implements build_model to construct the GigaChat instance with all configured parameters.
src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py (1)
11-103: Embeddings component structure is sound.The component correctly extends LCEmbeddingsModel and implements build_embeddings with proper parameter passing. The input definitions are comprehensive and use appropriate UI components.
src/lfx/src/lfx/components/gigachat/__init__.py (1)
1-34: Lazy import mechanism is well-implemented.The package initializer correctly implements lazy loading for GigaChat components using
__getattr__and__dir__, with proper error handling and TYPE_CHECKING guards. The pattern follows best practices for dynamic imports.src/frontend/src/icons/GigaChat/index.tsx (1)
5-10: Ignore this review comment.The index.tsx file is correctly structured and follows the established codebase pattern for icon exports. Analysis shows:
- Component naming error: The comment references "GigaChatSVG" but the actual SVG component is "GigaChatIcon.jsx"
- isDark prop not implemented: GigaChatIcon.jsx does not currently support an
isDarkprop—it only spreads{...props}and uses hardcoded colors- Pattern matches codebase: Other icon index.tsx files (AIML, AWS, Anthropic) use identical prop-spreading patterns without explicit
isDarkforwarding- No action needed: The current implementation is correct for the present codebase state
The actual work needed is on the SVG component (GigaChatIcon.jsx) to add dark mode support, not on index.tsx.
Likely an incorrect or invalid review comment.
|
@coderabbitai generate docstrings |
✅ Actions performedInitiated docstring generation; will generate only if new commits exist. |
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @krakenalt. * #10464 (comment) The following files were modified: * `src/backend/tests/unit/components/bundles/gigachat/test_gigachat_constants.py` * `src/backend/tests/unit/components/bundles/gigachat/test_gigachat_model_component.py` * `src/lfx/src/lfx/components/gigachat/__init__.py` * `src/lfx/src/lfx/components/gigachat/gigachat_embeddings.py` * `src/lfx/src/lfx/components/gigachat/gigachat_models.py`
…bundle # Conflicts: # src/lfx/src/lfx/_assets/component_index.json
…bundle # Conflicts: # src/lfx/src/lfx/_assets/component_index.json
…bundle # Conflicts: # src/lfx/src/lfx/_assets/component_index.json
…bundle # Conflicts: # src/lfx/src/lfx/_assets/component_index.json
…bundle # Conflicts: # src/lfx/src/lfx/_assets/component_index.json
…bundle # Conflicts: # src/lfx/src/lfx/_assets/component_index.json
…bundle # Conflicts: # pyproject.toml # src/lfx/src/lfx/_assets/component_index.json
…bundle # Conflicts: # src/lfx/src/lfx/_assets/component_index.json
…bundle # Conflicts: # src/lfx/src/lfx/_assets/component_index.json
Fixes: #11349
This pull request adds support for the GigaChat integration. The changes introduce GigaChat model and embedding components, update constants and metadata, add frontend icon support, and provide thorough documentation and tests for the new features.
Backend: GigaChat Component Integration
GigaChatComponentandGigaChatEmbeddingsComponentclasses for model and embedding support, with dynamic imports and full parameterization for API usagelangchain-gigachatto the backend dependencies for model support.Testing
Frontend: Icon and Sidebar Integration
Documentation
Summary by CodeRabbit
Release Notes