Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(plugins): the no-chat reason of Persona and Group chat sits on the switch, rows stay one line

purple655414b5343b
diff --git a/src/components/chat/PluginRow.tsx b/src/components/chat/PluginRow.tsx
index 2f1a0527..14f1f302 100644
--- a/src/components/chat/PluginRow.tsx
+++ b/src/components/chat/PluginRow.tsx
@@ -69,6 +69,7 @@ export function PluginRow({
on,
available = true,
reason,
+ reasonInline = true,
onToggle,
switchLabel,
switchTitle,
@@ -89,6 +90,9 @@ export function PluginRow({
available?: boolean
/** Why the switch is grey; shown under the row while it is. */
reason?: string
+ /** false: the reason only as the switch's tooltip, the row stays one line
+ * (a plain "open a chat first" is no news worth a line). */
+ reasonInline?: boolean
onToggle: () => void
switchLabel: string
switchTitle?: string
@@ -117,7 +121,7 @@ export function PluginRow({
testId={switchTestId}
/>
</div>
- {!available && reason && (
+ {!available && reason && reasonInline && (
// A reason, not an error: the calm grey of lib/hinweis.ts.
<div data-testid={`${testId}-reason`} className={`pb-1.5 t-micro leading-snug ${HINWEIS_TEXT.ruhig}`}>
{reason}
diff --git a/src/components/chat/PluginsDropdown.tsx b/src/components/chat/PluginsDropdown.tsx
index f87ca551..f466dfd4 100644
--- a/src/components/chat/PluginsDropdown.tsx
+++ b/src/components/chat/PluginsDropdown.tsx
@@ -31,9 +31,9 @@ export const CREATE_GROUP_REASON = 'Not available in a group chat.'
const ReaPluginRow = lazy(() => import('./ReaPluginRow').then((m) => ({ default: m.ReaPluginRow })))
/** A persona switch without an open chat has nothing to hold its state. */
-export const PERSONA_NO_CHAT_REASON = 'Open a chat first, the persona lives on the conversation.'
+export const PERSONA_NO_CHAT_REASON = 'Open a chat first: the persona is set per chat.'
/** Group chat without an open chat, the same. */
-export const GROUP_NO_CHAT_REASON = 'Open a chat first, the group lives on the conversation.'
+export const GROUP_NO_CHAT_REASON = 'Open a chat first: a group is set per chat.'
type CavemanLevel = Exclude<CavemanMode, 'off'>
@@ -320,6 +320,7 @@ export function PluginsDropdown({
on={personaEnabledOnChat}
available={!!activeConvId}
reason={PERSONA_NO_CHAT_REASON}
+ reasonInline={false}
onToggle={() => { if (activeConvId) setConversationPersonaEnabled(activeConvId, !personaEnabledOnChat) }}
switchLabel="Persona"
switchTestId="plugins-persona-switch"
@@ -368,6 +369,7 @@ export function PluginsDropdown({
on={!!activeConvId && groupOn}
available={!!activeConvId}
reason={GROUP_NO_CHAT_REASON}
+ reasonInline={false}
onToggle={() => {
if (!activeConvId) return
if (groupOn) { setPersonaFor(null); setGroupArmed(false); setGroupModels(activeConvId, []) }
diff --git a/src/components/chat/__tests__/every-plugin-has-its-switch.test.tsx b/src/components/chat/__tests__/every-plugin-has-its-switch.test.tsx
index bc706901..431f38a5 100644
--- a/src/components/chat/__tests__/every-plugin-has-its-switch.test.tsx
+++ b/src/components/chat/__tests__/every-plugin-has-its-switch.test.tsx
@@ -116,13 +116,15 @@ describe('every plugin row has the switch at its right end', () => {
expect(body('persona')).toBeNull()
})
- it('Persona and Group chat without an open chat: grey, with the reason', () => {
+ it('Persona and Group chat without an open chat: grey, the reason on the switch, the row one line', () => {
useChatStore.setState({ activeConversationId: null })
openMenu()
- expect((switchOf('persona') as HTMLButtonElement).disabled).toBe(true)
- expect(screen.getByTestId('plugins-persona-reason').textContent).toBe(PERSONA_NO_CHAT_REASON)
- expect((switchOf('group') as HTMLButtonElement).disabled).toBe(true)
- expect(screen.getByTestId('plugins-group-reason').textContent).toBe(GROUP_NO_CHAT_REASON)
+ for (const [id, why] of [['persona', PERSONA_NO_CHAT_REASON], ['group', GROUP_NO_CHAT_REASON]]) {
+ const sw = switchOf(id) as HTMLButtonElement
+ expect(sw.disabled).toBe(true)
+ expect(sw.title).toBe(why)
+ expect(screen.queryByTestId(`plugins-${id}-reason`)).toBeNull()
+ }
})
it('Group chat: on opens the list, off ends the group', () => {