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 { RunButton } from './RunButton';
|
||||||
import { PresenceBadgeStatus } from '@fluentui/react-badge';
|
import { PresenceBadgeStatus } from '@fluentui/react-badge';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useMediaQuery } from 'usehooks-ts';
|
||||||
|
|
||||||
const statusText = {
|
const statusText = {
|
||||||
[ModelStatus.Offline]: 'Offline',
|
[ModelStatus.Offline]: 'Offline',
|
||||||
@ -23,6 +24,7 @@ const badgeStatus: { [modelStatus: number]: PresenceBadgeStatus } = {
|
|||||||
|
|
||||||
export const WorkHeader: FC = observer(() => {
|
export const WorkHeader: FC = observer(() => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const mq = useMediaQuery('(min-width: 640px)');
|
||||||
const port = commonStore.getCurrentModelConfig().apiParameters.apiPort;
|
const port = commonStore.getCurrentModelConfig().apiParameters.apiPort;
|
||||||
|
|
||||||
return commonStore.platform === 'web' ?
|
return commonStore.platform === 'web' ?
|
||||||
@ -33,6 +35,10 @@ export const WorkHeader: FC = observer(() => {
|
|||||||
<PresenceBadge status={badgeStatus[commonStore.status.status]} />
|
<PresenceBadge status={badgeStatus[commonStore.status.status]} />
|
||||||
<Text size={100}>{t('Model Status') + ': ' + t(statusText[commonStore.status.status])}</Text>
|
<Text size={100}>{t('Model Status') + ': ' + t(statusText[commonStore.status.status])}</Text>
|
||||||
</div>
|
</div>
|
||||||
|
{commonStore.lastModelName && mq &&
|
||||||
|
<Text size={100}>
|
||||||
|
{commonStore.lastModelName}
|
||||||
|
</Text>}
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<ConfigSelector size="small" />
|
<ConfigSelector size="small" />
|
||||||
<RunButton iconMode />
|
<RunButton iconMode />
|
||||||
|
@ -352,6 +352,8 @@ const ChatPanel: FC = observer(() => {
|
|||||||
console.debug('json error', error);
|
console.debug('json error', error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (data.model)
|
||||||
|
commonStore.setLastModelName(data.model);
|
||||||
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
||||||
answer += data.choices[0]?.delta?.content || '';
|
answer += data.choices[0]?.delta?.content || '';
|
||||||
commonStore.conversation[answerId!].content = answer;
|
commonStore.conversation[answerId!].content = answer;
|
||||||
|
@ -114,6 +114,8 @@ const CompletionPanel: FC = observer(() => {
|
|||||||
console.debug('json error', error);
|
console.debug('json error', error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (data.model)
|
||||||
|
commonStore.setLastModelName(data.model);
|
||||||
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
||||||
answer += data.choices[0]?.text || data.choices[0]?.delta?.content || '';
|
answer += data.choices[0]?.text || data.choices[0]?.delta?.content || '';
|
||||||
setPrompt(prompt + answer.replace(/\s+$/, '') + params.injectEnd.replaceAll('\\n', '\n'));
|
setPrompt(prompt + answer.replace(/\s+$/, '') + params.injectEnd.replaceAll('\\n', '\n'));
|
||||||
|
@ -169,6 +169,8 @@ const CompositionPanel: FC = observer(() => {
|
|||||||
console.debug('json error', error);
|
console.debug('json error', error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (data.model)
|
||||||
|
commonStore.setLastModelName(data.model);
|
||||||
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
||||||
answer += data.choices[0]?.text || data.choices[0]?.delta?.content || '';
|
answer += data.choices[0]?.text || data.choices[0]?.delta?.content || '';
|
||||||
setPrompt(prompt + answer.replace(/\s+$/, ''));
|
setPrompt(prompt + answer.replace(/\s+$/, ''));
|
||||||
|
@ -51,6 +51,7 @@ class CommonStore {
|
|||||||
monitorData: MonitorData | null = null;
|
monitorData: MonitorData | null = null;
|
||||||
depComplete: boolean = false;
|
depComplete: boolean = false;
|
||||||
platform: Platform = 'windows';
|
platform: Platform = 'windows';
|
||||||
|
lastModelName: string = '';
|
||||||
// presets manager
|
// presets manager
|
||||||
editingPreset: Preset | null = null;
|
editingPreset: Preset | null = null;
|
||||||
presets: Preset[] = [];
|
presets: Preset[] = [];
|
||||||
@ -232,6 +233,10 @@ class CommonStore {
|
|||||||
this.about = value;
|
this.about = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setLastModelName(value: string) {
|
||||||
|
this.lastModelName = value;
|
||||||
|
}
|
||||||
|
|
||||||
setDepComplete = (value: boolean, inSaveCache: boolean = true) => {
|
setDepComplete = (value: boolean, inSaveCache: boolean = true) => {
|
||||||
this.depComplete = value;
|
this.depComplete = value;
|
||||||
if (inSaveCache)
|
if (inSaveCache)
|
||||||
|
Loading…
Reference in New Issue
Block a user