display lastModelName at the top (WorkHeader)
This commit is contained in:
parent
41e5bd5eb8
commit
66e43c9d9b
@ -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(() => {
|
||||
<PresenceBadge status={badgeStatus[commonStore.status.status]} />
|
||||
<Text size={100}>{t('Model Status') + ': ' + t(statusText[commonStore.status.status])}</Text>
|
||||
</div>
|
||||
{commonStore.lastModelName && mq &&
|
||||
<Text size={100}>
|
||||
{commonStore.lastModelName}
|
||||
</Text>}
|
||||
<div className="flex items-center gap-2">
|
||||
<ConfigSelector size="small" />
|
||||
<RunButton iconMode />
|
||||
|
@ -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;
|
||||
|
@ -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'));
|
||||
|
@ -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+$/, ''));
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user