Skip to content

Commit ed2ec7d

Browse files
fix(lightspeed): disable model selector in active chat sessions
Fixes: https://redhat.atlassian.net/browse/RHDHBUGS-3313 Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d69d6d6 commit ed2ec7d

10 files changed

Lines changed: 40 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-lightspeed': patch
3+
---
4+
5+
Disable model selector in active chat sessions to prevent switching models mid-conversation. A tooltip explains that each session supports only one model.

workspaces/lightspeed/plugins/lightspeed/report-alpha.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ export const lightspeedTranslationRef: TranslationRef<
272272
readonly 'sort.oldest': string;
273273
readonly 'sort.alphabeticalAsc': string;
274274
readonly 'sort.alphabeticalDesc': string;
275+
readonly 'modelSelector.disabled.tooltip': string;
275276
readonly 'reasoning.thinking': string;
276277
}
277278
>;

workspaces/lightspeed/plugins/lightspeed/src/components/LightSpeedChat.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,12 @@ export const LightspeedChat = ({
18051805
onNewChat();
18061806
handleSelectedModel(item);
18071807
}}
1808-
disabled={isSendButtonDisabled}
1808+
disabled={isSendButtonDisabled || messages.length > 0}
1809+
disabledTooltip={
1810+
messages.length > 0
1811+
? t('modelSelector.disabled.tooltip')
1812+
: undefined
1813+
}
18091814
/>
18101815
}
18111816
forceMultilineLayout

workspaces/lightspeed/plugins/lightspeed/src/components/MessageBarModelSelector.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
DropdownList,
2424
MenuToggle,
2525
MenuToggleElement,
26+
Tooltip,
2627
} from '@patternfly/react-core';
2728
import { AngleDownIcon } from '@patternfly/react-icons';
2829

@@ -33,6 +34,7 @@ type MessageBarModelSelectorProps = {
3334
models: { label: string; value: string; provider: string }[];
3435
onSelect: (model: string) => void;
3536
disabled?: boolean;
37+
disabledTooltip?: string;
3638
};
3739

3840
const useStyles = makeStyles(theme => ({
@@ -69,6 +71,7 @@ export const MessageBarModelSelector = ({
6971
models,
7072
onSelect,
7173
disabled = false,
74+
disabledTooltip,
7275
}: MessageBarModelSelectorProps) => {
7376
const [isOpen, setIsOpen] = useState(false);
7477
const classes = useStyles();
@@ -92,7 +95,7 @@ export const MessageBarModelSelector = ({
9295
</MenuToggle>
9396
);
9497

95-
return (
98+
const dropdown = (
9699
<Dropdown
97100
className={classes.dropdown}
98101
isOpen={isOpen}
@@ -121,4 +124,14 @@ export const MessageBarModelSelector = ({
121124
</DropdownList>
122125
</Dropdown>
123126
);
127+
128+
if (disabled && disabledTooltip) {
129+
return (
130+
<Tooltip content={disabledTooltip}>
131+
<span style={{ cursor: 'not-allowed' }}>{dropdown}</span>
132+
</Tooltip>
133+
);
134+
}
135+
136+
return dropdown;
124137
};

workspaces/lightspeed/plugins/lightspeed/src/translations/de.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ const lightspeedTranslationDe = createTranslationMessages({
177177
'modal.save': 'Speichern',
178178
'modal.title.edit': 'Anhang bearbeiten',
179179
'modal.title.preview': 'Anhang in der Vorschau anzeigen',
180+
'modelSelector.disabled.tooltip':
181+
'Jede Chat-Sitzung unterstützt nur ein Modell. Um das Modell zu wechseln, starten Sie einen neuen Chat.',
180182
'notebook.document.delete': 'Löschen',
181183
'notebook.document.delete.action': 'Entfernen',
182184
'notebook.document.delete.description':

workspaces/lightspeed/plugins/lightspeed/src/translations/es.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ const lightspeedTranslationEs = createTranslationMessages({
173173
'modal.save': 'Guardar',
174174
'modal.title.edit': 'Modificar archivo adjunto',
175175
'modal.title.preview': 'Previsualizar archivo adjunto',
176+
'modelSelector.disabled.tooltip':
177+
'Cada sesión de chat solo admite un modelo. Para cambiar de modelo, abra un nuevo chat.',
176178
'notebook.document.delete': 'Eliminar',
177179
'notebook.document.delete.action': 'Eliminar',
178180
'notebook.document.delete.description':

workspaces/lightspeed/plugins/lightspeed/src/translations/fr.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ const lightspeedTranslationFr = createTranslationMessages({
177177
'modal.save': 'Sauvegarder',
178178
'modal.title.edit': 'Modifier la pièce jointe',
179179
'modal.title.preview': 'Aperçu de la pièce jointe',
180+
'modelSelector.disabled.tooltip':
181+
"Chaque session de chat ne prend en charge qu'un seul modèle. Pour changer de modèle, ouvrez un nouveau chat.",
180182
'notebook.document.delete': 'Supprimer',
181183
'notebook.document.delete.action': 'Supprimer',
182184
'notebook.document.delete.description':

workspaces/lightspeed/plugins/lightspeed/src/translations/it.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ const lightspeedTranslationIt = createTranslationMessages({
175175
'modal.save': 'Salva',
176176
'modal.title.edit': 'Modifica allegato',
177177
'modal.title.preview': 'Anteprima allegato',
178+
'modelSelector.disabled.tooltip':
179+
'Ogni sessione di chat supporta un solo modello. Per cambiare modello, apri una nuova chat.',
178180
'notebook.document.delete': 'Elimina',
179181
'notebook.document.delete.action': 'Rimuovi',
180182
'notebook.document.delete.description':

workspaces/lightspeed/plugins/lightspeed/src/translations/ja.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ const lightspeedTranslationJa = createTranslationMessages({
172172
'modal.save': '保存',
173173
'modal.title.edit': '添付ファイルの編集',
174174
'modal.title.preview': '添付ファイルのプレビュー',
175+
'modelSelector.disabled.tooltip':
176+
'各チャットセッションは1つのモデルのみサポートしています。モデルを切り替えるには、新しいチャットを開いてください。',
175177
'notebook.document.delete': '削除',
176178
'notebook.document.delete.action': '削除',
177179
'notebook.document.delete.description':

workspaces/lightspeed/plugins/lightspeed/src/translations/ref.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ export const lightspeedMessages = {
393393
'sort.oldest': 'Date (oldest first)',
394394
'sort.alphabeticalAsc': 'Name (A-Z)',
395395
'sort.alphabeticalDesc': 'Name (Z-A)',
396+
// Model selector
397+
'modelSelector.disabled.tooltip':
398+
'Each chat session supports only one model. To switch models, open a new chat.',
399+
396400
// Deep thinking
397401
'reasoning.thinking': 'Show thinking',
398402
};

0 commit comments

Comments
 (0)