Skip to content

feat: add sessions endpoint with session management enhancements#8596

Merged
Cristhianzl merged 17 commits into
mainfrom
cz/message-playground
Jun 23, 2025
Merged

feat: add sessions endpoint with session management enhancements#8596
Cristhianzl merged 17 commits into
mainfrom
cz/message-playground

Conversation

@Cristhianzl
Copy link
Copy Markdown
Member

@Cristhianzl Cristhianzl commented Jun 17, 2025

This pull request introduces several backend and frontend changes to enhance session management and improve API functionality. Key updates include the addition of a new /sessions endpoint, encoding improvements for session IDs, and frontend adjustments to support session-related operations. Below is a categorized list of the most important changes:

Backend Enhancements:

  • New /sessions Endpoint: Added a new endpoint in src/backend/base/langflow/api/v1/monitor.py to retrieve distinct session IDs, optionally filtered by flow_id. This improves session management capabilities.
  • Session ID Decoding: Updated get_messages in src/backend/base/langflow/api/v1/monitor.py to decode session_id using urllib.parse.unquote, ensuring proper handling of encoded session IDs.
  • Unit Tests for /sessions Endpoint: Added comprehensive tests in src/backend/tests/unit/test_session_endpoint.py to validate the /sessions endpoint, including scenarios for filtering by flow_id, handling empty databases, and invalid flow_id formats.

Frontend Enhancements:

  • Session API Integration: Added a new constant SESSIONS in src/frontend/src/controllers/API/helpers/constants.ts to represent the /sessions endpoint.
  • Invalidate Sessions Query: Updated useDeleteMessages in src/frontend/src/controllers/API/queries/messages/use-delete-messages.ts to invalidate the sessions query after message deletion, ensuring the session list stays up-to-date.
  • Session Selector Updates: Enhanced SessionSelector in src/frontend/src/modals/IOModal/components/IOFieldView/components/session-selector.tsx to handle session trimming and integrate with playground-specific session management. [1] [2]

API Improvements:

  • Session ID Encoding: Refactored multiple API queries (use-get-messages, use-get-messages-polling, and use-get-messages-mutation) to ensure proper encoding of session_id using prepareSessionIdForAPI. [1] [2] [3]
  • New Query for Sessions: Introduced useGetSessionsFromFlowQuery in src/frontend/src/controllers/API/queries/messages/use-get-sessions-from-flow.ts to fetch sessions associated with a specific flow_id.

These changes collectively improve the system's handling of sessions, streamline API interactions, and enhance the user experience on the frontend.

Summary by CodeRabbit

  • New Features

    • Added a backend API endpoint to retrieve session IDs, with optional filtering by flow.
    • Introduced a frontend hook to fetch sessions associated with a flow, supporting both backend and playground modes.
    • Enhanced session management in the playground modal, with improved session visibility and message filtering.
    • Added utilities for consistent encoding, decoding, and validation of session IDs.
    • Added a "new chat" state to the playground for better session initialization.
  • Bug Fixes

    • Ensured session IDs are properly encoded/decoded in API requests and responses.
    • Trimmed whitespace from session IDs during renaming for consistency.
  • Tests

    • Added comprehensive tests for the new sessions API endpoint, covering filtering, empty states, and error handling.
  • Chores

    • Updated test discovery paths in the backend configuration.

…coding for API requests

📝 (use-get-messages-mutation.ts): Implement a mutation function to fetch messages with query parameters and handle session_id encoding for API requests
📝 (use-get-messages-polling.ts): Ensure proper encoding of session_id for API requests in polling mutation
📝 (use-get-messages.ts): Handle session_id encoding for API requests in messages query
📝 (new-modal.tsx): Implement functions to handle session deletion and proper encoding of session_id for API requests
📝 (utils.ts): Add functions to encode, decode, validate, format, and prepare session IDs for API requests
…ssions

🔧 (use-delete-messages.ts): Add queryClient to UseRequestProcessor to invalidate sessions query
✨ (use-get-sessions-from-flow.ts): Introduce useGetSessionsFromFlowQuery to fetch sessions from flow
🔧 (use-rename-session.ts): Change refetchQueries to invalidateQueries for useGetSessionsFromFlowQuery
🔧 (custom-new-modal.tsx): Update import path for IOModal to playground-modal
🔧 (session-selector.tsx): Add setActiveSession function to handle setting active session
🔧 (sidebar-open-view.tsx): Add setActiveSession function to handle setting active session
♻️ (new-modal.tsx): Refactor IOModal into playground-modal and update functionality
♻️ (playground-modal.tsx): Refactor IOModal to handle playground-specific functionality
⬆️ (flowStore.ts): Add newChatOnPlayground state and setNewChatOnPlayground function
⬆️ (index.ts): Update FlowStoreType to include newChatOnPlayground and setNewChatOnPlayground
…y for tests

✨ (test_session_endpoint.py): add unit tests for sessions endpoint with flow_id filtering
♻️ (session-selector.tsx): refactor to trim editedSession before setting it
♻️ (sidebar-open-view.tsx): refactor to set visibleSession instead of activeSession
…default session if it's not already present

♻️ (playground-modal.tsx): Refactor setting sessions to include currentFlowId as the default session if not present, and handle visibility of sessions more efficiently
@Cristhianzl Cristhianzl self-assigned this Jun 17, 2025
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Jun 17, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 17, 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

The changes introduce comprehensive session management improvements across both backend and frontend. A new /sessions API endpoint is added, with corresponding tests. The frontend now fetches sessions from the backend, enhances session ID handling with new utilities, and updates state management for session and chat flows. Several React components and hooks are updated to support these features.

Changes

File(s) Change Summary
pyproject.toml Updated pytest testpaths to ["src/backend/tests"].
src/backend/base/langflow/api/v1/monitor.py Added /sessions endpoint to fetch session IDs (with optional flow_id filter). Modified /messages endpoint to decode URL-encoded session_id before filtering.
src/backend/tests/unit/test_session_endpoint.py New test module for /sessions endpoint, covering scenarios for filtering, empty state, and invalid input.
src/frontend/src/controllers/API/helpers/constants.ts Added SESSIONS constant to URLs object.
src/frontend/src/controllers/API/queries/messages/use-delete-messages.ts Enhanced mutation to invalidate ["useGetSessionsFromFlowQuery"] on settlement, ensuring session data refetch.
src/frontend/src/controllers/API/queries/messages/use-get-messages-polling.ts
src/frontend/src/controllers/API/queries/messages/use-get-messages.ts
Added import and usage of prepareSessionIdForAPI to preprocess/encode session_id in API request parameters.
src/frontend/src/controllers/API/queries/messages/use-get-sessions-from-flow.ts Added new hook useGetSessionsFromFlowQuery to fetch sessions for a flow, supporting both backend and playground modes.
src/frontend/src/controllers/API/queries/messages/use-rename-session.ts Changed mutation to invalidate "useGetSessionsFromFlowQuery" instead of refetching messages after renaming a session.
src/frontend/src/customization/components/custom-new-modal.tsx Changed import of IOModal to use playground-modal variant.
src/frontend/src/modals/IOModal/components/IOFieldView/components/session-selector.tsx Added setActiveSession prop and trimmed session ID on rename confirmation.
src/frontend/src/modals/IOModal/components/sidebar-open-view.tsx Added setActiveSession prop and used setNewChatOnPlayground from store when starting new chat.
src/frontend/src/modals/IOModal/playground-modal.tsx Refactored to use backend session fetching, improved session visibility logic, session-aware message queries, and new chat state handling. Added setActiveSession function.
src/frontend/src/modals/IOModal/types/sidebar-open-view.ts Added setActiveSession function property to SidebarOpenViewProps type.
src/frontend/src/stores/flowStore.ts
src/frontend/src/types/zustand/flow/index.ts
Added newChatOnPlayground boolean state and setNewChatOnPlayground setter to flow store and its type.
src/frontend/src/utils/utils.ts Added utilities for encoding/decoding, validating, formatting, and preparing session IDs for API usage.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend

    User->>Frontend: Selects Flow or Session
    Frontend->>Backend: GET /sessions?flow_id={flow_id}
    Backend-->>Frontend: [session_id_1, session_id_2, ...]
    Frontend->>Backend: GET /messages?flow_id={flow_id}&session_id={encoded_session_id}
    Backend-->>Frontend: [messages...]
    User->>Frontend: Deletes a session or message
    Frontend->>Backend: DELETE /messages
    Backend-->>Frontend: Success
    Frontend->>Backend: (on settled) Invalidate /sessions query
    Backend-->>Frontend: Updated sessions list
Loading

Suggested labels

size:M, lgtm

Suggested reviewers

  • Cristhianzl
  • ogabrielluiz
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch cz/message-playground

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.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

Documentation and Community

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

@dosubot dosubot Bot added the enhancement New feature or request label Jun 17, 2025
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 17, 2025
… code for better readability and maintainability
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 17, 2025
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

🔭 Outside diff range comments (2)
src/frontend/src/modals/IOModal/components/IOFieldView/components/session-selector.tsx (2)

29-41: setActiveSession is declared but never used inside the component

A new callback prop is threaded into the component signature, yet no logic invokes it.
Either wire it into the click / rename flows (e.g., when the user picks or renames a session) or remove the prop to avoid dead code and misleading API.

@@
-  const handleConfirm = () => {
+  const handleConfirm = () => {
@@
       updateSessionName(
@@
           onSuccess: () => {
+            // keep global active-session state in sync
+            setActiveSession(editedSession.trim());

68-88: Renaming allows empty / blank session IDs

editedSession.trim() can be an empty string which then propagates to the backend and the UI.
Add a guard to prevent empty names and give the user feedback.

   if (editedSession.trim() !== session) {
+    if (!editedSession.trim()) {
+      // early exit or toast error
+      return;
+    }
🧹 Nitpick comments (12)
src/frontend/src/utils/utils.ts (2)

938-955: Date-time session regexp is too restrictive

/^Session\s+\w{3}\s+\d{1,2},\s+\d{2}:\d{2}:\d{2}$/ fails for:

  • months with full names (“September”)
  • AM/PM suffixes
  • localisation differences (“Jun 16 2025” vs “Jun 16, 2025”)

Unless the backend guarantees this exact formatting, prefer a broader parse or reuse a date-library
parse/format routine to avoid false negatives.


905-916: Minor: avoid double-encoding by documenting usage

prepareSessionIdForAPI() already encodes; a careless caller might encode twice by
calling encodeSessionId first. Add a JSDoc example or mark encodeSessionId as internal to reduce misuse.

src/frontend/src/stores/flowStore.ts (1)

1064-1067: Flag-reset responsibility is unclear

newChatOnPlayground is written but never reset inside the store itself.
If downstream components forget to toggle it back to false, session refetching could be triggered only once (or, conversely, on every render depending on the consumer logic).

Consider either:

  1. Resetting the flag to false inside the same setter after external side-effects occur, or
  2. Providing a dedicated resetNewChatOnPlayground() helper to make the lifecycle explicit.
src/frontend/src/controllers/API/queries/messages/use-delete-messages.ts (1)

30-39: Nice: preserves caller’s onSettled, but generic typing feels off

Good job forwarding options?.onSettled.
Minor: UseMutationResult<DeleteMessagesParams, …> sets the data type to DeleteMessagesParams, while the mutation returns undefined. Consider changing the first generic argument to undefined (or the actual response shape) to keep type-safety tight.

-const mutation: UseMutationResult<
-  DeleteMessagesParams,
+const mutation: UseMutationResult<
+  undefined,
src/frontend/src/modals/IOModal/components/IOFieldView/components/session-selector.tsx (1)

51-53: setNewChatOnPlayground is imported but never referenced

This unused selector will be tree-shaken in prod builds but still fails the linter in dev.
Remove the destructuring or incorporate the flag where intended.

-  const setNewChatOnPlayground = useFlowStore(
-    (state) => state.setNewChatOnPlayground,
-  );
+  // Uncomment when actually needed, otherwise drop:
+  // const setNewChatOnPlayground = useFlowStore(
+  //   (state) => state.setNewChatOnPlayground,
+  // );
src/frontend/src/controllers/API/queries/messages/use-get-messages.ts (1)

39-47: Param processing uses any – tighten typing & avoid in-place mutation

Using any defeats type-safety and mutating processedParams in-place risks accidental side-effects if the original object is reused elsewhere.
Clone with a typed interface instead.

-      const processedParams = { ...params } as any;
+      interface ProcessedParams extends Record<string, unknown> {
+        session_id?: string;
+      }
+      const processedParams: ProcessedParams = { ...params };
src/backend/base/langflow/api/v1/monitor.py (1)

51-54: Trailing-whitespace flagged by Ruff

Two blank lines contain stray spaces causing the CI failure (W293).
Delete the whitespace.

-        
-
+
src/frontend/src/controllers/API/queries/messages/use-get-sessions-from-flow.ts (2)

22-49: id can be undefined – accessing sessionStorage.getItem(id ?? "") creates a “default” key

When id is undefined in playground mode you silently read / write under the empty-string key, which couples unrelated flows.
Consider early-returning or throwing when id is missing.

-    if (isPlaygroundPage) {
+    if (isPlaygroundPage) {
+      if (!id) return { data: [] };

51-56: Wrap backend errors to surface useful feedback

getSessionsFn doesn’t catch/propagate API errors; callers receive promise rejections without context.
Wrap the request in a try/catch and re-throw a more descriptive error or use React-Query’s retry/onError.

src/backend/tests/unit/test_session_endpoint.py (3)

17-64: Clean up formatting issues.

This section has multiple trailing whitespace and blank line issues that should be cleaned up for consistency.

Apply this diff to fix the formatting:

         flow_id_1 = uuid4()
         flow_id_2 = uuid4()
-        
+
         # Create MessageTable objects directly since MessageCreate doesn't have flow_id field
         messagetables = [
             MessageTable(
-                text="Message 1", 
-                sender="User", 
-                sender_name="User", 
-                session_id="session_A", 
+                text="Message 1",
+                sender="User",
+                sender_name="User",
+                session_id="session_A",
                 flow_id=flow_id_1
             ),
             MessageTable(
-                text="Message 2", 
-                sender="AI", 
-                sender_name="AI", 
-                session_id="session_A", 
+                text="Message 2",
+                sender="AI",
+                sender_name="AI",
+                session_id="session_A",
                 flow_id=flow_id_1
             ),
             MessageTable(
-                text="Message 3", 
-                sender="User", 
-                sender_name="User", 
-                session_id="session_B", 
+                text="Message 3",
+                sender="User",
+                sender_name="User",
+                session_id="session_B",
                 flow_id=flow_id_1
             ),
             MessageTable(
-                text="Message 4", 
-                sender="User", 
-                sender_name="User", 
-                session_id="session_C", 
+                text="Message 4",
+                sender="User",
+                sender_name="User",
+                session_id="session_C",
                 flow_id=flow_id_2
             ),
             MessageTable(
-                text="Message 5", 
-                sender="AI", 
-                sender_name="AI", 
-                session_id="session_D", 
+                text="Message 5",
+                sender="AI",
+                sender_name="AI",
+                session_id="session_D",
                 flow_id=flow_id_2
             ),
             MessageTable(
-                text="Message 6", 
-                sender="User", 
-                sender_name="User", 
-                session_id="session_E", 
+                text="Message 6",
+                sender="User",
+                sender_name="User",
+                session_id="session_E",
                 flow_id=None  # No flow_id
             ),
         ]
         created_messages = await aadd_messagetables(messagetables, _session)
-        
+
         return {

116-116: Consider shortening the function name.

The function name exceeds the 120-character line limit.

Apply this diff to use a shorter but still descriptive name:

-async def test_get_sessions_with_different_flow_id_filter(client: AsyncClient, logged_in_headers, messages_with_flow_ids):
+async def test_get_sessions_with_another_flow_id(client: AsyncClient, logged_in_headers, messages_with_flow_ids):

99-102: Fix formatting in HTTP request parameters.

Clean up trailing whitespace in the client.get calls.

Apply this diff to fix the formatting:

     response = await client.get(
-        "api/v1/monitor/sessions", 
-        params={"flow_id": str(flow_id_1)}, 
+        "api/v1/monitor/sessions",
+        params={"flow_id": str(flow_id_1)},
         headers=logged_in_headers
     )

And similar changes for lines 121-124, 143-146, and 169-172.

Also applies to: 121-124, 143-146, 169-172

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1fcb500 and 041df22.

📒 Files selected for processing (17)
  • pyproject.toml (1 hunks)
  • src/backend/base/langflow/api/v1/monitor.py (2 hunks)
  • src/backend/tests/unit/test_session_endpoint.py (1 hunks)
  • src/frontend/src/controllers/API/helpers/constants.ts (1 hunks)
  • src/frontend/src/controllers/API/queries/messages/use-delete-messages.ts (2 hunks)
  • src/frontend/src/controllers/API/queries/messages/use-get-messages-polling.ts (2 hunks)
  • src/frontend/src/controllers/API/queries/messages/use-get-messages.ts (2 hunks)
  • src/frontend/src/controllers/API/queries/messages/use-get-sessions-from-flow.ts (1 hunks)
  • src/frontend/src/controllers/API/queries/messages/use-rename-session.ts (1 hunks)
  • src/frontend/src/customization/components/custom-new-modal.tsx (1 hunks)
  • src/frontend/src/modals/IOModal/components/IOFieldView/components/session-selector.tsx (4 hunks)
  • src/frontend/src/modals/IOModal/components/sidebar-open-view.tsx (4 hunks)
  • src/frontend/src/modals/IOModal/playground-modal.tsx (10 hunks)
  • src/frontend/src/modals/IOModal/types/sidebar-open-view.ts (1 hunks)
  • src/frontend/src/stores/flowStore.ts (1 hunks)
  • src/frontend/src/types/zustand/flow/index.ts (1 hunks)
  • src/frontend/src/utils/utils.ts (1 hunks)
🧰 Additional context used
🪛 Ruff (0.11.9)
src/backend/base/langflow/api/v1/monitor.py

51-51: Blank line contains whitespace

Remove whitespace from blank line

(W293)


54-54: Blank line contains whitespace

Remove whitespace from blank line

(W293)

src/backend/tests/unit/test_session_endpoint.py

6-6: langflow.services.database.models.message.MessageCreate imported but unused

Remove unused import: langflow.services.database.models.message.MessageCreate

(F401)


17-17: Blank line contains whitespace

Remove whitespace from blank line

(W293)


21-21: Trailing whitespace

Remove trailing whitespace

(W291)


22-22: Trailing whitespace

Remove trailing whitespace

(W291)


23-23: Trailing whitespace

Remove trailing whitespace

(W291)


24-24: Trailing whitespace

Remove trailing whitespace

(W291)


28-28: Trailing whitespace

Remove trailing whitespace

(W291)


29-29: Trailing whitespace

Remove trailing whitespace

(W291)


30-30: Trailing whitespace

Remove trailing whitespace

(W291)


31-31: Trailing whitespace

Remove trailing whitespace

(W291)


35-35: Trailing whitespace

Remove trailing whitespace

(W291)


36-36: Trailing whitespace

Remove trailing whitespace

(W291)


37-37: Trailing whitespace

Remove trailing whitespace

(W291)


38-38: Trailing whitespace

Remove trailing whitespace

(W291)


42-42: Trailing whitespace

Remove trailing whitespace

(W291)


43-43: Trailing whitespace

Remove trailing whitespace

(W291)


44-44: Trailing whitespace

Remove trailing whitespace

(W291)


45-45: Trailing whitespace

Remove trailing whitespace

(W291)


49-49: Trailing whitespace

Remove trailing whitespace

(W291)


50-50: Trailing whitespace

Remove trailing whitespace

(W291)


51-51: Trailing whitespace

Remove trailing whitespace

(W291)


52-52: Trailing whitespace

Remove trailing whitespace

(W291)


56-56: Trailing whitespace

Remove trailing whitespace

(W291)


57-57: Trailing whitespace

Remove trailing whitespace

(W291)


58-58: Trailing whitespace

Remove trailing whitespace

(W291)


59-59: Trailing whitespace

Remove trailing whitespace

(W291)


64-64: Blank line contains whitespace

Remove whitespace from blank line

(W293)


80-80: Blank line contains whitespace

Remove whitespace from blank line

(W293)


84-84: Blank line contains whitespace

Remove whitespace from blank line

(W293)


88-88: Blank line contains whitespace

Remove whitespace from blank line

(W293)


97-97: Blank line contains whitespace

Remove whitespace from blank line

(W293)


99-99: Trailing whitespace

Remove trailing whitespace

(W291)


100-100: Trailing whitespace

Remove trailing whitespace

(W291)


103-103: Blank line contains whitespace

Remove whitespace from blank line

(W293)


107-107: Blank line contains whitespace

Remove whitespace from blank line

(W293)


110-110: Blank line contains whitespace

Remove whitespace from blank line

(W293)


116-116: Line too long (122 > 120)

(E501)


119-119: Blank line contains whitespace

Remove whitespace from blank line

(W293)


121-121: Trailing whitespace

Remove trailing whitespace

(W291)


122-122: Trailing whitespace

Remove trailing whitespace

(W291)


125-125: Blank line contains whitespace

Remove whitespace from blank line

(W293)


129-129: Blank line contains whitespace

Remove whitespace from blank line

(W293)


132-132: Blank line contains whitespace

Remove whitespace from blank line

(W293)


138-138: Unused function argument: messages_with_flow_ids

(ARG001)


141-141: Blank line contains whitespace

Remove whitespace from blank line

(W293)


143-143: Trailing whitespace

Remove trailing whitespace

(W291)


144-144: Trailing whitespace

Remove trailing whitespace

(W291)


147-147: Blank line contains whitespace

Remove whitespace from blank line

(W293)


158-158: Blank line contains whitespace

Remove whitespace from blank line

(W293)


166-166: Unused function argument: messages_with_flow_ids

(ARG001)


169-169: Trailing whitespace

Remove trailing whitespace

(W291)


170-170: Trailing whitespace

Remove trailing whitespace

(W291)


173-173: Blank line contains whitespace

Remove whitespace from blank line

(W293)

🪛 GitHub Check: Ruff Style Check (3.13)
src/backend/base/langflow/api/v1/monitor.py

[failure] 54-54: Ruff (W293)
src/backend/base/langflow/api/v1/monitor.py:54:1: W293 Blank line contains whitespace


[failure] 51-51: Ruff (W293)
src/backend/base/langflow/api/v1/monitor.py:51:1: W293 Blank line contains whitespace

src/backend/tests/unit/test_session_endpoint.py

[failure] 29-29: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:29:29: W291 Trailing whitespace


[failure] 28-28: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:28:34: W291 Trailing whitespace


[failure] 24-24: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:24:40: W291 Trailing whitespace


[failure] 23-23: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:23:36: W291 Trailing whitespace


[failure] 22-22: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:22:31: W291 Trailing whitespace


[failure] 21-21: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:21:34: W291 Trailing whitespace


[failure] 17-17: Ruff (W293)
src/backend/tests/unit/test_session_endpoint.py:17:1: W293 Blank line contains whitespace


[failure] 6-6: Ruff (F401)
src/backend/tests/unit/test_session_endpoint.py:6:55: F401 langflow.services.database.models.message.MessageCreate imported but unused

🪛 GitHub Actions: Ruff Style Check
src/backend/base/langflow/api/v1/monitor.py

[error] 51-51: W293 Blank line contains whitespace.

🪛 Pylint (3.3.7)
src/backend/tests/unit/test_session_endpoint.py

[error] 5-5: No name 'memory' in module 'langflow'

(E0611)


[error] 6-6: No name 'services' in module 'langflow'

(E0611)


[error] 7-7: No name 'services' in module 'langflow'

(E0611)


[error] 8-8: No name 'services' in module 'langflow'

(E0611)

🔇 Additional comments (15)
pyproject.toml (1)

233-233: I’ll locate any --ignore=tests/integration occurrences, find where coverage run is invoked, and inspect the pytest config section in pyproject.toml.

#!/bin/bash
set -e

echo "1) Searching for literal '--ignore=tests/integration':"
rg -F '--ignore=tests/integration' -n . || echo "→ No matches found."

echo
echo "2) Finding 'coverage run' invocations in the repo:"
rg 'coverage run' -n . || echo "→ No coverage run found."

echo
echo "3) Finding 'coverage run' in CI workflows:"
find .github/workflows -type f -exec rg 'coverage run' -n {} + || echo "→ No coverage run in workflows."

echo
echo "4) Inspecting pytest config around testpaths in pyproject.toml:"
sed -n '225,245p' pyproject.toml
src/frontend/src/customization/components/custom-new-modal.tsx (1)

1-1: Import path update looks good

Path switch to the new playground modal matches the refactor; no issues spotted.

src/frontend/src/controllers/API/helpers/constants.ts (1)

10-10: Constant added in correct namespace

SESSIONS key slots neatly into the existing URLs map; nothing else to add.

src/frontend/src/modals/IOModal/types/sidebar-open-view.ts (1)

11-11: ```shell
#!/bin/bash

1. Show the props defined in sidebar-open-view.ts

echo "=== sidebar-open-view.ts props ==="
sed -n '1,200p' src/frontend/src/modals/IOModal/types/sidebar-open-view.ts || true

2. Find all JSX/TSX usages of <SidebarOpenView

echo -e "\n=== SidebarOpenView JSX usages ==="
rg -n "<SidebarOpenView" -g ".tsx" -g ".jsx" || true

3. Check which of those usages pass the setActiveSession prop

echo -e "\n=== setActiveSession prop in JSX ==="
rg -n "setActiveSession" -g ".tsx" -g ".jsx" || true


</details>
<details>
<summary>src/frontend/src/types/zustand/flow/index.ts (1)</summary>

`288-290`: **Type additions look good**

The new flag and setter are correctly typed and keep the public store contract in sync with the implementation.

</details>
<details>
<summary>src/frontend/src/controllers/API/queries/messages/use-get-messages-polling.ts (1)</summary>

`115-123`: **👍 Session-ID preprocessing**

Encoding `session_id` via `prepareSessionIdForAPI` before sending the request keeps frontend/back-end behaviour consistent with the new decoding logic server-side.

</details>
<details>
<summary>src/frontend/src/modals/IOModal/components/sidebar-open-view.tsx (1)</summary>

`62-93`: **Down-propagated `setActiveSession` but not triggered by child**

`SessionSelector` receives `setActiveSession` yet never calls it (see previous comment).  
Until the child uses the callback, passing the prop is ineffective. Keep interfaces consistent between parent and child.

</details>
<details>
<summary>src/frontend/src/modals/IOModal/playground-modal.tsx (7)</summary>

`7-7`: **LGTM! Well-structured state management.**

The imports and new state hooks for handling new chat sessions on the playground are properly implemented.



Also applies to: 14-14, 48-54

---

`91-111`: **Excellent session initialization logic.**

The integration with `useGetSessionsFromFlowQuery` and the effect that ensures `currentFlowId` is always included in the sessions list is well implemented. This provides a good fallback behavior.

---

`134-143`: **Good handling of session deletion edge cases.**

The logic properly handles switching to another session when the visible one is deleted, with a sensible fallback to `currentFlowId`.

---

`177-187`: **Proper integration with session-based message filtering.**

The query correctly uses `visibleSession` to filter messages, maintaining consistency with the new session management approach.

---

`306-314`: **Verify the toggle behavior for active sessions.**

The current implementation toggles off the session when clicking the same one, setting `visibleSession` to `undefined`. This might be confusing UX and could lead to states where no session is visible.

Consider whether this toggle behavior is intentional. Most UIs keep the current selection when clicking on an already selected item. If this is intentional, ensure the UI properly handles the case where `visibleSession` is `undefined`.

---

`315-334`: **Well-implemented session change tracking.**

The effect properly handles initialization and subsequent session changes, avoiding unnecessary refetches on mount while ensuring messages are refetched when the session actually changes.

---

`400-400`: **Good loading state management.**

The conditional rendering based on `sessionsLoading` prevents UI flicker and ensures components have the necessary data before rendering.



Also applies to: 409-409, 448-448

</details>
<details>
<summary>src/backend/tests/unit/test_session_endpoint.py (1)</summary>

`75-91`: **Excellent test coverage for the sessions endpoint.**

The test properly verifies retrieval of all sessions and uses set comparison for order-independent validation.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment on lines +924 to +931
if (!encoded_session_id) return "";
try {
return decodeURIComponent(encoded_session_id);
} catch (error) {
console.warn("Failed to decode session ID:", encoded_session_id, error);
return encoded_session_id; // Return as-is if decoding fails
}
}
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.

🛠️ Refactor suggestion

“+” is not decoded to a space

decodeURIComponent leaves plus signs untouched, yet sessionIdFormatted treats “+” as a sign that the
value is URL-encoded.
If the BE encodes spaces as “+” (common for query parameters), they will survive the round-trip.

   try {
-    return decodeURIComponent(encoded_session_id);
+    return decodeURIComponent(encoded_session_id.replace(/\+/g, " "));
   } catch (error) {
📝 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
if (!encoded_session_id) return "";
try {
return decodeURIComponent(encoded_session_id);
} catch (error) {
console.warn("Failed to decode session ID:", encoded_session_id, error);
return encoded_session_id; // Return as-is if decoding fails
}
}
if (!encoded_session_id) return "";
try {
return decodeURIComponent(encoded_session_id.replace(/\+/g, " "));
} catch (error) {
console.warn("Failed to decode session ID:", encoded_session_id, error);
return encoded_session_id; // Return as-is if decoding fails
}
}
🤖 Prompt for AI Agents
In src/frontend/src/utils/utils.ts around lines 924 to 931, the
decodeURIComponent call does not convert plus signs to spaces, causing issues if
the backend encodes spaces as "+". To fix this, before calling
decodeURIComponent, replace all "+" characters in encoded_session_id with
spaces, then decode the result. This ensures spaces encoded as "+" are properly
handled.

Comment on lines +51 to 54
onSettled: () => {
queryClient.invalidateQueries({
queryKey: ["useGetSessionsFromFlowQuery"],
});
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.

🛠️ Refactor suggestion

Do not swallow consumer-provided onSettled

The custom onSettled invalidates the sessions cache but no longer calls any onSettled the caller might have passed, breaking backward compatibility with existing consumers.

-  onSettled: () => {
+  onSettled: (data, error, variables, context) => {
     queryClient.invalidateQueries({
       queryKey: ["useGetSessionsFromFlowQuery"],
     });
+    options?.onSettled?.(data, error, variables, context);
   },
📝 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
onSettled: () => {
queryClient.invalidateQueries({
queryKey: ["useGetSessionsFromFlowQuery"],
});
onSettled: (data, error, variables, context) => {
queryClient.invalidateQueries({
queryKey: ["useGetSessionsFromFlowQuery"],
});
options?.onSettled?.(data, error, variables, context);
},
🤖 Prompt for AI Agents
In src/frontend/src/controllers/API/queries/messages/use-rename-session.ts
around lines 51 to 54, the current onSettled handler invalidates the sessions
cache but does not call the consumer-provided onSettled callback, breaking
backward compatibility. To fix this, modify the onSettled function to first
invalidate the cache as it does now, then check if an onSettled callback was
passed by the caller and invoke it with the appropriate arguments to ensure the
original behavior is preserved.

Comment on lines +43 to +59
@router.get("/sessions")
async def get_sessions(
session: DbSession,
flow_id: Annotated[UUID | None, Query()] = None,
) -> list[str]:
try:
stmt = select(MessageTable.session_id).distinct()
stmt = stmt.where(MessageTable.session_id.isnot(None))

if flow_id:
stmt = stmt.where(MessageTable.flow_id == flow_id)

sessions = await session.exec(stmt)
return list(sessions)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e)) from e

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.

⚠️ Potential issue

Incorrect result extraction – you will return Row objects, not strings

session.exec(stmt) yields a Result object. Converting to list() produces rows like (<session_id>,), violating the annotated return type list[str] and breaking JSON serialisation.

-        sessions = await session.exec(stmt)
-        return list(sessions)
+        result = await session.exec(stmt)
+        sessions: list[str] = result.scalars().all()
+        return sessions
📝 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
@router.get("/sessions")
async def get_sessions(
session: DbSession,
flow_id: Annotated[UUID | None, Query()] = None,
) -> list[str]:
try:
stmt = select(MessageTable.session_id).distinct()
stmt = stmt.where(MessageTable.session_id.isnot(None))
if flow_id:
stmt = stmt.where(MessageTable.flow_id == flow_id)
sessions = await session.exec(stmt)
return list(sessions)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e)) from e
@router.get("/sessions")
async def get_sessions(
session: DbSession,
flow_id: Annotated[UUID | None, Query()] = None,
) -> list[str]:
try:
stmt = select(MessageTable.session_id).distinct()
stmt = stmt.where(MessageTable.session_id.isnot(None))
if flow_id:
stmt = stmt.where(MessageTable.flow_id == flow_id)
result = await session.exec(stmt)
sessions: list[str] = result.scalars().all()
return sessions
except Exception as e:
raise HTTPException(status_code=500, detail=str(e)) from e
🧰 Tools
🪛 Ruff (0.11.9)

51-51: Blank line contains whitespace

Remove whitespace from blank line

(W293)


54-54: Blank line contains whitespace

Remove whitespace from blank line

(W293)

🪛 GitHub Check: Ruff Style Check (3.13)

[failure] 54-54: Ruff (W293)
src/backend/base/langflow/api/v1/monitor.py:54:1: W293 Blank line contains whitespace


[failure] 51-51: Ruff (W293)
src/backend/base/langflow/api/v1/monitor.py:51:1: W293 Blank line contains whitespace

🪛 GitHub Actions: Ruff Style Check

[error] 51-51: W293 Blank line contains whitespace.

🤖 Prompt for AI Agents
In src/backend/base/langflow/api/v1/monitor.py lines 43 to 59, the function
get_sessions returns a list of Row objects instead of a list of strings as
annotated. To fix this, after executing the statement, extract the session_id
values from each row before returning. This can be done by iterating over the
result and collecting the first element of each row into a list of strings to
match the expected return type.

Comment on lines +220 to 237
if (newChatOnPlayground && !sessionsLoading) {
const handleRefetchAndSetSession = async () => {
try {
const result = await refetchSessions();
if (result.data?.sessions && result.data.sessions.length > 0) {
setvisibleSession(
result.data.sessions[result.data.sessions.length - 1],
);
}
} catch (error) {
console.error("Error refetching sessions:", error);
}
};

handleRefetchAndSetSession();
setNewChatOnPlayground(false);
}
}, [messages]);
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.

⚠️ Potential issue

Fix the dependency array in the effect.

The effect depends on newChatOnPlayground and sessionsLoading but the dependency array contains messages. This could cause unnecessary re-runs or miss necessary updates.

Apply this diff to fix the dependency array:

-  }, [messages]);
+  }, [newChatOnPlayground, sessionsLoading, refetchSessions, setNewChatOnPlayground]);
📝 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
if (newChatOnPlayground && !sessionsLoading) {
const handleRefetchAndSetSession = async () => {
try {
const result = await refetchSessions();
if (result.data?.sessions && result.data.sessions.length > 0) {
setvisibleSession(
result.data.sessions[result.data.sessions.length - 1],
);
}
} catch (error) {
console.error("Error refetching sessions:", error);
}
};
handleRefetchAndSetSession();
setNewChatOnPlayground(false);
}
}, [messages]);
if (newChatOnPlayground && !sessionsLoading) {
const handleRefetchAndSetSession = async () => {
try {
const result = await refetchSessions();
if (result.data?.sessions && result.data.sessions.length > 0) {
setvisibleSession(
result.data.sessions[result.data.sessions.length - 1],
);
}
} catch (error) {
console.error("Error refetching sessions:", error);
}
};
handleRefetchAndSetSession();
setNewChatOnPlayground(false);
}
}, [newChatOnPlayground, sessionsLoading, refetchSessions, setNewChatOnPlayground]);
🤖 Prompt for AI Agents
In src/frontend/src/modals/IOModal/playground-modal.tsx around lines 220 to 237,
the useEffect hook's dependency array incorrectly includes only 'messages' while
the effect logic depends on 'newChatOnPlayground' and 'sessionsLoading'. Update
the dependency array to include 'newChatOnPlayground' and 'sessionsLoading'
instead of 'messages' to ensure the effect runs correctly when these values
change.

import pytest
from httpx import AsyncClient
from langflow.memory import aadd_messagetables
from langflow.services.database.models.message import MessageCreate
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.

⚠️ Potential issue

Remove unused import.

The MessageCreate import is not used in this file.

Apply this diff to remove the unused import:

-from langflow.services.database.models.message import MessageCreate
📝 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
from langflow.services.database.models.message import MessageCreate
🧰 Tools
🪛 Ruff (0.11.9)

6-6: langflow.services.database.models.message.MessageCreate imported but unused

Remove unused import: langflow.services.database.models.message.MessageCreate

(F401)

🪛 GitHub Check: Ruff Style Check (3.13)

[failure] 6-6: Ruff (F401)
src/backend/tests/unit/test_session_endpoint.py:6:55: F401 langflow.services.database.models.message.MessageCreate imported but unused

🪛 Pylint (3.3.7)

[error] 6-6: No name 'services' in module 'langflow'

(E0611)

🤖 Prompt for AI Agents
In src/backend/tests/unit/test_session_endpoint.py at line 6, the import of
MessageCreate from langflow.services.database.models.message is unused. Remove
this import statement entirely to clean up the code and avoid unnecessary
imports.

@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 17, 2025
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: 7

🔭 Outside diff range comments (2)
src/frontend/src/controllers/API/queries/messages/use-get-messages-polling.ts (1)

95-123: session_id dropped when supplied via top-level prop

payload.session_id is read (line 99) but never merged into config unless it’s nested inside params.
Previously callers could pass { session_id: "abc" } without wrapping it. The current change is a silent breaking change and also skips URL-encoding for that path.

Suggested fix:

-    const sessionId = payload.session_id;
+    const sessionId = payload.session_id;
   ...
   if (params) {
     // existing logic …
   }
+
+    if (sessionId) {
+      config["params"] = {
+        ...config["params"],
+        session_id: prepareSessionIdForAPI(sessionId),
+      };
+    }

This restores backwards compatibility and keeps encoding consistent.

src/frontend/src/modals/IOModal/components/IOFieldView/components/session-selector.tsx (1)

29-41: Prop setActiveSession is accepted but never used

SessionSelector receives setActiveSession, yet the callback is not invoked anywhere inside the component.
Down-stream callers (e.g. SidebarOpenView) pass a handler expecting state updates that never happen, so the “active session” UI can become stale.

Quick win – trigger it when the user selects a session:

-      onClick={(e) => {
-        setNewSessionCloseVoiceAssistant(true);
-        if (isEditing) e.stopPropagation();
-        else toggleVisibility();
+      onClick={(e) => {
+        setNewSessionCloseVoiceAssistant(true);
+        if (isEditing) {
+          e.stopPropagation();
+        } else {
+          setActiveSession(session);
+          toggleVisibility();
+        }
       }}
🧹 Nitpick comments (13)
src/frontend/src/stores/flowStore.ts (1)

1064-1068: Expose the flag before its setter for consistency

Throughout the store the pattern is: state field ➜ setter ➜ helper(s).
Here the order is reversed (setNewChatOnPlayground precedes newChatOnPlayground). Nothing is functionally wrong, but re-ordering keeps the shape predictable and eases grep-based scanning.

-  setNewChatOnPlayground: (newChat: boolean) => {
-    set({ newChatOnPlayground: newChat });
-  },
-  newChatOnPlayground: false,
+  newChatOnPlayground: false,
+  setNewChatOnPlayground: (newChat: boolean) => {
+    set({ newChatOnPlayground: newChat });
+  },
src/frontend/src/utils/utils.ts (2)

949-954: isDateTimeSession regex is overly strict on locale

The pattern fixes the prefix to "Session " and month as English abbreviated name (\w{3}), making it unusable for i18n builds or minor format drifts (e.g., "Sessão" / "Sep" / "Sept"). If backend control isn’t guaranteed, loosen or document the expectation; otherwise fallback to moment parsing.


991-994: Minor: avoid double-encoding by short-circuiting

prepareSessionIdForAPI always re-encodes even when the incoming id is already %-escaped. A quick guard prevents %25 cascades:

 export function prepareSessionIdForAPI(session_id: string): string {
-  const formatted = sessionIdFormatted(session_id);
-  return encodeSessionId(formatted);
+  const formatted = sessionIdFormatted(session_id);
+  return /%[0-9A-Fa-f]{2}/.test(formatted) ? formatted : encodeSessionId(formatted);
 }
src/frontend/src/modals/IOModal/types/sidebar-open-view.ts (1)

11-12: Consider aligning the new prop’s nullability with visibleSession

All other session–selection setters (setvisibleSession, handleDeleteSession) accept a possibly-undefined value or deal with optionality. setActiveSession is typed as (session: string) => void, so callers cannot clear the active session once it’s been set.

-  setActiveSession: (session: string) => void;
+  setActiveSession: (session: string | undefined) => void;

This keeps the API symmetrical and prevents future undefinedstring type-errors.

src/backend/base/langflow/api/v1/monitor.py (1)

49-55: Trailing-space violations flagged by Ruff

Lines 51 & 54 contain whitespace-only lines → W293 Blank line contains whitespace.
Trivial but it currently breaks the CI style check.

-        
-
-            
+        # (blank lines trimmed to satisfy Ruff)
src/frontend/src/modals/IOModal/components/IOFieldView/components/session-selector.tsx (1)

51-53: Unused selector causes needless re-renders

setNewChatOnPlayground is pulled from the store but never referenced, creating an unnecessary subscription and a TypeScript noUnusedLocals warning if strict mode is enabled.

Either use it or remove the lines:

-  const setNewChatOnPlayground = useFlowStore(
-    (state) => state.setNewChatOnPlayground,
-  );
src/frontend/src/modals/IOModal/components/sidebar-open-view.tsx (1)

88-91: Redundant wrapper lambda around setActiveSession

SessionSelector already expects the exact signature (session: string) => void.
Passing a closure that does nothing but forward the argument adds noise and re-creates a new function on every render.

-              setActiveSession={(session) => {
-                setActiveSession(session);
-              }}
+              setActiveSession={setActiveSession}
src/frontend/src/controllers/API/queries/messages/use-get-messages.ts (1)

39-46: Minor: guard against non-string session_id

prepareSessionIdForAPI presumably expects a string. If params.session_id is anything else (number, null), the call could mis-behave.

-      if (processedParams.session_id) {
+      if (typeof processedParams.session_id === "string") {
         processedParams.session_id = prepareSessionIdForAPI(
           processedParams.session_id,
         );
       }
src/backend/tests/unit/test_session_endpoint.py (5)

11-73: Clean up formatting issues in the fixture.

The fixture logic is good, but there are multiple formatting issues that should be addressed.

Remove trailing whitespace from lines 17, 21-24, 28-31, 35-38, 42-45, 49-52, 56-59, 64, and remove whitespace from blank lines.


75-91: Test implementation is correct.

Good use of sets for order-independent comparison. Clean up whitespace on blank lines 80, 84, 88.


93-113: Flow ID filtering test is well implemented.

Test properly verifies the filtering functionality. Clean up formatting issues.


137-152: Add noqa comment for fixture parameter.

The messages_with_flow_ids fixture ensures test data exists before testing the non-existent case.

-async def test_get_sessions_with_non_existent_flow_id(client: AsyncClient, logged_in_headers, messages_with_flow_ids):
+async def test_get_sessions_with_non_existent_flow_id(client: AsyncClient, logged_in_headers, messages_with_flow_ids):  # noqa: ARG001

165-178: Invalid flow_id test provides good input validation coverage.

Add noqa comment for the fixture parameter and clean up formatting.

-async def test_get_sessions_invalid_flow_id_format(client: AsyncClient, logged_in_headers, messages_with_flow_ids):
+async def test_get_sessions_invalid_flow_id_format(client: AsyncClient, logged_in_headers, messages_with_flow_ids):  # noqa: ARG001
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1fcb500 and 041df22.

📒 Files selected for processing (17)
  • pyproject.toml (1 hunks)
  • src/backend/base/langflow/api/v1/monitor.py (2 hunks)
  • src/backend/tests/unit/test_session_endpoint.py (1 hunks)
  • src/frontend/src/controllers/API/helpers/constants.ts (1 hunks)
  • src/frontend/src/controllers/API/queries/messages/use-delete-messages.ts (2 hunks)
  • src/frontend/src/controllers/API/queries/messages/use-get-messages-polling.ts (2 hunks)
  • src/frontend/src/controllers/API/queries/messages/use-get-messages.ts (2 hunks)
  • src/frontend/src/controllers/API/queries/messages/use-get-sessions-from-flow.ts (1 hunks)
  • src/frontend/src/controllers/API/queries/messages/use-rename-session.ts (1 hunks)
  • src/frontend/src/customization/components/custom-new-modal.tsx (1 hunks)
  • src/frontend/src/modals/IOModal/components/IOFieldView/components/session-selector.tsx (4 hunks)
  • src/frontend/src/modals/IOModal/components/sidebar-open-view.tsx (4 hunks)
  • src/frontend/src/modals/IOModal/playground-modal.tsx (10 hunks)
  • src/frontend/src/modals/IOModal/types/sidebar-open-view.ts (1 hunks)
  • src/frontend/src/stores/flowStore.ts (1 hunks)
  • src/frontend/src/types/zustand/flow/index.ts (1 hunks)
  • src/frontend/src/utils/utils.ts (1 hunks)
🧰 Additional context used
🪛 Ruff (0.11.9)
src/backend/base/langflow/api/v1/monitor.py

51-51: Blank line contains whitespace

Remove whitespace from blank line

(W293)


54-54: Blank line contains whitespace

Remove whitespace from blank line

(W293)

src/backend/tests/unit/test_session_endpoint.py

6-6: langflow.services.database.models.message.MessageCreate imported but unused

Remove unused import: langflow.services.database.models.message.MessageCreate

(F401)


17-17: Blank line contains whitespace

Remove whitespace from blank line

(W293)


21-21: Trailing whitespace

Remove trailing whitespace

(W291)


22-22: Trailing whitespace

Remove trailing whitespace

(W291)


23-23: Trailing whitespace

Remove trailing whitespace

(W291)


24-24: Trailing whitespace

Remove trailing whitespace

(W291)


28-28: Trailing whitespace

Remove trailing whitespace

(W291)


29-29: Trailing whitespace

Remove trailing whitespace

(W291)


30-30: Trailing whitespace

Remove trailing whitespace

(W291)


31-31: Trailing whitespace

Remove trailing whitespace

(W291)


35-35: Trailing whitespace

Remove trailing whitespace

(W291)


36-36: Trailing whitespace

Remove trailing whitespace

(W291)


37-37: Trailing whitespace

Remove trailing whitespace

(W291)


38-38: Trailing whitespace

Remove trailing whitespace

(W291)


42-42: Trailing whitespace

Remove trailing whitespace

(W291)


43-43: Trailing whitespace

Remove trailing whitespace

(W291)


44-44: Trailing whitespace

Remove trailing whitespace

(W291)


45-45: Trailing whitespace

Remove trailing whitespace

(W291)


49-49: Trailing whitespace

Remove trailing whitespace

(W291)


50-50: Trailing whitespace

Remove trailing whitespace

(W291)


51-51: Trailing whitespace

Remove trailing whitespace

(W291)


52-52: Trailing whitespace

Remove trailing whitespace

(W291)


56-56: Trailing whitespace

Remove trailing whitespace

(W291)


57-57: Trailing whitespace

Remove trailing whitespace

(W291)


58-58: Trailing whitespace

Remove trailing whitespace

(W291)


59-59: Trailing whitespace

Remove trailing whitespace

(W291)


64-64: Blank line contains whitespace

Remove whitespace from blank line

(W293)


80-80: Blank line contains whitespace

Remove whitespace from blank line

(W293)


84-84: Blank line contains whitespace

Remove whitespace from blank line

(W293)


88-88: Blank line contains whitespace

Remove whitespace from blank line

(W293)


97-97: Blank line contains whitespace

Remove whitespace from blank line

(W293)


99-99: Trailing whitespace

Remove trailing whitespace

(W291)


100-100: Trailing whitespace

Remove trailing whitespace

(W291)


103-103: Blank line contains whitespace

Remove whitespace from blank line

(W293)


107-107: Blank line contains whitespace

Remove whitespace from blank line

(W293)


110-110: Blank line contains whitespace

Remove whitespace from blank line

(W293)


116-116: Line too long (122 > 120)

(E501)


119-119: Blank line contains whitespace

Remove whitespace from blank line

(W293)


121-121: Trailing whitespace

Remove trailing whitespace

(W291)


122-122: Trailing whitespace

Remove trailing whitespace

(W291)


125-125: Blank line contains whitespace

Remove whitespace from blank line

(W293)


129-129: Blank line contains whitespace

Remove whitespace from blank line

(W293)


132-132: Blank line contains whitespace

Remove whitespace from blank line

(W293)


138-138: Unused function argument: messages_with_flow_ids

(ARG001)


141-141: Blank line contains whitespace

Remove whitespace from blank line

(W293)


143-143: Trailing whitespace

Remove trailing whitespace

(W291)


144-144: Trailing whitespace

Remove trailing whitespace

(W291)


147-147: Blank line contains whitespace

Remove whitespace from blank line

(W293)


158-158: Blank line contains whitespace

Remove whitespace from blank line

(W293)


166-166: Unused function argument: messages_with_flow_ids

(ARG001)


169-169: Trailing whitespace

Remove trailing whitespace

(W291)


170-170: Trailing whitespace

Remove trailing whitespace

(W291)


173-173: Blank line contains whitespace

Remove whitespace from blank line

(W293)

🪛 GitHub Check: Ruff Style Check (3.13)
src/backend/base/langflow/api/v1/monitor.py

[failure] 54-54: Ruff (W293)
src/backend/base/langflow/api/v1/monitor.py:54:1: W293 Blank line contains whitespace


[failure] 51-51: Ruff (W293)
src/backend/base/langflow/api/v1/monitor.py:51:1: W293 Blank line contains whitespace

src/backend/tests/unit/test_session_endpoint.py

[failure] 29-29: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:29:29: W291 Trailing whitespace


[failure] 28-28: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:28:34: W291 Trailing whitespace


[failure] 24-24: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:24:40: W291 Trailing whitespace


[failure] 23-23: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:23:36: W291 Trailing whitespace


[failure] 22-22: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:22:31: W291 Trailing whitespace


[failure] 21-21: Ruff (W291)
src/backend/tests/unit/test_session_endpoint.py:21:34: W291 Trailing whitespace


[failure] 17-17: Ruff (W293)
src/backend/tests/unit/test_session_endpoint.py:17:1: W293 Blank line contains whitespace


[failure] 6-6: Ruff (F401)
src/backend/tests/unit/test_session_endpoint.py:6:55: F401 langflow.services.database.models.message.MessageCreate imported but unused

🪛 GitHub Actions: Ruff Style Check
src/backend/base/langflow/api/v1/monitor.py

[error] 51-51: W293 Blank line contains whitespace.

🪛 Pylint (3.3.7)
src/backend/tests/unit/test_session_endpoint.py

[error] 5-5: No name 'memory' in module 'langflow'

(E0611)


[error] 6-6: No name 'services' in module 'langflow'

(E0611)


[error] 7-7: No name 'services' in module 'langflow'

(E0611)


[error] 8-8: No name 'services' in module 'langflow'

(E0611)

🔇 Additional comments (15)
pyproject.toml (1)

229-246: I’ll check whether any integration tests still exist under the old or new paths.

#!/bin/bash
# List any files under tests/integration
echo "Checking for files in tests/integration:"
find . -type f -path "./tests/integration/*" || echo "None found."

# List any files under src/backend/tests/integration
echo "Checking for files in src/backend/tests/integration:"
find . -type f -path "./src/backend/tests/integration/*" || echo "None found."
src/frontend/src/customization/components/custom-new-modal.tsx (1)

1-1: Import path change looks good

Switching to the new playground-aware modal aligns this thin wrapper with the updated session workflow. No further action needed.

src/frontend/src/controllers/API/helpers/constants.ts (1)

10-11: Constant added – verify backend route stability

SESSIONS mirrors the /monitor/sessions endpoint added server-side. Confirm that:

  1. The backend route uses the same prefix (monitor/sessions);
  2. It is covered by CORS/auth policies identical to MESSAGES.

If both hold, the addition is perfect.

src/frontend/src/types/zustand/flow/index.ts (1)

288-290: Verify store implementation keeps type & runtime in sync

Types now expose newChatOnPlayground and setNewChatOnPlayground, but adding them only here will compile while the store implementation may still lack initial state or the setter. Please confirm src/frontend/src/stores/flowStore.ts (or equivalent) initializes:

newChatOnPlayground: false,
setNewChatOnPlayground: (val) => set({ newChatOnPlayground: val }),

to avoid runtime undefined errors.

src/frontend/src/controllers/API/queries/messages/use-get-sessions-from-flow.ts (1)

22-48: Align return type with AxiosResponse for playground branch

When isPlaygroundPage is true, getSessionsFn returns a plain object { data: string[] }, whereas the non-playground branch returns an AxiosResponse.
This breaks type safety for consumers that rely on AxiosResponse fields (status, headers, etc.).

Simplest fix: model a minimal Axios-like shape or wrap with the same interface.

       // For playground mode, get sessions from sessionStorage
@@
-      return {
-        data: sessionIds,
-      };
+      return {
+        data: sessionIds,
+        status: 200,
+        statusText: "OK",
+        headers: {},
+        config: {},
+      } as const;
src/frontend/src/modals/IOModal/playground-modal.tsx (9)

7-14: Import changes look good.

The new query hook import and React hooks import are properly structured.


48-54: State management addition is appropriate.

The newChatOnPlayground state and setter follow the established pattern for flow store integration.


91-101: Sessions query hook is well implemented.

The hook correctly fetches sessions for the current flow and is properly optimized with the enabled flag.


102-112: Sessions initialization logic is robust.

Good defensive programming by ensuring the currentFlowId is always included as a fallback session.


134-143: Session deletion handling is comprehensive.

The logic properly handles edge cases and ensures consistent UI state after deletion.


177-188: Messages query properly integrates session filtering.

The query correctly uses the visible session to filter messages.


306-314: Toggle function is well implemented.

The session toggle logic provides good UX by allowing deselection.


315-334: Session change handling is optimized.

Good use of initialization flag and ref to prevent unnecessary refetches while ensuring data stays in sync.


400-410: UI updates properly handle loading states.

Good practice to wait for data before rendering dependent components.

Also applies to: 448-449

src/backend/tests/unit/test_session_endpoint.py (1)

154-163: Empty database test is appropriate.

Good coverage of the edge case when no messages exist.

Comment on lines +912 to +931
export function encodeSessionId(session_id: string): string {
if (!session_id) return "";
// Use encodeURIComponent to properly encode spaces, commas, colons, etc.
return encodeURIComponent(session_id);
}

/**
* Decodes a session ID from URL encoding
* @param {string} encoded_session_id - The URL-encoded session ID
* @returns {string} The decoded session ID
*/
export function decodeSessionId(encoded_session_id: string): string {
if (!encoded_session_id) return "";
try {
return decodeURIComponent(encoded_session_id);
} catch (error) {
console.warn("Failed to decode session ID:", encoded_session_id, error);
return encoded_session_id; // Return as-is if decoding fails
}
}
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.

⚠️ Potential issue

decodeSessionId leaves “+” untouched – spaces remain encoded

encodeURIComponent(" ") yields %20, but some BE/FE stacks still produce + for spaces (application/x-www-form-urlencoded).
sessionIdFormatted treats the presence of + as a cue to decode, yet decodeURIComponent does not convert + to space, resulting in "Session+Jun+16,+15:44:08" leaking into the UI/API.

-    return decodeURIComponent(encoded_session_id);
+    // replace plus with space before decoding to handle form-urlencoded inputs
+    return decodeURIComponent(encoded_session_id.replace(/\+/g, " "));

This keeps behaviour symmetric with encodeSessionId.

📝 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
export function encodeSessionId(session_id: string): string {
if (!session_id) return "";
// Use encodeURIComponent to properly encode spaces, commas, colons, etc.
return encodeURIComponent(session_id);
}
/**
* Decodes a session ID from URL encoding
* @param {string} encoded_session_id - The URL-encoded session ID
* @returns {string} The decoded session ID
*/
export function decodeSessionId(encoded_session_id: string): string {
if (!encoded_session_id) return "";
try {
return decodeURIComponent(encoded_session_id);
} catch (error) {
console.warn("Failed to decode session ID:", encoded_session_id, error);
return encoded_session_id; // Return as-is if decoding fails
}
}
export function decodeSessionId(encoded_session_id: string): string {
if (!encoded_session_id) return "";
try {
// replace plus with space before decoding to handle form-urlencoded inputs
return decodeURIComponent(encoded_session_id.replace(/\+/g, " "));
} catch (error) {
console.warn("Failed to decode session ID:", encoded_session_id, error);
return encoded_session_id; // Return as-is if decoding fails
}
}
🤖 Prompt for AI Agents
In src/frontend/src/utils/utils.ts around lines 912 to 931, the decodeSessionId
function does not convert plus signs (+) to spaces, causing encoded spaces
represented as '+' to remain incorrectly decoded. To fix this, before calling
decodeURIComponent, replace all '+' characters in the input string with spaces,
ensuring proper decoding of spaces encoded as '+'. This will keep
decodeSessionId behavior symmetric with encodeSessionId and prevent '+' from
leaking into the UI or API.

Comment on lines +51 to 55
onSettled: () => {
queryClient.invalidateQueries({
queryKey: ["useGetSessionsFromFlowQuery"],
});
},
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.

⚠️ Potential issue

Original onSettled supplied by callers is silently discarded

...options is spread before your custom onSettled, so any handler passed by consumers is overwritten and never executed—unlike the pattern used in useDeleteMessages.

-      onSettled: () => {
-        queryClient.invalidateQueries({
-          queryKey: ["useGetSessionsFromFlowQuery"],
-        });
-      },
+      onSettled: (data, error, variables, context) => {
+        queryClient.invalidateQueries({
+          queryKey: ["useGetSessionsFromFlowQuery"],
+        });
+        options?.onSettled?.(data, error, variables, context);
+      },

Restoring the pass-through preserves backwards compatibility and prevents hidden regressions for callers that relied on their own onSettled logic.

📝 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
onSettled: () => {
queryClient.invalidateQueries({
queryKey: ["useGetSessionsFromFlowQuery"],
});
},
onSettled: (data, error, variables, context) => {
queryClient.invalidateQueries({
queryKey: ["useGetSessionsFromFlowQuery"],
});
options?.onSettled?.(data, error, variables, context);
},
🤖 Prompt for AI Agents
In src/frontend/src/controllers/API/queries/messages/use-rename-session.ts
around lines 51 to 55, the custom onSettled handler overwrites any onSettled
function passed by callers because options are spread before defining onSettled.
To fix this, modify the onSettled handler to call the original onSettled from
options if it exists, ensuring both the custom logic and the caller's onSettled
are executed, preserving backward compatibility and preventing silent discarding
of caller handlers.

Comment on lines +29 to +39
> = mutate(["useDeleteMessages"], deleteMessage, {
...options,
onSettled: (data, error, variables, context) => {
// Invalidate sessions query to refetch the updated session list
queryClient.invalidateQueries({
queryKey: ["useGetSessionsFromFlowQuery"],
});
// Call the original onSettled if provided
options?.onSettled?.(data, error, variables, context);
},
});
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.

🛠️ Refactor suggestion

Return-type generic is wrong after refactor

UseMutationResult is parametrised <TData, TError, TVariables>.
The mutation resolves undefined (line 17 returns response.data, but hook signature advertises undefined), yet the generic is DeleteMessagesParams. This mismatch leaks to consumers.

-  const mutation: UseMutationResult<
-    DeleteMessagesParams,
-    any,
-    DeleteMessagesParams
+  const mutation: UseMutationResult<
+    undefined,
+    any,
+    DeleteMessagesParams
   > = mutate(

Aligning the generics avoids incorrect type inference downstream.

📝 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
> = mutate(["useDeleteMessages"], deleteMessage, {
...options,
onSettled: (data, error, variables, context) => {
// Invalidate sessions query to refetch the updated session list
queryClient.invalidateQueries({
queryKey: ["useGetSessionsFromFlowQuery"],
});
// Call the original onSettled if provided
options?.onSettled?.(data, error, variables, context);
},
});
const mutation: UseMutationResult<
undefined,
any,
DeleteMessagesParams
> = mutate(
["useDeleteMessages"], deleteMessage, {
...options,
onSettled: (data, error, variables, context) => {
// Invalidate sessions query to refetch the updated session list
queryClient.invalidateQueries({
queryKey: ["useGetSessionsFromFlowQuery"],
});
// Call the original onSettled if provided
options?.onSettled?.(data, error, variables, context);
},
}
);
🤖 Prompt for AI Agents
In src/frontend/src/controllers/API/queries/messages/use-delete-messages.ts
between lines 29 and 39, the generic parameters for UseMutationResult are
incorrectly set, causing a type mismatch where the mutation resolves undefined
but the generic is DeleteMessagesParams. To fix this, update the
UseMutationResult generic parameters to correctly reflect the mutation's
resolved data type as undefined, the error type, and the variables type,
ensuring proper type inference for consumers.

Comment on lines +49 to +57
stmt = select(MessageTable.session_id).distinct()
stmt = stmt.where(MessageTable.session_id.isnot(None))

if flow_id:
stmt = stmt.where(MessageTable.flow_id == flow_id)

sessions = await session.exec(stmt)
return list(sessions)
except Exception as e:
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.

⚠️ Potential issue

/sessions endpoint returns Row objects instead of plain strings

session.exec() yields SQLAlchemy/SQLModel Result rows.
Casting this straight to list() produces a list of Row objects (e.g. (<session_id>,)), not the raw str values the caller expects.

-        sessions = await session.exec(stmt)
-        return list(sessions)
+        # Fetch *scalar* values to obtain plain strings
+        sessions = (await session.exec(stmt)).scalars().all()
+        return sessions

Without this change the frontend receives an array of objects it cannot render/parse.

📝 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
stmt = select(MessageTable.session_id).distinct()
stmt = stmt.where(MessageTable.session_id.isnot(None))
if flow_id:
stmt = stmt.where(MessageTable.flow_id == flow_id)
sessions = await session.exec(stmt)
return list(sessions)
except Exception as e:
stmt = select(MessageTable.session_id).distinct()
stmt = stmt.where(MessageTable.session_id.isnot(None))
if flow_id:
stmt = stmt.where(MessageTable.flow_id == flow_id)
# Fetch *scalar* values to obtain plain strings
sessions = (await session.exec(stmt)).scalars().all()
return sessions
except Exception as e:
🧰 Tools
🪛 Ruff (0.11.9)

51-51: Blank line contains whitespace

Remove whitespace from blank line

(W293)


54-54: Blank line contains whitespace

Remove whitespace from blank line

(W293)

🪛 GitHub Check: Ruff Style Check (3.13)

[failure] 54-54: Ruff (W293)
src/backend/base/langflow/api/v1/monitor.py:54:1: W293 Blank line contains whitespace


[failure] 51-51: Ruff (W293)
src/backend/base/langflow/api/v1/monitor.py:51:1: W293 Blank line contains whitespace

🪛 GitHub Actions: Ruff Style Check

[error] 51-51: W293 Blank line contains whitespace.

🤖 Prompt for AI Agents
In src/backend/base/langflow/api/v1/monitor.py around lines 49 to 57, the
/sessions endpoint returns a list of Row objects instead of plain session_id
strings because session.exec(stmt) yields Result rows. To fix this, extract the
session_id values from each Row before returning by iterating over the results
and collecting the first element of each Row into a list, then return that list
of strings.

Comment on lines +220 to 237
if (newChatOnPlayground && !sessionsLoading) {
const handleRefetchAndSetSession = async () => {
try {
const result = await refetchSessions();
if (result.data?.sessions && result.data.sessions.length > 0) {
setvisibleSession(
result.data.sessions[result.data.sessions.length - 1],
);
}
} catch (error) {
console.error("Error refetching sessions:", error);
}
};

handleRefetchAndSetSession();
setNewChatOnPlayground(false);
}
}, [messages]);
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Jun 17, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove unused dependency from useEffect.

The effect doesn't use messages but includes it in the dependency array. This could cause unnecessary re-runs.

-  }, [messages]);
+  }, [newChatOnPlayground, sessionsLoading, refetchSessions, setvisibleSession, setNewChatOnPlayground]);
📝 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
if (newChatOnPlayground && !sessionsLoading) {
const handleRefetchAndSetSession = async () => {
try {
const result = await refetchSessions();
if (result.data?.sessions && result.data.sessions.length > 0) {
setvisibleSession(
result.data.sessions[result.data.sessions.length - 1],
);
}
} catch (error) {
console.error("Error refetching sessions:", error);
}
};
handleRefetchAndSetSession();
setNewChatOnPlayground(false);
}
}, [messages]);
if (newChatOnPlayground && !sessionsLoading) {
const handleRefetchAndSetSession = async () => {
try {
const result = await refetchSessions();
if (result.data?.sessions && result.data.sessions.length > 0) {
setvisibleSession(
result.data.sessions[result.data.sessions.length - 1],
);
}
} catch (error) {
console.error("Error refetching sessions:", error);
}
};
handleRefetchAndSetSession();
setNewChatOnPlayground(false);
}
}, [newChatOnPlayground, sessionsLoading, refetchSessions, setvisibleSession, setNewChatOnPlayground]);
🤖 Prompt for AI Agents
In src/frontend/src/modals/IOModal/playground-modal.tsx around lines 220 to 237,
the useEffect hook includes 'messages' in its dependency array but does not
actually use it inside the effect, causing unnecessary re-runs. Remove
'messages' from the dependency array to ensure the effect only runs when
necessary based on the actual dependencies used within it.

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.

@Cristhianzl @mfortman11 does this make sense?

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.

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 +1 to +9
from uuid import uuid4

import pytest
from httpx import AsyncClient
from langflow.memory import aadd_messagetables
from langflow.services.database.models.message import MessageCreate
from langflow.services.database.models.message.model import MessageTable
from langflow.services.deps import session_scope

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.

⚠️ Potential issue

Remove unused import.

MessageCreate is imported but not used in the code.

-from langflow.services.database.models.message import MessageCreate
 from langflow.services.database.models.message.model import MessageTable
📝 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
from uuid import uuid4
import pytest
from httpx import AsyncClient
from langflow.memory import aadd_messagetables
from langflow.services.database.models.message import MessageCreate
from langflow.services.database.models.message.model import MessageTable
from langflow.services.deps import session_scope
from uuid import uuid4
import pytest
from httpx import AsyncClient
from langflow.memory import aadd_messagetables
from langflow.services.database.models.message.model import MessageTable
from langflow.services.deps import session_scope
🧰 Tools
🪛 Ruff (0.11.9)

6-6: langflow.services.database.models.message.MessageCreate imported but unused

Remove unused import: langflow.services.database.models.message.MessageCreate

(F401)

🪛 GitHub Check: Ruff Style Check (3.13)

[failure] 6-6: Ruff (F401)
src/backend/tests/unit/test_session_endpoint.py:6:55: F401 langflow.services.database.models.message.MessageCreate imported but unused

🪛 Pylint (3.3.7)

[error] 5-5: No name 'memory' in module 'langflow'

(E0611)


[error] 6-6: No name 'services' in module 'langflow'

(E0611)


[error] 7-7: No name 'services' in module 'langflow'

(E0611)


[error] 8-8: No name 'services' in module 'langflow'

(E0611)

🤖 Prompt for AI Agents
In src/backend/tests/unit/test_session_endpoint.py at lines 1 to 9, the import
of MessageCreate is unused. Remove the import statement for MessageCreate to
clean up the code and avoid unnecessary imports.

Comment on lines +115 to +135
@pytest.mark.api_key_required
async def test_get_sessions_with_different_flow_id_filter(client: AsyncClient, logged_in_headers, messages_with_flow_ids):
"""Test getting sessions filtered by a different flow_id."""
flow_id_2 = messages_with_flow_ids["flow_id_2"]

response = await client.get(
"api/v1/monitor/sessions",
params={"flow_id": str(flow_id_2)},
headers=logged_in_headers
)

assert response.status_code == 200, response.text
sessions = response.json()
assert isinstance(sessions, list)

returned_sessions = set(sessions)
expected_sessions = messages_with_flow_ids["expected_sessions_flow_2"]

assert returned_sessions == expected_sessions
assert len(sessions) == len(expected_sessions)

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.

⚠️ Potential issue

Fix line length issue.

Line 116 exceeds the 120 character limit. Also clean up formatting.

-async def test_get_sessions_with_different_flow_id_filter(client: AsyncClient, logged_in_headers, messages_with_flow_ids):
+async def test_get_sessions_with_different_flow_id_filter(
+    client: AsyncClient, logged_in_headers, messages_with_flow_ids
+):
📝 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
@pytest.mark.api_key_required
async def test_get_sessions_with_different_flow_id_filter(client: AsyncClient, logged_in_headers, messages_with_flow_ids):
"""Test getting sessions filtered by a different flow_id."""
flow_id_2 = messages_with_flow_ids["flow_id_2"]
response = await client.get(
"api/v1/monitor/sessions",
params={"flow_id": str(flow_id_2)},
headers=logged_in_headers
)
assert response.status_code == 200, response.text
sessions = response.json()
assert isinstance(sessions, list)
returned_sessions = set(sessions)
expected_sessions = messages_with_flow_ids["expected_sessions_flow_2"]
assert returned_sessions == expected_sessions
assert len(sessions) == len(expected_sessions)
@pytest.mark.api_key_required
async def test_get_sessions_with_different_flow_id_filter(
client: AsyncClient, logged_in_headers, messages_with_flow_ids
):
"""Test getting sessions filtered by a different flow_id."""
flow_id_2 = messages_with_flow_ids["flow_id_2"]
response = await client.get(
"api/v1/monitor/sessions",
params={"flow_id": str(flow_id_2)},
headers=logged_in_headers
)
assert response.status_code == 200, response.text
sessions = response.json()
assert isinstance(sessions, list)
returned_sessions = set(sessions)
expected_sessions = messages_with_flow_ids["expected_sessions_flow_2"]
assert returned_sessions == expected_sessions
assert len(sessions) == len(expected_sessions)
🧰 Tools
🪛 Ruff (0.11.9)

116-116: Line too long (122 > 120)

(E501)


119-119: Blank line contains whitespace

Remove whitespace from blank line

(W293)


121-121: Trailing whitespace

Remove trailing whitespace

(W291)


122-122: Trailing whitespace

Remove trailing whitespace

(W291)


125-125: Blank line contains whitespace

Remove whitespace from blank line

(W293)


129-129: Blank line contains whitespace

Remove whitespace from blank line

(W293)


132-132: Blank line contains whitespace

Remove whitespace from blank line

(W293)

🤖 Prompt for AI Agents
In src/backend/tests/unit/test_session_endpoint.py around lines 115 to 135, line
116 exceeds the 120 character limit. Break the long line into multiple shorter
lines to comply with the line length restriction and improve readability. Also,
adjust the surrounding formatting to maintain consistent indentation and style.

@Cristhianzl Cristhianzl removed the request for review from eric-schneider June 17, 2025 19:03
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jun 17, 2025
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 17, 2025
@Cristhianzl Cristhianzl force-pushed the cz/message-playground branch from 39c6364 to 041df22 Compare June 17, 2025 19:12
Comment thread src/backend/base/langflow/api/v1/monitor.py
Comment thread src/backend/base/langflow/api/v1/monitor.py Outdated
📝 (monitor.py): Add comments and improve readability in test_messages_endpoints.py
📝 (session_endpoint.py): Update endpoint paths for consistency and clarity in test_session_endpoint.py
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 20, 2025
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 20, 2025
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 20, 2025
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 20, 2025
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jun 20, 2025
@Cristhianzl Cristhianzl added this pull request to the merge queue Jun 23, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2025
@ogabrielluiz ogabrielluiz added this pull request to the merge queue Jun 23, 2025
@ogabrielluiz ogabrielluiz removed this pull request from the merge queue due to a manual request Jun 23, 2025
@Cristhianzl Cristhianzl added this pull request to the merge queue Jun 23, 2025
Merged via the queue into main with commit 043ba55 Jun 23, 2025
68 checks passed
@Cristhianzl Cristhianzl deleted the cz/message-playground branch June 23, 2025 14:24
Yukiyukiyeah pushed a commit that referenced this pull request Jun 23, 2025
* 📝 (monitor.py): Add endpoint to get sessions and handle session_id encoding for API requests
📝 (use-get-messages-mutation.ts): Implement a mutation function to fetch messages with query parameters and handle session_id encoding for API requests
📝 (use-get-messages-polling.ts): Ensure proper encoding of session_id for API requests in polling mutation
📝 (use-get-messages.ts): Handle session_id encoding for API requests in messages query
📝 (new-modal.tsx): Implement functions to handle session deletion and proper encoding of session_id for API requests
📝 (utils.ts): Add functions to encode, decode, validate, format, and prepare session IDs for API requests

* 📝 (constants.ts): Add SESSIONS constant to API URLs for monitoring sessions
🔧 (use-delete-messages.ts): Add queryClient to UseRequestProcessor to invalidate sessions query
✨ (use-get-sessions-from-flow.ts): Introduce useGetSessionsFromFlowQuery to fetch sessions from flow
🔧 (use-rename-session.ts): Change refetchQueries to invalidateQueries for useGetSessionsFromFlowQuery
🔧 (custom-new-modal.tsx): Update import path for IOModal to playground-modal
🔧 (session-selector.tsx): Add setActiveSession function to handle setting active session
🔧 (sidebar-open-view.tsx): Add setActiveSession function to handle setting active session
♻️ (new-modal.tsx): Refactor IOModal into playground-modal and update functionality
♻️ (playground-modal.tsx): Refactor IOModal to handle playground-specific functionality
⬆️ (flowStore.ts): Add newChatOnPlayground state and setNewChatOnPlayground function
⬆️ (index.ts): Update FlowStoreType to include newChatOnPlayground and setNewChatOnPlayground

* 🔧 (pyproject.toml): update testpaths to point to the correct directory for tests
✨ (test_session_endpoint.py): add unit tests for sessions endpoint with flow_id filtering
♻️ (session-selector.tsx): refactor to trim editedSession before setting it
♻️ (sidebar-open-view.tsx): refactor to set visibleSession instead of activeSession

* ✨ (use-get-sessions-from-flow.ts): Always include the flow ID as the default session if it's not already present
♻️ (playground-modal.tsx): Refactor setting sessions to include currentFlowId as the default session if not present, and handle visibility of sessions more efficiently

* ♻️ (use-get-messages-mutation.ts): remove unused imports and refactor code for better readability and maintainability

* ✨ (test_session_endpoint.py): refactor test function names for better clarity and consistency

* ✨ (create-new-session-name.ts): add function to generate a new session name based on the current date and time
🔧 (playground-modal.tsx): import createNewSessionName function to dynamically set a new session name when no session is visible

* [autofix.ci] apply automated fixes

* ✨ (monitor.py): rename get_sessions endpoint to get_message_sessions for clarity and consistency
🔧 (constants.ts): remove unused SESSIONS constant from API URLs
🔧 (use-delete-messages.ts): remove commented out code and unnecessary comments
✨ (use-delete-sessions.ts): add functionality to delete sessions in frontend
🔧 (use-get-sessions-from-flow.ts): update API endpoint for getting sessions to match backend changes
🔧 (playground-modal.tsx): add functionality to delete sessions and associated messages in the UI, update UI optimistically, and handle errors appropriately

* [autofix.ci] apply automated fixes

* 🐛 (monitor.py): Fix type hinting issue in delete_messages function
📝 (monitor.py): Add comments and improve readability in test_messages_endpoints.py
📝 (session_endpoint.py): Update endpoint paths for consistency and clarity in test_session_endpoint.py

* [autofix.ci] apply automated fixes

* fix: update SQL statement to use col() for session_id filtering in get_message_sessions function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
github-merge-queue Bot pushed a commit that referenced this pull request Jun 23, 2025
* Update Vector Store RAG.json

* fix: make starter projects auto refactor not remove selected output (#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (#8490)

* update templates

* update templates

* First round of template updates

* Update templates

* fix: Update SaaS, Social Media, and YouTube json file (#8441)

* update SaaS, Social Media, and YouTube json file

* fix: make starter projects auto refactor not remove selected output (#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (#8490)

* update json

* fix custom component

* revert change

---------

Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>

* fix: templates (#8499)

* basic-prompting-template-updated

* show-system-message

* names

* blog-writer-tested

* financial-report-parser

* image-sentiment-analysis

* seo-keyword-generator

* seo-keyword-generator

* Merge branch 'fix-vector-search-template' into mendons-template-branch

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>

* Update Basic Prompting.json

* Update Blog Writer.json

* Further template updates

* Update Image Sentiment Analysis.json

* Update templates

* Update Financial Report Parser.json

* Update Market Research.json

* Update Market Research.json

* update several templates

* Update Image Sentiment Analysis.json

* Update Market Research.json

* Update image sentiment analysis template

* Update Market Research.json

* Update Custom Component Maker.json

* Update Custom Component Maker.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* More template updates

* Update Financial Report Parser.json

* updated templates

* change custom component maker

* Update Twitter Thread Generator.json

* updates from main

* change model

* Update Research Translation Loop.json

* expanded output component to fix tests

* update template

* autofix

* fix error

* fix change back

* change back

* ci: Skip truncated values test for refactoring (#8670)

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook (#8590)

* build: add pyyaml dependency

* refactor: simplify init command by removing cache cleaning and langflow run call

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook

* refactor: update langchain_core.prompts import paths to use specific modules

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* feat: update structured output to multiline input and revise system prompt (#8585)

* Update structured_output.py

* [autofix.ci] apply automated fixes

* Update structured_output.py

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* update to prompt

* template updates

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* feat: add sessions endpoint with session management enhancements (#8596)

* 📝 (monitor.py): Add endpoint to get sessions and handle session_id encoding for API requests
📝 (use-get-messages-mutation.ts): Implement a mutation function to fetch messages with query parameters and handle session_id encoding for API requests
📝 (use-get-messages-polling.ts): Ensure proper encoding of session_id for API requests in polling mutation
📝 (use-get-messages.ts): Handle session_id encoding for API requests in messages query
📝 (new-modal.tsx): Implement functions to handle session deletion and proper encoding of session_id for API requests
📝 (utils.ts): Add functions to encode, decode, validate, format, and prepare session IDs for API requests

* 📝 (constants.ts): Add SESSIONS constant to API URLs for monitoring sessions
🔧 (use-delete-messages.ts): Add queryClient to UseRequestProcessor to invalidate sessions query
✨ (use-get-sessions-from-flow.ts): Introduce useGetSessionsFromFlowQuery to fetch sessions from flow
🔧 (use-rename-session.ts): Change refetchQueries to invalidateQueries for useGetSessionsFromFlowQuery
🔧 (custom-new-modal.tsx): Update import path for IOModal to playground-modal
🔧 (session-selector.tsx): Add setActiveSession function to handle setting active session
🔧 (sidebar-open-view.tsx): Add setActiveSession function to handle setting active session
♻️ (new-modal.tsx): Refactor IOModal into playground-modal and update functionality
♻️ (playground-modal.tsx): Refactor IOModal to handle playground-specific functionality
⬆️ (flowStore.ts): Add newChatOnPlayground state and setNewChatOnPlayground function
⬆️ (index.ts): Update FlowStoreType to include newChatOnPlayground and setNewChatOnPlayground

* 🔧 (pyproject.toml): update testpaths to point to the correct directory for tests
✨ (test_session_endpoint.py): add unit tests for sessions endpoint with flow_id filtering
♻️ (session-selector.tsx): refactor to trim editedSession before setting it
♻️ (sidebar-open-view.tsx): refactor to set visibleSession instead of activeSession

* ✨ (use-get-sessions-from-flow.ts): Always include the flow ID as the default session if it's not already present
♻️ (playground-modal.tsx): Refactor setting sessions to include currentFlowId as the default session if not present, and handle visibility of sessions more efficiently

* ♻️ (use-get-messages-mutation.ts): remove unused imports and refactor code for better readability and maintainability

* ✨ (test_session_endpoint.py): refactor test function names for better clarity and consistency

* ✨ (create-new-session-name.ts): add function to generate a new session name based on the current date and time
🔧 (playground-modal.tsx): import createNewSessionName function to dynamically set a new session name when no session is visible

* [autofix.ci] apply automated fixes

* ✨ (monitor.py): rename get_sessions endpoint to get_message_sessions for clarity and consistency
🔧 (constants.ts): remove unused SESSIONS constant from API URLs
🔧 (use-delete-messages.ts): remove commented out code and unnecessary comments
✨ (use-delete-sessions.ts): add functionality to delete sessions in frontend
🔧 (use-get-sessions-from-flow.ts): update API endpoint for getting sessions to match backend changes
🔧 (playground-modal.tsx): add functionality to delete sessions and associated messages in the UI, update UI optimistically, and handle errors appropriately

* [autofix.ci] apply automated fixes

* 🐛 (monitor.py): Fix type hinting issue in delete_messages function
📝 (monitor.py): Add comments and improve readability in test_messages_endpoints.py
📝 (session_endpoint.py): Update endpoint paths for consistency and clarity in test_session_endpoint.py

* [autofix.ci] apply automated fixes

* fix: update SQL statement to use col() for session_id filtering in get_message_sessions function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: implemented cached values and temporary MCP servers on MCP component (#8628)

* Added actionCount to fetch only servers without actionCount

* Updated queries and uses to use servers without action data first, and then to fetch them

* removed comment

* updated constants

* Added loading dropdown

* Make options persist

* Implemented new value format for McpComponent and implemented saving and removing temp Mcp Server if config is existent

* Changed value type

* Implemented cache and saving the server config

* Fixed mcp server test

* fix backend formatting

* fixed lint

* Added await

* Fixed save button not appearing when no servers are available

* added condition to only show save button when options is not null

* template autofix

* change template

* update text sentiment analysis

* change basic prompt back

* change image sentiment back

* update text sentiment and twitter

* Update Twitter Thread Generator.json

* Add back the input for the chat

* add change

* fix text sentiment

* update research translation

* Update Research Translation Loop.json

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
ogabrielluiz added a commit to bkatya2001/langflow that referenced this pull request Jun 24, 2025
…gflow-ai#8596)

* 📝 (monitor.py): Add endpoint to get sessions and handle session_id encoding for API requests
📝 (use-get-messages-mutation.ts): Implement a mutation function to fetch messages with query parameters and handle session_id encoding for API requests
📝 (use-get-messages-polling.ts): Ensure proper encoding of session_id for API requests in polling mutation
📝 (use-get-messages.ts): Handle session_id encoding for API requests in messages query
📝 (new-modal.tsx): Implement functions to handle session deletion and proper encoding of session_id for API requests
📝 (utils.ts): Add functions to encode, decode, validate, format, and prepare session IDs for API requests

* 📝 (constants.ts): Add SESSIONS constant to API URLs for monitoring sessions
🔧 (use-delete-messages.ts): Add queryClient to UseRequestProcessor to invalidate sessions query
✨ (use-get-sessions-from-flow.ts): Introduce useGetSessionsFromFlowQuery to fetch sessions from flow
🔧 (use-rename-session.ts): Change refetchQueries to invalidateQueries for useGetSessionsFromFlowQuery
🔧 (custom-new-modal.tsx): Update import path for IOModal to playground-modal
🔧 (session-selector.tsx): Add setActiveSession function to handle setting active session
🔧 (sidebar-open-view.tsx): Add setActiveSession function to handle setting active session
♻️ (new-modal.tsx): Refactor IOModal into playground-modal and update functionality
♻️ (playground-modal.tsx): Refactor IOModal to handle playground-specific functionality
⬆️ (flowStore.ts): Add newChatOnPlayground state and setNewChatOnPlayground function
⬆️ (index.ts): Update FlowStoreType to include newChatOnPlayground and setNewChatOnPlayground

* 🔧 (pyproject.toml): update testpaths to point to the correct directory for tests
✨ (test_session_endpoint.py): add unit tests for sessions endpoint with flow_id filtering
♻️ (session-selector.tsx): refactor to trim editedSession before setting it
♻️ (sidebar-open-view.tsx): refactor to set visibleSession instead of activeSession

* ✨ (use-get-sessions-from-flow.ts): Always include the flow ID as the default session if it's not already present
♻️ (playground-modal.tsx): Refactor setting sessions to include currentFlowId as the default session if not present, and handle visibility of sessions more efficiently

* ♻️ (use-get-messages-mutation.ts): remove unused imports and refactor code for better readability and maintainability

* ✨ (test_session_endpoint.py): refactor test function names for better clarity and consistency

* ✨ (create-new-session-name.ts): add function to generate a new session name based on the current date and time
🔧 (playground-modal.tsx): import createNewSessionName function to dynamically set a new session name when no session is visible

* [autofix.ci] apply automated fixes

* ✨ (monitor.py): rename get_sessions endpoint to get_message_sessions for clarity and consistency
🔧 (constants.ts): remove unused SESSIONS constant from API URLs
🔧 (use-delete-messages.ts): remove commented out code and unnecessary comments
✨ (use-delete-sessions.ts): add functionality to delete sessions in frontend
🔧 (use-get-sessions-from-flow.ts): update API endpoint for getting sessions to match backend changes
🔧 (playground-modal.tsx): add functionality to delete sessions and associated messages in the UI, update UI optimistically, and handle errors appropriately

* [autofix.ci] apply automated fixes

* 🐛 (monitor.py): Fix type hinting issue in delete_messages function
📝 (monitor.py): Add comments and improve readability in test_messages_endpoints.py
📝 (session_endpoint.py): Update endpoint paths for consistency and clarity in test_session_endpoint.py

* [autofix.ci] apply automated fixes

* fix: update SQL statement to use col() for session_id filtering in get_message_sessions function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
ogabrielluiz added a commit to bkatya2001/langflow that referenced this pull request Jun 24, 2025
* Update Vector Store RAG.json

* fix: make starter projects auto refactor not remove selected output (langflow-ai#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (langflow-ai#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (langflow-ai#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (langflow-ai#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (langflow-ai#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (langflow-ai#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (langflow-ai#8490)

* update templates

* update templates

* First round of template updates

* Update templates

* fix: Update SaaS, Social Media, and YouTube json file (langflow-ai#8441)

* update SaaS, Social Media, and YouTube json file

* fix: make starter projects auto refactor not remove selected output (langflow-ai#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (langflow-ai#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (langflow-ai#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (langflow-ai#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (langflow-ai#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (langflow-ai#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (langflow-ai#8490)

* update json

* fix custom component

* revert change

---------

Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>

* fix: templates (langflow-ai#8499)

* basic-prompting-template-updated

* show-system-message

* names

* blog-writer-tested

* financial-report-parser

* image-sentiment-analysis

* seo-keyword-generator

* seo-keyword-generator

* Merge branch 'fix-vector-search-template' into mendons-template-branch

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>

* Update Basic Prompting.json

* Update Blog Writer.json

* Further template updates

* Update Image Sentiment Analysis.json

* Update templates

* Update Financial Report Parser.json

* Update Market Research.json

* Update Market Research.json

* update several templates

* Update Image Sentiment Analysis.json

* Update Market Research.json

* Update image sentiment analysis template

* Update Market Research.json

* Update Custom Component Maker.json

* Update Custom Component Maker.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* More template updates

* Update Financial Report Parser.json

* updated templates

* change custom component maker

* Update Twitter Thread Generator.json

* updates from main

* change model

* Update Research Translation Loop.json

* expanded output component to fix tests

* update template

* autofix

* fix error

* fix change back

* change back

* ci: Skip truncated values test for refactoring (langflow-ai#8670)

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook (langflow-ai#8590)

* build: add pyyaml dependency

* refactor: simplify init command by removing cache cleaning and langflow run call

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook

* refactor: update langchain_core.prompts import paths to use specific modules

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* feat: update structured output to multiline input and revise system prompt (langflow-ai#8585)

* Update structured_output.py

* [autofix.ci] apply automated fixes

* Update structured_output.py

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* update to prompt

* template updates

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* feat: add sessions endpoint with session management enhancements (langflow-ai#8596)

* 📝 (monitor.py): Add endpoint to get sessions and handle session_id encoding for API requests
📝 (use-get-messages-mutation.ts): Implement a mutation function to fetch messages with query parameters and handle session_id encoding for API requests
📝 (use-get-messages-polling.ts): Ensure proper encoding of session_id for API requests in polling mutation
📝 (use-get-messages.ts): Handle session_id encoding for API requests in messages query
📝 (new-modal.tsx): Implement functions to handle session deletion and proper encoding of session_id for API requests
📝 (utils.ts): Add functions to encode, decode, validate, format, and prepare session IDs for API requests

* 📝 (constants.ts): Add SESSIONS constant to API URLs for monitoring sessions
🔧 (use-delete-messages.ts): Add queryClient to UseRequestProcessor to invalidate sessions query
✨ (use-get-sessions-from-flow.ts): Introduce useGetSessionsFromFlowQuery to fetch sessions from flow
🔧 (use-rename-session.ts): Change refetchQueries to invalidateQueries for useGetSessionsFromFlowQuery
🔧 (custom-new-modal.tsx): Update import path for IOModal to playground-modal
🔧 (session-selector.tsx): Add setActiveSession function to handle setting active session
🔧 (sidebar-open-view.tsx): Add setActiveSession function to handle setting active session
♻️ (new-modal.tsx): Refactor IOModal into playground-modal and update functionality
♻️ (playground-modal.tsx): Refactor IOModal to handle playground-specific functionality
⬆️ (flowStore.ts): Add newChatOnPlayground state and setNewChatOnPlayground function
⬆️ (index.ts): Update FlowStoreType to include newChatOnPlayground and setNewChatOnPlayground

* 🔧 (pyproject.toml): update testpaths to point to the correct directory for tests
✨ (test_session_endpoint.py): add unit tests for sessions endpoint with flow_id filtering
♻️ (session-selector.tsx): refactor to trim editedSession before setting it
♻️ (sidebar-open-view.tsx): refactor to set visibleSession instead of activeSession

* ✨ (use-get-sessions-from-flow.ts): Always include the flow ID as the default session if it's not already present
♻️ (playground-modal.tsx): Refactor setting sessions to include currentFlowId as the default session if not present, and handle visibility of sessions more efficiently

* ♻️ (use-get-messages-mutation.ts): remove unused imports and refactor code for better readability and maintainability

* ✨ (test_session_endpoint.py): refactor test function names for better clarity and consistency

* ✨ (create-new-session-name.ts): add function to generate a new session name based on the current date and time
🔧 (playground-modal.tsx): import createNewSessionName function to dynamically set a new session name when no session is visible

* [autofix.ci] apply automated fixes

* ✨ (monitor.py): rename get_sessions endpoint to get_message_sessions for clarity and consistency
🔧 (constants.ts): remove unused SESSIONS constant from API URLs
🔧 (use-delete-messages.ts): remove commented out code and unnecessary comments
✨ (use-delete-sessions.ts): add functionality to delete sessions in frontend
🔧 (use-get-sessions-from-flow.ts): update API endpoint for getting sessions to match backend changes
🔧 (playground-modal.tsx): add functionality to delete sessions and associated messages in the UI, update UI optimistically, and handle errors appropriately

* [autofix.ci] apply automated fixes

* 🐛 (monitor.py): Fix type hinting issue in delete_messages function
📝 (monitor.py): Add comments and improve readability in test_messages_endpoints.py
📝 (session_endpoint.py): Update endpoint paths for consistency and clarity in test_session_endpoint.py

* [autofix.ci] apply automated fixes

* fix: update SQL statement to use col() for session_id filtering in get_message_sessions function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: implemented cached values and temporary MCP servers on MCP component (langflow-ai#8628)

* Added actionCount to fetch only servers without actionCount

* Updated queries and uses to use servers without action data first, and then to fetch them

* removed comment

* updated constants

* Added loading dropdown

* Make options persist

* Implemented new value format for McpComponent and implemented saving and removing temp Mcp Server if config is existent

* Changed value type

* Implemented cache and saving the server config

* Fixed mcp server test

* fix backend formatting

* fixed lint

* Added await

* Fixed save button not appearing when no servers are available

* added condition to only show save button when options is not null

* template autofix

* change template

* update text sentiment analysis

* change basic prompt back

* change image sentiment back

* update text sentiment and twitter

* Update Twitter Thread Generator.json

* Add back the input for the chat

* add change

* fix text sentiment

* update research translation

* Update Research Translation Loop.json

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Khurdhula-Harshavardhan pushed a commit to JigsawStack/langflow that referenced this pull request Jul 1, 2025
…gflow-ai#8596)

* 📝 (monitor.py): Add endpoint to get sessions and handle session_id encoding for API requests
📝 (use-get-messages-mutation.ts): Implement a mutation function to fetch messages with query parameters and handle session_id encoding for API requests
📝 (use-get-messages-polling.ts): Ensure proper encoding of session_id for API requests in polling mutation
📝 (use-get-messages.ts): Handle session_id encoding for API requests in messages query
📝 (new-modal.tsx): Implement functions to handle session deletion and proper encoding of session_id for API requests
📝 (utils.ts): Add functions to encode, decode, validate, format, and prepare session IDs for API requests

* 📝 (constants.ts): Add SESSIONS constant to API URLs for monitoring sessions
🔧 (use-delete-messages.ts): Add queryClient to UseRequestProcessor to invalidate sessions query
✨ (use-get-sessions-from-flow.ts): Introduce useGetSessionsFromFlowQuery to fetch sessions from flow
🔧 (use-rename-session.ts): Change refetchQueries to invalidateQueries for useGetSessionsFromFlowQuery
🔧 (custom-new-modal.tsx): Update import path for IOModal to playground-modal
🔧 (session-selector.tsx): Add setActiveSession function to handle setting active session
🔧 (sidebar-open-view.tsx): Add setActiveSession function to handle setting active session
♻️ (new-modal.tsx): Refactor IOModal into playground-modal and update functionality
♻️ (playground-modal.tsx): Refactor IOModal to handle playground-specific functionality
⬆️ (flowStore.ts): Add newChatOnPlayground state and setNewChatOnPlayground function
⬆️ (index.ts): Update FlowStoreType to include newChatOnPlayground and setNewChatOnPlayground

* 🔧 (pyproject.toml): update testpaths to point to the correct directory for tests
✨ (test_session_endpoint.py): add unit tests for sessions endpoint with flow_id filtering
♻️ (session-selector.tsx): refactor to trim editedSession before setting it
♻️ (sidebar-open-view.tsx): refactor to set visibleSession instead of activeSession

* ✨ (use-get-sessions-from-flow.ts): Always include the flow ID as the default session if it's not already present
♻️ (playground-modal.tsx): Refactor setting sessions to include currentFlowId as the default session if not present, and handle visibility of sessions more efficiently

* ♻️ (use-get-messages-mutation.ts): remove unused imports and refactor code for better readability and maintainability

* ✨ (test_session_endpoint.py): refactor test function names for better clarity and consistency

* ✨ (create-new-session-name.ts): add function to generate a new session name based on the current date and time
🔧 (playground-modal.tsx): import createNewSessionName function to dynamically set a new session name when no session is visible

* [autofix.ci] apply automated fixes

* ✨ (monitor.py): rename get_sessions endpoint to get_message_sessions for clarity and consistency
🔧 (constants.ts): remove unused SESSIONS constant from API URLs
🔧 (use-delete-messages.ts): remove commented out code and unnecessary comments
✨ (use-delete-sessions.ts): add functionality to delete sessions in frontend
🔧 (use-get-sessions-from-flow.ts): update API endpoint for getting sessions to match backend changes
🔧 (playground-modal.tsx): add functionality to delete sessions and associated messages in the UI, update UI optimistically, and handle errors appropriately

* [autofix.ci] apply automated fixes

* 🐛 (monitor.py): Fix type hinting issue in delete_messages function
📝 (monitor.py): Add comments and improve readability in test_messages_endpoints.py
📝 (session_endpoint.py): Update endpoint paths for consistency and clarity in test_session_endpoint.py

* [autofix.ci] apply automated fixes

* fix: update SQL statement to use col() for session_id filtering in get_message_sessions function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Khurdhula-Harshavardhan pushed a commit to JigsawStack/langflow that referenced this pull request Jul 1, 2025
* Update Vector Store RAG.json

* fix: make starter projects auto refactor not remove selected output (langflow-ai#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (langflow-ai#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (langflow-ai#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (langflow-ai#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (langflow-ai#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (langflow-ai#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (langflow-ai#8490)

* update templates

* update templates

* First round of template updates

* Update templates

* fix: Update SaaS, Social Media, and YouTube json file (langflow-ai#8441)

* update SaaS, Social Media, and YouTube json file

* fix: make starter projects auto refactor not remove selected output (langflow-ai#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (langflow-ai#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (langflow-ai#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (langflow-ai#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (langflow-ai#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (langflow-ai#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (langflow-ai#8490)

* update json

* fix custom component

* revert change

---------

Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>

* fix: templates (langflow-ai#8499)

* basic-prompting-template-updated

* show-system-message

* names

* blog-writer-tested

* financial-report-parser

* image-sentiment-analysis

* seo-keyword-generator

* seo-keyword-generator

* Merge branch 'fix-vector-search-template' into mendons-template-branch

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>

* Update Basic Prompting.json

* Update Blog Writer.json

* Further template updates

* Update Image Sentiment Analysis.json

* Update templates

* Update Financial Report Parser.json

* Update Market Research.json

* Update Market Research.json

* update several templates

* Update Image Sentiment Analysis.json

* Update Market Research.json

* Update image sentiment analysis template

* Update Market Research.json

* Update Custom Component Maker.json

* Update Custom Component Maker.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* More template updates

* Update Financial Report Parser.json

* updated templates

* change custom component maker

* Update Twitter Thread Generator.json

* updates from main

* change model

* Update Research Translation Loop.json

* expanded output component to fix tests

* update template

* autofix

* fix error

* fix change back

* change back

* ci: Skip truncated values test for refactoring (langflow-ai#8670)

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook (langflow-ai#8590)

* build: add pyyaml dependency

* refactor: simplify init command by removing cache cleaning and langflow run call

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook

* refactor: update langchain_core.prompts import paths to use specific modules

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* feat: update structured output to multiline input and revise system prompt (langflow-ai#8585)

* Update structured_output.py

* [autofix.ci] apply automated fixes

* Update structured_output.py

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* update to prompt

* template updates

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* feat: add sessions endpoint with session management enhancements (langflow-ai#8596)

* 📝 (monitor.py): Add endpoint to get sessions and handle session_id encoding for API requests
📝 (use-get-messages-mutation.ts): Implement a mutation function to fetch messages with query parameters and handle session_id encoding for API requests
📝 (use-get-messages-polling.ts): Ensure proper encoding of session_id for API requests in polling mutation
📝 (use-get-messages.ts): Handle session_id encoding for API requests in messages query
📝 (new-modal.tsx): Implement functions to handle session deletion and proper encoding of session_id for API requests
📝 (utils.ts): Add functions to encode, decode, validate, format, and prepare session IDs for API requests

* 📝 (constants.ts): Add SESSIONS constant to API URLs for monitoring sessions
🔧 (use-delete-messages.ts): Add queryClient to UseRequestProcessor to invalidate sessions query
✨ (use-get-sessions-from-flow.ts): Introduce useGetSessionsFromFlowQuery to fetch sessions from flow
🔧 (use-rename-session.ts): Change refetchQueries to invalidateQueries for useGetSessionsFromFlowQuery
🔧 (custom-new-modal.tsx): Update import path for IOModal to playground-modal
🔧 (session-selector.tsx): Add setActiveSession function to handle setting active session
🔧 (sidebar-open-view.tsx): Add setActiveSession function to handle setting active session
♻️ (new-modal.tsx): Refactor IOModal into playground-modal and update functionality
♻️ (playground-modal.tsx): Refactor IOModal to handle playground-specific functionality
⬆️ (flowStore.ts): Add newChatOnPlayground state and setNewChatOnPlayground function
⬆️ (index.ts): Update FlowStoreType to include newChatOnPlayground and setNewChatOnPlayground

* 🔧 (pyproject.toml): update testpaths to point to the correct directory for tests
✨ (test_session_endpoint.py): add unit tests for sessions endpoint with flow_id filtering
♻️ (session-selector.tsx): refactor to trim editedSession before setting it
♻️ (sidebar-open-view.tsx): refactor to set visibleSession instead of activeSession

* ✨ (use-get-sessions-from-flow.ts): Always include the flow ID as the default session if it's not already present
♻️ (playground-modal.tsx): Refactor setting sessions to include currentFlowId as the default session if not present, and handle visibility of sessions more efficiently

* ♻️ (use-get-messages-mutation.ts): remove unused imports and refactor code for better readability and maintainability

* ✨ (test_session_endpoint.py): refactor test function names for better clarity and consistency

* ✨ (create-new-session-name.ts): add function to generate a new session name based on the current date and time
🔧 (playground-modal.tsx): import createNewSessionName function to dynamically set a new session name when no session is visible

* [autofix.ci] apply automated fixes

* ✨ (monitor.py): rename get_sessions endpoint to get_message_sessions for clarity and consistency
🔧 (constants.ts): remove unused SESSIONS constant from API URLs
🔧 (use-delete-messages.ts): remove commented out code and unnecessary comments
✨ (use-delete-sessions.ts): add functionality to delete sessions in frontend
🔧 (use-get-sessions-from-flow.ts): update API endpoint for getting sessions to match backend changes
🔧 (playground-modal.tsx): add functionality to delete sessions and associated messages in the UI, update UI optimistically, and handle errors appropriately

* [autofix.ci] apply automated fixes

* 🐛 (monitor.py): Fix type hinting issue in delete_messages function
📝 (monitor.py): Add comments and improve readability in test_messages_endpoints.py
📝 (session_endpoint.py): Update endpoint paths for consistency and clarity in test_session_endpoint.py

* [autofix.ci] apply automated fixes

* fix: update SQL statement to use col() for session_id filtering in get_message_sessions function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: implemented cached values and temporary MCP servers on MCP component (langflow-ai#8628)

* Added actionCount to fetch only servers without actionCount

* Updated queries and uses to use servers without action data first, and then to fetch them

* removed comment

* updated constants

* Added loading dropdown

* Make options persist

* Implemented new value format for McpComponent and implemented saving and removing temp Mcp Server if config is existent

* Changed value type

* Implemented cache and saving the server config

* Fixed mcp server test

* fix backend formatting

* fixed lint

* Added await

* Fixed save button not appearing when no servers are available

* added condition to only show save button when options is not null

* template autofix

* change template

* update text sentiment analysis

* change basic prompt back

* change image sentiment back

* update text sentiment and twitter

* Update Twitter Thread Generator.json

* Add back the input for the chat

* add change

* fix text sentiment

* update research translation

* Update Research Translation Loop.json

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants