Skip to content

feat: Add CometAPI Integration as bundles#9629

Closed
tensornull wants to merge 8 commits into
langflow-ai:mainfrom
cometapi-dev:feat/cometapi
Closed

feat: Add CometAPI Integration as bundles#9629
tensornull wants to merge 8 commits into
langflow-ai:mainfrom
cometapi-dev:feat/cometapi

Conversation

@tensornull
Copy link
Copy Markdown
Contributor

@tensornull tensornull commented Sep 1, 2025

This PR adds support for CometAPI, a unified API platform that provides access to 500+ AI models including GPT, Claude, Gemini, Grok, DeepSeek, and Qwen series models.

What's Changed

  • Add CometAPI model component with OpenAI-compatible API
  • Support combobox interface (dropdown selection + custom model input)
  • Add dynamic model fetching with refresh functionality
  • Include comprehensive model list with latest AI models
  • Add CometAPI icon and documentation

Usage

  1. Get your API key from CometAPI Dashboard
  2. Add CometAPI component to your flow
  3. Configure your API key
  4. Select from 500+ available models or input custom model names

CometAPI provides unified access to the latest AI models through a single API, making it easier to experiment with different model providers.

Summary by CodeRabbit

  • New Features

    • Introduced a CometAPI model component to generate text using CometAPI’s OpenAI-compatible models, with auto model discovery and configurable parameters (API key, model, max tokens, temperature, seed, JSON mode, streaming, advanced kwargs). Outputs can be used by downstream components.
    • Added a CometAPI bundle in the sidebar with a new icon and lazy-loaded assets.
  • Documentation

    • Added a comprehensive page covering setup, supported models, configuration, and example workflows for the CometAPI component.
  • Chores

    • Added support for COMETAPI_API_KEY via environment variable.

tensornull and others added 3 commits September 1, 2025 12:38
- Add CometAPI model component with OpenAI-compatible API
- Support 30+ models including GPT-5, Claude 4.1, Gemini 2.5, Grok 4, DeepSeek v3.1
- Add frontend icons and component registration
- Register COMETAPI_API_KEY environment variable
- Add proper lazy loading and dynamic imports
- Add CometAPI model component with OpenAI-compatible API
- Support for GPT, Claude, Gemini, Grok, DeepSeek, Qwen models
- Add combobox support for model selection (dropdown + custom input)
- Create comprehensive documentation for CometAPI bundle
- Add CometAPI icon and frontend integration
- Fix component validation issues
feat: add CometAPI integration as bundles
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 1, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds a new CometAPI LLM component with lazy import, remote model discovery, and LangChain ChatOpenAI integration; introduces supported model constants and environment variable; updates frontend with a CometAPI bundle and icon; and adds documentation and sidebar entry for the new component.

Changes

Cohort / File(s) Summary of changes
Documentation
docs/docs/Components/bundles-cometapi.mdx, docs/sidebars.js
New CometAPI component docs and sidebar entry under Components/Bundles.
Backend Component (CometAPI)
src/backend/base/langflow/components/cometapi/__init__.py, src/backend/base/langflow/components/cometapi/cometapi.py
Adds lazy-exported CometAPIModelComponent with runtime model fetch, config updates, and ChatOpenAI-based model builder targeting CometAPI base URL.
Backend Constants & Settings
src/backend/base/langflow/base/models/cometapi_constants.py, src/backend/base/langflow/services/settings/constants.py
Introduces COMETAPI_MODELS and MODEL_NAMES constants; adds COMETAPI_API_KEY to environment variables list.
Frontend Icons
src/frontend/src/icons/CometAPI/cometapi.jsx, src/frontend/src/icons/CometAPI/index.tsx, src/frontend/src/icons/lazyIconImports.ts
Adds CometAPI SVG icon, forwardRef wrapper, and lazy icon import mapping.
Frontend Styling/Mapping
src/frontend/src/utils/styleUtils.ts
Adds CometAPI to SIDEBAR_BUNDLES and maps CometAPIModelComponent to the CometAPI display icon.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant FE as Frontend (Langflow UI)
  participant BE as Backend (CometAPI Component)
  participant CA as CometAPI API
  participant LC as LangChain ChatOpenAI

  rect rgb(244,248,253)
    note over FE,BE: Model list discovery (on API key/model field change)
    U->>FE: Open CometAPI component
    FE->>BE: Request model options (api_key)
    BE->>CA: GET /models (Bearer api_key)
    alt Success
      CA-->>BE: 200 JSON (model ids)
      BE-->>FE: Updated model options
    else Error
      BE-->>FE: Fallback to local constants
    end
  end

  rect rgb(245,253,247)
    note over FE,BE: Text generation
    U->>FE: Run flow with prompt/config
    FE->>BE: Build and invoke model
    BE->>LC: Init ChatOpenAI (base_url=CometAPI, api_key, params)
    LC-->>BE: Model ready
    BE->>LC: Invoke(prompt[, stream/json])
    LC-->>BE: Response
    BE-->>FE: Model Response / Language Model output
    FE-->>U: Display output
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

enhancement, documentation, size:XXL, lgtm

Suggested reviewers

  • mfortman11
  • ogabrielluiz
  • edwinjosechittilappilly
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@autofix-ci
Copy link
Copy Markdown
Contributor

autofix-ci Bot commented Sep 1, 2025

Hi! I'm autofix logoautofix.ci, a bot that automatically fixes trivial issues such as code formatting in pull requests.

I would like to apply some automated changes to this pull request, but it looks like I don't have the necessary permissions to do so. To get this pull request into a mergeable state, please do one of the following two things:

  1. Allow edits by maintainers for your pull request, and then re-trigger CI (for example by pushing a new commit).
  2. Manually fix the issues identified for your pull request (see the GitHub Actions output for details on what I would like to change).

Copy link
Copy Markdown
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: 5

🧹 Nitpick comments (14)
src/frontend/src/icons/CometAPI/cometapi.jsx (2)

1-1: Consider TS + explicit props typing

Migrate to TSX with a typed props interface to align with “Use React 18 with TypeScript” guidance.

Example:

-const SvgCometAPI = ({ isDark = false, ...props }) => (
+import type { SVGProps } from "react";
+type Props = SVGProps<SVGSVGElement> & { isDark?: boolean };
+const SvgCometAPI = ({ isDark = false, ...props }: Props) => (

2-9: Minor a11y: add focusable="false" or title

SVGs used decoratively should be focusable={false} (and aria-hidden) or provide a <title>. You already added aria-label above; alternatively mark decorative.

-  <svg
+  <svg
+    focusable="false"
src/backend/base/langflow/base/models/cometapi_constants.py (1)

2-41: Ensure COMETAPI_MODELS is in sync with the live API
Set COMETAPI_API_KEY in your environment and re-run the diff script from the original comment to compare the static COMETAPI_MODELS list against the live /models endpoint—update any stale or missing entries. Continue using this list only as a fallback and consider loading a curated subset while fetching the full list at runtime.

src/backend/base/langflow/components/cometapi/cometapi.py (4)

92-99: Harden JSON parsing against schema variance and keep status informative

Handle responses where models come as an array of strings or objects with “name”.

-            model_list = response.json()
-            return [model["id"] for model in model_list.get("data", [])]
+            payload = response.json()
+            items = payload.get("data", payload)  # accept either {data: [...]} or [...]
+            models: list[str] = []
+            for item in items or []:
+                if isinstance(item, dict):
+                    models.append(item.get("id") or item.get("name") or "")
+                elif isinstance(item, str):
+                    models.append(item)
+            return [m for m in models if m]
         except requests.RequestException as e:
             self.status = f"Error fetching models: {e}"
             return MODEL_NAMES

101-106: Avoid fetching on every keystroke in the combobox

update_build_config fires on model_name value changes; this will call the API repeatedly while the user types. Limit fetches to API key changes and an explicit refresh action.

Can you confirm the event name/value emitted by the refresh_button for DropdownInput? If it’s distinct, gate the fetch on that event; otherwise, at minimum restrict to field_name == "api_key" and debounce refreshes on the frontend.


132-135: Gate JSON mode to models that support response_format

Some non-OpenAI-compatible models may reject response_format. Consider a capability check or allow users to override via model_kwargs without forcing bind.

If CometAPI marks JSON-mode support in /models, use it to conditionally bind. Otherwise, document that json_mode requires models with OpenAI-style JSON responses.


83-127: Optional: switch to httpx and async to avoid blocking

requests blocks the worker thread. If update_build_config is in an async path, prefer httpx.AsyncClient with timeouts and cancellation handling.

I can provide an async httpx variant of get_models and adapt update_build_config if you confirm the execution context.

src/backend/base/langflow/components/cometapi/__init__.py (2)

17-28: Harden lazy import when spec is None (rare, but safe).

Minor defensive fix to avoid edge cases in unusual import contexts.

-        result = import_mod(attr_name, _dynamic_imports[attr_name], __spec__.parent)
+        package = __spec__.parent if __spec__ else __name__
+        result = import_mod(attr_name, _dynamic_imports[attr_name], package)

10-16: Keep _dynamic_imports and all alphabetized.

For consistency with other component packages.

src/frontend/src/icons/CometAPI/index.tsx (1)

5-10: Support dark mode explicitly via isDark and wire through types.

Current wrapper forwards props, but typing doesn’t advertise isDark. Also ensure SvgCometAPI uses isDark to adapt colors.

Type the prop and pass through:

-import type React from "react";
-import { forwardRef } from "react";
-import SvgCometAPI from "./cometapi";
-
-export const CometAPIIcon = forwardRef<
-  SVGSVGElement,
-  React.PropsWithChildren<{}>
->((props, ref) => {
-  return <SvgCometAPI ref={ref} {...props} />;
-});
+import type React from "react";
+import { forwardRef } from "react";
+import SvgCometAPI from "./cometapi";
+
+type Props = React.PropsWithChildren<{ isDark?: boolean }> & React.SVGProps<SVGSVGElement>;
+
+export const CometAPIIcon = forwardRef<SVGSVGElement, Props>((props, ref) => {
+  return <SvgCometAPI ref={ref} {...props} />;
+});

And in src/frontend/src/icons/CometAPI/cometapi.jsx, consume isDark (example):

-const SvgCometAPI = (props) => (
-  <svg ... {...props}>
-    <path fill="#00ACE2" ... />
-    <path fill="#0274C3" ... />
-    <path fill="#FAFDFE" ... />
-    <path fill="#FCFDFE" ... />
-  </svg>
-);
+const SvgCometAPI = ({ isDark = false, ...props }) => {
+  const accent = isDark ? "#00C1FF" : "#00ACE2";
+  const primary = isDark ? "#5BA7F0" : "#0274C3";
+  const light1 = isDark ? "#E7F7FF" : "#FAFDFE";
+  const light2 = isDark ? "#F2FAFF" : "#FCFDFE";
+  return (
+    <svg {...props}>
+      <path fill={accent} ... />
+      <path fill={primary} ... />
+      <path fill={light1} ... />
+      <path fill={light2} ... />
+    </svg>
+  );
+};
docs/docs/Components/bundles-cometapi.mdx (4)

26-28: Micro: tighten controls sentence.

Apply:

-You can toggle parameters through the <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls** in the [component's header menu](/concepts-components#component-menus).
+Toggle parameters from the <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls** in the [Component header menu](/concepts-components#component-menus).

55-56: Call out dynamic fetch requirements.

Mention the need for a valid key and network access.

Apply:

-The component automatically fetches the latest available models from CometAPI when you provide a valid API key.
+The Component automatically fetches the latest available models from CometAPI after you provide a valid API key (requires network access).

66-76: Header case and UI naming consistency.

Apply:

-### Example Usage
+### Example usage
@@
-5. Test your flow in the Playground
+5. Test your Flow in the **Playground**.

44-55: Docs: Make CometAPI model list illustrative and fix header case

Use sentence-case header; format model IDs as inline code and add a runtime-availability tip. Backend constants are at src/backend/base/langflow/base/models/cometapi_constants.py (COMETAPI_MODELS / MODEL_NAMES) and referenced by src/backend/base/langflow/components/cometapi/cometapi.py — several IDs include date suffixes, so keep the docs illustrative (examples), not authoritative.

-### Supported Models
+### Supported models
@@
-CometAPI provides access to a wide range of state-of-the-art language models including:
+CometAPI provides access to many state‑of‑the‑art language models. Examples include:
@@
-- **GPT Series**: gpt-5-chat-latest, chatgpt-4o-latest, gpt-4o-mini, and more
-- **Claude Series**: claude-opus-4-1, claude-sonnet-4, claude-3-5-haiku-latest, and more
-- **Gemini Series**: gemini-2.5-pro, gemini-2.5-flash, gemini-2.0-flash
-- **Grok Series**: grok-4-0709, grok-3, grok-3-mini
-- **DeepSeek Series**: deepseek-v3.1, deepseek-chat, deepseek-reasoner
-- **Qwen Series**: qwen3-30b-a3b, qwen3-coder-plus
+- **GPT series**: `gpt-5-chat-latest`, `chatgpt-4o-latest`, `gpt-4o-mini`
+- **Claude series**: `claude-opus-4-1`, `claude-sonnet-4`, `claude-3-5-haiku-latest`
+- **Gemini series**: `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.0-flash`
+- **Grok series**: `grok-4-0709`, `grok-3`, `grok-3-mini`
+- **DeepSeek series**: `deepseek-v3.1`, `deepseek-chat`, `deepseek-reasoner`
+- **Qwen series**: `qwen3-30b-a3b`, `qwen3-coder-plus`

Add a note:

+:::tip
+Actual availability and model IDs vary. The Component fetches the latest list from CometAPI at run time.
+:::
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2d5c559 and f515d34.

⛔ Files ignored due to path filters (1)
  • src/frontend/src/icons/CometAPI/cometapi.svg is excluded by !**/*.svg
📒 Files selected for processing (10)
  • docs/docs/Components/bundles-cometapi.mdx (1 hunks)
  • docs/sidebars.js (1 hunks)
  • src/backend/base/langflow/base/models/cometapi_constants.py (1 hunks)
  • src/backend/base/langflow/components/cometapi/__init__.py (1 hunks)
  • src/backend/base/langflow/components/cometapi/cometapi.py (1 hunks)
  • src/backend/base/langflow/services/settings/constants.py (1 hunks)
  • src/frontend/src/icons/CometAPI/cometapi.jsx (1 hunks)
  • src/frontend/src/icons/CometAPI/index.tsx (1 hunks)
  • src/frontend/src/icons/lazyIconImports.ts (1 hunks)
  • src/frontend/src/utils/styleUtils.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (12)
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/lazyIconImports.ts
  • src/frontend/src/utils/styleUtils.ts
  • src/frontend/src/icons/CometAPI/index.tsx
  • src/frontend/src/icons/CometAPI/cometapi.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/lazyIconImports.ts
  • src/frontend/src/icons/CometAPI/index.tsx
  • src/frontend/src/icons/CometAPI/cometapi.jsx
src/frontend/src/icons/lazyIconImports.ts

📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)

Add your icon to the lazyIconsMapping object in src/frontend/src/icons/lazyIconImports.ts with a key that matches the backend icon string exactly.

Files:

  • src/frontend/src/icons/lazyIconImports.ts
docs/sidebars.js

📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)

Sidebar navigation must be updated in docs/sidebars.js to reflect new or reorganized documentation content.

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
docs/docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)

docs/docs/**/*.{md,mdx}: All documentation content must be written in Markdown or MDX files located under docs/docs/, following the prescribed directory structure for guides, reference, how-to, concepts, and API documentation.
All documentation Markdown and MDX files must begin with a frontmatter block including at least title and description fields.
Use admonitions (:::tip, :::warning, :::danger) in Markdown/MDX files to highlight important information, warnings, or critical issues.
All images referenced in documentation must include descriptive alt text for accessibility.
All code examples included in documentation must be tested and verified to work as shown.
Internal links in documentation must be functional and not broken.
Content must follow the style guide: professional but approachable tone, second person voice, present tense, short paragraphs, sentence case headers, inline code with backticks, bold for UI elements, italic for emphasis, and parallel structure in lists.
Use consistent terminology: always capitalize Langflow, Component, Flow, and uppercase API and JSON.

Files:

  • docs/docs/Components/bundles-cometapi.mdx
src/backend/base/langflow/components/**/*.py

📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)

src/backend/base/langflow/components/**/*.py: Add new backend components to the appropriate subdirectory under src/backend/base/langflow/components/
Implement async component methods using async def and await for asynchronous operations
Use asyncio.create_task for background work in async components and ensure proper cleanup on cancellation
Use asyncio.Queue for non-blocking queue operations in async components and handle timeouts appropriately

Files:

  • src/backend/base/langflow/components/cometapi/__init__.py
  • src/backend/base/langflow/components/cometapi/cometapi.py
src/backend/base/langflow/components/**/__init__.py

📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)

Update init.py with alphabetical imports when adding new components

Files:

  • src/backend/base/langflow/components/cometapi/__init__.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/base/langflow/components/cometapi/__init__.py
  • src/backend/base/langflow/services/settings/constants.py
  • src/backend/base/langflow/base/models/cometapi_constants.py
  • src/backend/base/langflow/components/cometapi/cometapi.py
src/backend/**/components/**/*.py

📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)

In your Python component class, set the icon attribute to a string matching the frontend icon mapping exactly (case-sensitive).

Files:

  • src/backend/base/langflow/components/cometapi/__init__.py
  • src/backend/base/langflow/components/cometapi/cometapi.py
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 the isDark prop to support both light and dark mode.

Files:

  • src/frontend/src/icons/CometAPI/index.tsx
  • src/frontend/src/icons/CometAPI/cometapi.jsx
src/frontend/src/icons/*/index.tsx

📄 CodeRabbit inference engine (.cursor/rules/icons.mdc)

Create an index.tsx in your icon directory that exports your icon using forwardRef and passes the isDark prop.

Files:

  • src/frontend/src/icons/CometAPI/index.tsx
🧠 Learnings (8)
📚 Learning: 2025-07-28T15:56:47.865Z
Learnt from: CR
PR: langflow-ai/langflow#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/lazyIconImports.ts
📚 Learning: 2025-07-18T18:26:42.027Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-07-18T18:26:42.027Z
Learning: Applies to docs/sidebars.js : Sidebar navigation must be updated in docs/sidebars.js to reflect new or reorganized documentation content.

Applied to files:

  • docs/sidebars.js
📚 Learning: 2025-07-18T18:25:54.486Z
Learnt from: CR
PR: langflow-ai/langflow#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/backend/base/langflow/components/cometapi/__init__.py
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
PR: langflow-ai/langflow#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/CometAPI/index.tsx
📚 Learning: 2025-07-28T15:56:47.865Z
Learnt from: CR
PR: langflow-ai/langflow#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/CometAPI/index.tsx
📚 Learning: 2025-06-16T11:14:04.200Z
Learnt from: dolfim-ibm
PR: langflow-ai/langflow#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/CometAPI/index.tsx
📚 Learning: 2025-07-18T18:27:12.609Z
Learnt from: CR
PR: langflow-ai/langflow#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/CometAPI/index.tsx
📚 Learning: 2025-07-28T15:56:47.865Z
Learnt from: CR
PR: langflow-ai/langflow#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/CometAPI/index.tsx
  • src/frontend/src/icons/CometAPI/cometapi.jsx
🧬 Code graph analysis (3)
src/backend/base/langflow/components/cometapi/__init__.py (2)
src/backend/base/langflow/components/_importing.py (1)
  • import_mod (8-37)
src/backend/base/langflow/components/cometapi/cometapi.py (1)
  • CometAPIModelComponent (21-135)
src/backend/base/langflow/components/cometapi/cometapi.py (2)
src/backend/base/langflow/base/models/model.py (1)
  • LCModelComponent (25-375)
src/backend/base/langflow/inputs/inputs.py (7)
  • BoolInput (413-425)
  • DictInput (449-464)
  • DropdownInput (467-491)
  • IntInput (343-375)
  • SecretStrInput (285-340)
  • SliderInput (643-644)
  • HandleInput (76-87)
src/frontend/src/icons/CometAPI/index.tsx (1)
src/frontend/src/icons/CometAPI/cometapi.jsx (1)
  • SvgCometAPI (1-27)
🪛 LanguageTool
docs/docs/Components/bundles-cometapi.mdx

[grammar] ~48-~48: There might be a mistake here.
Context: ...chatgpt-4o-latest, gpt-4o-mini, and more - Claude Series: claude-opus-4-1, claude...

(QB_NEW_EN)


[grammar] ~49-~49: There might be a mistake here.
Context: ...net-4, claude-3-5-haiku-latest, and more - Gemini Series: gemini-2.5-pro, gemini-...

(QB_NEW_EN)


[grammar] ~50-~50: There might be a mistake here.
Context: ...-pro, gemini-2.5-flash, gemini-2.0-flash - Grok Series: grok-4-0709, grok-3, grok...

(QB_NEW_EN)


[grammar] ~51-~51: There might be a mistake here.
Context: ...ries**: grok-4-0709, grok-3, grok-3-mini - DeepSeek Series: deepseek-v3.1, deepse...

(QB_NEW_EN)


[grammar] ~52-~52: There might be a mistake here.
Context: ...k-v3.1, deepseek-chat, deepseek-reasoner - Qwen Series: qwen3-30b-a3b, qwen3-code...

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (52)
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 38/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 39/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 40/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 37/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 34/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 33/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 28/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 31/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 30/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 29/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 26/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 25/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 27/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 35/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 32/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 36/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 24/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 23/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 21/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 22/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 19/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 17/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 18/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 20/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 15/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 16/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 13/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 10/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 6/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 14/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 9/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 12/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 7/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 3/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 11/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 8/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 5/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 2/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 4/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 1/40
  • GitHub Check: Test Docs Build / Test Docs Build
  • GitHub Check: Lint Backend / Run Mypy (3.13)
  • GitHub Check: Run Frontend Unit Tests / Frontend Jest Unit Tests
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
  • GitHub Check: Run Backend Tests / Integration Tests - Python 3.10
  • GitHub Check: Test Starter Templates
  • GitHub Check: Update Starter Projects
  • GitHub Check: Optimize new Python code in this PR
🔇 Additional comments (10)
src/backend/base/langflow/services/settings/constants.py (1)

31-31: LGTM: add COMETAPI_API_KEY to env allowlist

Matches SecretStrInput default in the new component and enables real-time env loading.

src/backend/base/langflow/components/cometapi/cometapi.py (1)

1-1: No action needed: ‘requests’ is already included in backend dependencies

docs/sidebars.js (1)

301-302: Verified: both bundles-cometapi.mdx and bundles-cohere.mdx exist and match sidebar references.

src/frontend/src/icons/lazyIconImports.ts (1)

56-57: LGTM — icon key matches backend icon string ("CometAPI").

This aligns with CometAPIModelComponent.icon.

src/frontend/src/utils/styleUtils.ts (2)

261-262: LGTM — CometAPI bundle added to sidebar.

Placement next to other “C*” bundles keeps ordering coherent.


423-424: LGTM — Node-to-icon map includes CometAPIModelComponent.

Matches backend class name and icon.

docs/docs/Components/bundles-cometapi.mdx (4)

31-36: The search will run; I’ll update once we know how max_tokens is handled.


8-13: Verify the internal link and tighten the intro.

  • Use second-person voice and consistent capitalization. Apply:
-[Bundles](/components-bundle-components) contain custom components that support specific third-party integrations with Langflow.
+[Bundles](/components-bundle-components) contain custom Components that integrate third-party services with Langflow.

-This page describes the components that are available in the **CometAPI** bundle.
+This page describes the Components available in the **CometAPI** bundle.

-For more information about CometAPI features and functionality used by CometAPI components, see the [CometAPI documentation](https://www.cometapi.com/).
+For more information about CometAPI features used by these Components, see the [CometAPI documentation](https://www.cometapi.com/).
  • Verify that the /components-bundle-components page exists (or update the slug to the correct path).

29-43: Standardize parameter table formatting and verify backend behavior

  • Wrap types and literals in backticks, use “ID” (not “id”), and normalize boolean defaults to false.
  • Confirm that max_tokens = 0 truly disables the token limit and that json_mode forces JSON output in the CometAPI backend.

16-23: Ignore anchor-id change
The suggestion to update the link to /data-types#language-model is incorrect—retain /data-types#languagemodel to match the ## LanguageModel heading.

Likely an incorrect or invalid review comment.

Comment thread docs/docs/Components/bundles-cometapi.mdx
Comment thread docs/docs/Components/bundles-cometapi.mdx
Comment thread src/backend/base/langflow/components/cometapi/cometapi.py
Comment thread src/backend/base/langflow/components/cometapi/cometapi.py
Comment thread src/frontend/src/icons/CometAPI/cometapi.jsx Outdated
tensornull and others added 5 commits September 1, 2025 16:33
- Improve error handling with specific exception types
- Add proper logging for better debugging
- Extract constants for API URL and timeout
- Add type annotations and docstrings
- Fix code structure issues identified by ruff
- Remove trailing whitespace
refactor: optimize CometAPI code based on AI review feedback
- Add noqa comment to suppress TRY300 rule conflict
- Fix code structure for better readability
- Ensure all linting checks pass
fix: resolve TRY300 linting issue in CometAPI component
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Sep 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
13.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@tensornull tensornull changed the title Add CometAPI Integration as bundles feat: Add CometAPI Integration as bundles Sep 6, 2025
@github-actions github-actions Bot added the enhancement New feature or request label Sep 6, 2025
@tensornull tensornull closed this Sep 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant