Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions workspaces/lightspeed/.changeset/gentle-models-lock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@red-hat-developer-hub/backstage-plugin-lightspeed': patch
---

Disable model selector in active chat sessions to prevent switching models mid-conversation. A tooltip explains that each session supports only one model.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export const lightspeedTranslationRef: TranslationRef<
readonly 'sort.oldest': string;
readonly 'sort.alphabeticalAsc': string;
readonly 'sort.alphabeticalDesc': string;
readonly 'modelSelector.disabled.tooltip': string;
readonly 'reasoning.thinking': string;
}
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,12 @@ export const LightspeedChat = ({
onNewChat();
handleSelectedModel(item);
}}
disabled={isSendButtonDisabled}
disabled={isSendButtonDisabled || messages.length > 0}
disabledTooltip={
messages.length > 0
? t('modelSelector.disabled.tooltip')
: undefined
}
/>
}
forceMultilineLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
DropdownList,
MenuToggle,
MenuToggleElement,
Tooltip,
} from '@patternfly/react-core';
import { AngleDownIcon } from '@patternfly/react-icons';

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

const useStyles = makeStyles(theme => ({
Expand Down Expand Up @@ -69,6 +71,7 @@ export const MessageBarModelSelector = ({
models,
onSelect,
disabled = false,
disabledTooltip,
}: MessageBarModelSelectorProps) => {
const [isOpen, setIsOpen] = useState(false);
const classes = useStyles();
Expand All @@ -92,7 +95,7 @@ export const MessageBarModelSelector = ({
</MenuToggle>
);

return (
const dropdown = (
<Dropdown
className={classes.dropdown}
isOpen={isOpen}
Expand Down Expand Up @@ -121,4 +124,14 @@ export const MessageBarModelSelector = ({
</DropdownList>
</Dropdown>
);

if (disabled && disabledTooltip) {
return (
<Tooltip content={disabledTooltip}>
<span style={{ cursor: 'not-allowed' }}>{dropdown}</span>
</Tooltip>
);
}

return dropdown;
};
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ const lightspeedTranslationDe = createTranslationMessages({
'modal.save': 'Speichern',
'modal.title.edit': 'Anhang bearbeiten',
'modal.title.preview': 'Anhang in der Vorschau anzeigen',
'modelSelector.disabled.tooltip':
'Jede Chat-Sitzung unterstützt nur ein Modell. Um das Modell zu wechseln, starten Sie einen neuen Chat.',
'notebook.document.delete': 'Löschen',
'notebook.document.delete.action': 'Entfernen',
'notebook.document.delete.description':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ const lightspeedTranslationEs = createTranslationMessages({
'modal.save': 'Guardar',
'modal.title.edit': 'Modificar archivo adjunto',
'modal.title.preview': 'Previsualizar archivo adjunto',
'modelSelector.disabled.tooltip':
'Cada sesión de chat solo admite un modelo. Para cambiar de modelo, abra un nuevo chat.',
'notebook.document.delete': 'Eliminar',
'notebook.document.delete.action': 'Eliminar',
'notebook.document.delete.description':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ const lightspeedTranslationFr = createTranslationMessages({
'modal.save': 'Sauvegarder',
'modal.title.edit': 'Modifier la pièce jointe',
'modal.title.preview': 'Aperçu de la pièce jointe',
'modelSelector.disabled.tooltip':
"Chaque session de chat ne prend en charge qu'un seul modèle. Pour changer de modèle, ouvrez un nouveau chat.",
'notebook.document.delete': 'Supprimer',
'notebook.document.delete.action': 'Supprimer',
'notebook.document.delete.description':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ const lightspeedTranslationIt = createTranslationMessages({
'modal.save': 'Salva',
'modal.title.edit': 'Modifica allegato',
'modal.title.preview': 'Anteprima allegato',
'modelSelector.disabled.tooltip':
'Ogni sessione di chat supporta un solo modello. Per cambiare modello, apri una nuova chat.',
'notebook.document.delete': 'Elimina',
'notebook.document.delete.action': 'Rimuovi',
'notebook.document.delete.description':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ const lightspeedTranslationJa = createTranslationMessages({
'modal.save': '保存',
'modal.title.edit': '添付ファイルの編集',
'modal.title.preview': '添付ファイルのプレビュー',
'modelSelector.disabled.tooltip':
'各チャットセッションは1つのモデルのみサポートしています。モデルを切り替えるには、新しいチャットを開いてください。',
'notebook.document.delete': '削除',
'notebook.document.delete.action': '削除',
'notebook.document.delete.description':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ export const lightspeedMessages = {
'sort.oldest': 'Date (oldest first)',
'sort.alphabeticalAsc': 'Name (A-Z)',
'sort.alphabeticalDesc': 'Name (Z-A)',
// Model selector
'modelSelector.disabled.tooltip':
'Each chat session supports only one model. To switch models, open a new chat.',

// Deep thinking
'reasoning.thinking': 'Show thinking',
};
Expand Down
Loading