Skip to content

FlowFuse Expert context UI#6631

Open
Steve-Mcl wants to merge 7 commits intomainfrom
6601-expert-context
Open

FlowFuse Expert context UI#6631
Steve-Mcl wants to merge 7 commits intomainfrom
6601-expert-context

Conversation

@Steve-Mcl
Copy link
Contributor

Description

This pull request implements a new context selection feature in the expert chat input, allowing users to include or exclude specific context sources (like palette and debug logs) in their assistant interactions. It introduces new UI components for context selection and chips, improves the layout for displaying selected context items, and updates the Vuex store to support context options and their effects. The changes also refactor selection button components for consistency and reuse.

Context selection feature:

  • Added a context selector (ContextSelector.vue) and context chips (ContextChip/index.vue, IncludeContextItem.vue) to the expert chat input, enabling users to choose which context sources (e.g., palette, debug logs) to include in assistant interactions. Chips are displayed horizontally and can be individually toggled. [1] [2] [3] [4]
  • Updated the Vuex store (assistant/index.js, context/index.js) to define available context options, track selected context, and inject palette/debug log data into the context sent to the assistant when selected. [1] [2] [3]

UI/UX improvements:

  • Refined the expert chat input layout for better horizontal scrolling and overflow handling of context chips, improving usability when multiple context items are selected.
  • Refactored the selection button for including user selections to use the new ContextChip component, ensuring consistent appearance and behavior across context and selection chips. [1] [2]

Other minor updates:

  • Fixed a prop name in CapabilitiesSelector.vue for clarity (min-options-width to options-min-width).
  • Added constants and initial state for debug log entries and context options in the assistant store. [1] [2] [3]

Related Issue(s)

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.66%. Comparing base (4341675) to head (1049e43).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6631   +/-   ##
=======================================
  Coverage   76.66%   76.66%           
=======================================
  Files         398      398           
  Lines       20103    20103           
  Branches     4841     4841           
=======================================
  Hits        15411    15411           
  Misses       4692     4692           
Flag Coverage Δ
backend 76.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

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

Copy link
Contributor

@cstns cstns left a comment

Choose a reason for hiding this comment

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

tested locally and working as expected, my notes are mostly nitpicks and enhancements that can be handled in future iterations

@@ -0,0 +1,158 @@
<template>
<div class="context-selector mr-2">
<ff-listbox
Copy link
Contributor

Choose a reason for hiding this comment

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

looking a bit more carefull at the headless ui docs, the popover component would have been better suited for the task because it can be closed dynamically.

not asking for a change, leaving this here for posterity for when we add new items to the context
https://headlessui.com/v1/react/popover#closing-popovers-manually

hasUserSelection: (state) => {
return state.selectedNodes.length
},
hasContextSelection: (state) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Really appreciate the use of getters!

PlusIcon
},
props: {
modelValue: {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure i follow the need for the modelValue prop, we either have the chip or not, we don't need to opt out

Copy link
Contributor

Choose a reason for hiding this comment

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

then again, we could make use of it further down the line when we'll need to pass props to the chips but then the type shouldn't be boolean

if (this.isOperatorAgent) {
return []
}
const sc = this.getSelectedContext
Copy link
Contributor

Choose a reason for hiding this comment

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

why not inline it?

<include-selection-button v-if="hasUserSelection && !isOperatorAgent" />
<context-selector v-if="!isOperatorAgent" />
<div class="context-items-container" @wheel="horizontalScrolling">
<include-context-item v-for="(context, index) in selectedContext" :key="index" :contextItem="context" />
Copy link
Contributor

Choose a reason for hiding this comment

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

scaling this we'd need to move this approach into a for loop to iterate over an object that has the components we'd want to inject as values instead of manually adding them each time we add a new chip

Copy link
Contributor

Choose a reason for hiding this comment

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

but good enough for now, it can pe acted upon later

if (totalEntries > MAX_DEBUG_LOG_ENTRIES) {
const excess = totalEntries - MAX_DEBUG_LOG_ENTRIES
state.debugLog.splice(0, excess)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would have preferred a queue-esque approach, but that's just me nitpicking

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.

Define UI pattern for adding extra context types to the FlowFuse expert, like the 📎

2 participants