Skip to content

Conversation

@Steve-Mcl
Copy link
Contributor

@Steve-Mcl Steve-Mcl commented Nov 16, 2025

Description

Support additional responses including flows json

Additional, adds DomPurify

IMPORTANT

This is a work in progress (for hand over)

TODO

  • Write code for copy to clipboard (might also need to add exceptions for dom purify sanitization or re-arrange code to add click handlers after dom purification)
  • Make the "copy flow" buttons "look nice"
  • Update URL to non -dev prod URL

Related Issue(s)

prerequisites

  • deploy v3/v4 flows on the production instance

Checklist

  • I have read the contribution guidelines
  • I have considered the performance impact of these changes
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
  • For blog PRs, an Art Request has been created (instructions)

@Steve-Mcl Steve-Mcl requested a review from cstns November 16, 2025 20:33
@netlify
Copy link

netlify bot commented Nov 16, 2025

Deploy Preview for flowforge-website ready!

Name Link
🔨 Latest commit aedc720
🔍 Latest deploy log https://app.netlify.com/projects/flowforge-website/deploys/691a35205c66210008e42de7
😎 Deploy Preview https://deploy-preview-4104--flowforge-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 74 (🟢 up 10 from production)
Accessibility: 80 (no change from production)
Best Practices: 100 (🟢 up 8 from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Nov 16, 2025

Deploy Preview for flowforge-website ready!

Name Link
🔨 Latest commit 72fdc69
🔍 Latest deploy log https://app.netlify.com/projects/flowforge-website/deploys/691f46eaf1e94700089a7433
😎 Deploy Preview https://deploy-preview-4104--flowforge-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 79 (🟢 up 21 from production)
Accessibility: 80 (no change from production)
Best Practices: 100 (🟢 up 8 from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@Steve-Mcl
Copy link
Contributor Author

Steve-Mcl commented Nov 16, 2025

TODO

image

@dimitrieh
Copy link
Contributor

dimitrieh commented Nov 17, 2025

@Steve-Mcl regarding the flow buttons:

2 columns
This is a configuration currently for "resources" on the FlowFuse expert on the website. This is not yet configured as such in the app. My suggestions here would be to not worry too much about making it 2 columns because of:

  • Separation with "resource" buttons.
  • We do not yet have the double column layout in FlowFuse expert in the app
  • We might need some additionally horizontal space for the clipboard icon? (double column layout will make this harder, rather than easier)
  • Might we want to show other information? For resource buttons we have:
    • favicon
    • title
    • url
CleanShot 2025-11-17 at 14 43 41@2x

cc: @cstns

@dimitrieh
Copy link
Contributor

Originally we had something like this, which also showed the json:

CleanShot 2025-11-17 at 14 48 24@2x

It included some instructions regarding how to use the flows. If we are going to put something in the clipboard I suggest we have:

  • Indication of clicking will do an action rather than opening up page (clipboard button most likely in this case)
  • Instructions? for what to do after
  • Validation that the user has something copied into their clipboard after clicking the button? (for copying to clipboard, inline verification is often best, rather than a toast or something else). e.a.:

CleanShot 2025-11-17 at 14 51 12

…functionality, and overflow handling for improved usability
@cstns
Copy link
Contributor

cstns commented Nov 18, 2025

image

@cstns
Copy link
Contributor

cstns commented Nov 18, 2025

we should use this pr to deploy to production and switch the dev rag url to the prod one

@cstns cstns self-assigned this Nov 19, 2025
@cstns cstns requested review from dimitrieh and removed request for cstns November 19, 2025 14:26
@dimitrieh
Copy link
Contributor

API endpoint hardcoded still:

    - Old: flowfuse-expert-api.flowfuse.dev/v3
    - New: flowfuse-expert-api-dev.flowfuse.cloud/v4

Copy link
Contributor

@dimitrieh dimitrieh left a comment

Choose a reason for hiding this comment

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

I'll be making some changes :). one sec

@dimitrieh
Copy link
Contributor

CleanShot 2025-11-19 at 16 36 48

dimitrieh and others added 2 commits November 19, 2025 16:44
…tend message padding styles

- Add hover states with indigo color scheme and transitions to JSON toggle and copy buttons
- Extend py-4 padding to resources message kind for consistency with guide messages
@dimitrieh
Copy link
Contributor

types we now have:

  • chat
  • guide
  • related resources
  • flows
  • node-packages

Testing for each one

…odal

Tailwind's content scanner cannot detect classes that are conditionally
assigned in template literals or dynamically constructed with variables.
The AI Expert Modal (src/js/ai-expert-modal.js) uses patterns like:

  messageBubble.className = `max-w-xs lg:max-w-md px-4 py-2 rounded-lg ${
    type === 'human'
      ? 'bg-indigo-600 text-white rounded-br-sm'
      : 'bg-gray-100 text-gray-800 rounded-bl-sm'
  }`;

Added all dynamically assigned classes to the safelist to ensure they are
included in the generated CSS, including message styling (py-4, py-2,
bg-indigo-600, text-white, etc.) and layout classes (justify-end,
justify-start, max-w-xs, lg:max-w-md, etc.).
- Enhanced hover effects on resource links with indigo color scheme
- Added active states for better user feedback (active:bg-indigo-100, active:border-indigo-500)
- Improved transition effects (transition-all duration-200)
- Adjusted flow icon sizing and alignment for better visual hierarchy
- Reduced margin spacing for cleaner layout
@dimitrieh dimitrieh self-requested a review November 19, 2025 16:50
Copy link
Contributor

@dimitrieh dimitrieh left a comment

Choose a reason for hiding this comment

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

Seems we are missing resources for the guide (doesn't show packages)

Image

response doesn't seem to have any (different session):

{
    "query": "How would I read modbus data from a PLC and store it in a database table?",
    "context": {
        "userId": null,
        "website": true
    },
    "kind": "guide",
    "type": "AIMessage",
    "answer": [
        {
            "schemaName": "GuideSchema",
            "title": "Reading Modbus Data from a PLC and Storing it in a Database Table with FlowFuse and Node-RED",
            "summary": "This guide explains how to read Modbus data from a PLC using Node-RED managed by FlowFuse and store the data into a database table.",
            "steps": [
                {
                    "title": "Set Up Your Node-RED Instance in FlowFuse",
                    "detail": "Ensure you have a Node-RED instance running on FlowFuse, preferably on an edge device close to your PLC for reliable Modbus communication."
                },
                {
                    "title": "Install and Configure Modbus Nodes",
                    "detail": "Use the built-in or community Modbus nodes in Node-RED. Drag the Modbus Read node onto your flow canvas and configure it with the PLC's Modbus connection details (IP address, port, unit ID, register addresses)."
                },
                {
                    "title": "Read Data from the PLC",
                    "detail": "Configure the Modbus Read node to poll the desired registers at your required interval. This node will output the Modbus data as a message payload."
                },
                {
                    "title": "Process and Format the Data",
                    "detail": "Use Function nodes or the FlowFuse Assistant inside Node-RED to transform or format the raw Modbus data as needed before storing."
                },
                {
                    "title": "Store Data in a Database Table",
                    "detail": "Use FlowFuse Tables and the dedicated query node to insert the processed data into your database table. Configure the query node with the appropriate SQL insert statement or use the AI-assisted query builder."
                },
                {
                    "title": "Deploy and Monitor Your Flow",
                    "detail": "Deploy your flow and monitor the data collection and storage process. Use debug nodes or FlowFuse monitoring tools to ensure data is being read and stored correctly."
                }
            ],
            "resources": [
                {
                    "type": "document",
                    "id": "https___flowfuse_com_blog_2025_09_using_modbus_with_flowfuse_::15",
                    "title": "Using Modbus with FlowFuse",
                    "metadata": {
                        "source": "https://flowfuse.com/blog/2025/09/using-modbus-with-flowfuse/",
                        "lastModified": 1758844800000,
                        "chunk": 15
                    },
                    "pageContent": "Reading Data\nReading data from Modbus slaves in FlowFuse is straightforward. The process is the same regardless of which data type you want to read. 1. Drag the Modbus Read node onto the FlowFuse canvas. Double-click it to open the configuration."
                },
                {
                    "type": "document",
                    "id": "https___flowfuse_com_blog_2025_10_how_to_log_plc_data_csv_files_::9",
                    "title": "How to Log PLC Data to CSV Files",
                    "metadata": {
                        "source": "https://flowfuse.com/blog/2025/10/how-to-log-plc-data-csv-files/",
                        "lastModified": 1761091200000,
                        "chunk": 9
                    },
                    "pageContent": "for FlowFuse and set up an instance on your edge device. This device will manage data collection and logging from your PLC using Node-RED. Step 1: Setting Up PLC Communication in FlowFuse\nBefore logging data, you need a stable connection to your PLC. FlowFuse uses Node-RED under the hood, which supports every major industrial protocol through community-maintained packages."
                }
            ],
            "flows": [],
            "nodePackages": [],
            "kind": "guide"
        },
        {
            "title": "Follow-up",
            "content": "We have built this guide for you. If you need something different, tell us what you would like to change.",
            "kind": "chat"
        }

@dimitrieh
Copy link
Contributor

@cstns the main thing I discovered is that the guide response is lacking node packages (i tested it with multiple prompts). We'll need to fix this from the BE.

Other than that, I fixed some layout and interaction issues. which should mostly be fine and certainly not block anything

- Updated node packages and example flows to use consistent hover/active states
- All components now use indigo-themed interactions (hover:border-indigo-400, hover:bg-indigo-50, active:bg-indigo-100, active:border-indigo-500)
- Added smooth transitions (transition-all duration-200) across all interactive elements
- Fixed Tailwind class generation by adding all dynamically assigned classes to safelist
- Added CSS rule to remove bottom margin from single example flow items
@dimitrieh
Copy link
Contributor

CleanShot 2025-11-19 at 18 06 47

and some additional fixes:

CleanShot 2025-11-19 at 18 13 18

- Removed hover/active states from example flows container to avoid button visibility issues
- Reverted buttons to hover:bg-indigo-50 for proper contrast on white background
- Added dynamic margin toggle for JSON box: mt-3 only appears when expanded
- Added mt-3 to Tailwind safelist for JSON expansion feature
@dimitrieh
Copy link
Contributor

@cstns back to you. Please have a quick read through my comments and the commit messages :)

Styling wise should be good now. Issue at #4104 (comment) remains

@cstns cstns marked this pull request as ready for review November 19, 2025 17:20
@cstns
Copy link
Contributor

cstns commented Nov 19, 2025

thank you! I also noticed guides not being returned and made a comment on FlowFuse/flowfuse#6310.

You are right, it should be done on the BE side.

The problem we face now is that we can't release this until the new v4 format reaches the prod instance for which we'd need to trigger a pipeline.

@cstns
Copy link
Contributor

cstns commented Nov 19, 2025

✔️ on the changes!

We must not forget to point the client to use the production v4 endpoint not the staging one before mergeing

@dimitrieh
Copy link
Contributor

yup see open comment at #4104 (comment)

@cstns cstns requested a review from dimitrieh November 20, 2025 16:32
@cstns cstns enabled auto-merge November 20, 2025 16:51
Copy link
Contributor

@dimitrieh dimitrieh left a comment

Choose a reason for hiding this comment

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

Approving during live review

@cstns cstns merged commit a0b6358 into main Nov 20, 2025
4 checks passed
@cstns cstns deleted the chat-v4 branch November 20, 2025 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants