diff --git a/frontend/src/components/WorkHeader.tsx b/frontend/src/components/WorkHeader.tsx index a06fdf9..1f3bc95 100644 --- a/frontend/src/components/WorkHeader.tsx +++ b/frontend/src/components/WorkHeader.tsx @@ -6,6 +6,7 @@ import { ConfigSelector } from './ConfigSelector'; import { RunButton } from './RunButton'; import { PresenceBadgeStatus } from '@fluentui/react-badge'; import { useTranslation } from 'react-i18next'; +import { useMediaQuery } from 'usehooks-ts'; const statusText = { [ModelStatus.Offline]: 'Offline', @@ -23,6 +24,7 @@ const badgeStatus: { [modelStatus: number]: PresenceBadgeStatus } = { export const WorkHeader: FC = observer(() => { const { t } = useTranslation(); + const mq = useMediaQuery('(min-width: 640px)'); const port = commonStore.getCurrentModelConfig().apiParameters.apiPort; return commonStore.platform === 'web' ? @@ -33,6 +35,10 @@ export const WorkHeader: FC = observer(() => { {t('Model Status') + ': ' + t(statusText[commonStore.status.status])} + {commonStore.lastModelName && mq && + + {commonStore.lastModelName} + }
diff --git a/frontend/src/pages/Chat.tsx b/frontend/src/pages/Chat.tsx index bd0ed68..c2f2686 100644 --- a/frontend/src/pages/Chat.tsx +++ b/frontend/src/pages/Chat.tsx @@ -352,6 +352,8 @@ const ChatPanel: FC = observer(() => { console.debug('json error', error); return; } + if (data.model) + commonStore.setLastModelName(data.model); if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) { answer += data.choices[0]?.delta?.content || ''; commonStore.conversation[answerId!].content = answer; diff --git a/frontend/src/pages/Completion.tsx b/frontend/src/pages/Completion.tsx index 19a0788..2f1f54e 100644 --- a/frontend/src/pages/Completion.tsx +++ b/frontend/src/pages/Completion.tsx @@ -114,6 +114,8 @@ const CompletionPanel: FC = observer(() => { console.debug('json error', error); return; } + if (data.model) + commonStore.setLastModelName(data.model); if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) { answer += data.choices[0]?.text || data.choices[0]?.delta?.content || ''; setPrompt(prompt + answer.replace(/\s+$/, '') + params.injectEnd.replaceAll('\\n', '\n')); diff --git a/frontend/src/pages/Composition.tsx b/frontend/src/pages/Composition.tsx index 2a916a4..28eee7a 100644 --- a/frontend/src/pages/Composition.tsx +++ b/frontend/src/pages/Composition.tsx @@ -169,6 +169,8 @@ const CompositionPanel: FC = observer(() => { console.debug('json error', error); return; } + if (data.model) + commonStore.setLastModelName(data.model); if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) { answer += data.choices[0]?.text || data.choices[0]?.delta?.content || ''; setPrompt(prompt + answer.replace(/\s+$/, '')); diff --git a/frontend/src/stores/commonStore.ts b/frontend/src/stores/commonStore.ts index 7dc5e9a..cabf84a 100644 --- a/frontend/src/stores/commonStore.ts +++ b/frontend/src/stores/commonStore.ts @@ -51,6 +51,7 @@ class CommonStore { monitorData: MonitorData | null = null; depComplete: boolean = false; platform: Platform = 'windows'; + lastModelName: string = ''; // presets manager editingPreset: Preset | null = null; presets: Preset[] = []; @@ -232,6 +233,10 @@ class CommonStore { this.about = value; }; + setLastModelName(value: string) { + this.lastModelName = value; + } + setDepComplete = (value: boolean, inSaveCache: boolean = true) => { this.depComplete = value; if (inSaveCache)