add strategy guides

This commit is contained in:
josc146 2023-06-03 20:18:57 +08:00
parent ced0966ffc
commit 6b9ec4c6fa
6 changed files with 24 additions and 8 deletions

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

View File

@ -5,17 +5,23 @@ import classnames from 'classnames';
export const Labeled: FC<{ export const Labeled: FC<{
label: string; label: string;
desc?: string | null, desc?: string | null,
descComponent?: ReactElement,
content: ReactElement, content: ReactElement,
flex?: boolean, flex?: boolean,
spaceBetween?: boolean, spaceBetween?: boolean,
breakline?: boolean breakline?: boolean,
onMouseEnter?: () => void
onMouseLeave?: () => void
}> = ({ }> = ({
label, label,
desc, desc,
descComponent,
content, content,
flex, flex,
spaceBetween, spaceBetween,
breakline breakline,
onMouseEnter,
onMouseLeave
}) => { }) => {
return ( return (
<div className={classnames( <div className={classnames(
@ -24,11 +30,11 @@ export const Labeled: FC<{
breakline ? 'flex-col' : '', breakline ? 'flex-col' : '',
spaceBetween && 'justify-between') spaceBetween && 'justify-between')
}> }>
{desc ? {(desc || descComponent) ?
<Tooltip content={desc} showDelay={0} hideDelay={0} relationship="description"> <Tooltip content={descComponent ? descComponent : desc!} showDelay={0} hideDelay={0} relationship="description">
<Label>{label}</Label> <Label onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>{label}</Label>
</Tooltip> : </Tooltip> :
<Label>{label}</Label> <Label onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>{label}</Label>
} }
{content} {content}
</div> </div>

View File

@ -7,7 +7,7 @@ import { v4 as uuid } from 'uuid';
import classnames from 'classnames'; import classnames from 'classnames';
import { fetchEventSource } from '@microsoft/fetch-event-source'; import { fetchEventSource } from '@microsoft/fetch-event-source';
import { ConversationPair, getConversationPairs, Record } from '../utils/get-conversation-pairs'; import { ConversationPair, getConversationPairs, Record } from '../utils/get-conversation-pairs';
import logo from '../../../build/appicon.jpg'; import logo from '../assets/images/logo.jpg';
import MarkdownRender from '../components/MarkdownRender'; import MarkdownRender from '../components/MarkdownRender';
import { ToolTipButton } from '../components/ToolTipButton'; import { ToolTipButton } from '../components/ToolTipButton';
import { ArrowCircleUp28Regular, Delete28Regular, RecordStop28Regular } from '@fluentui/react-icons'; import { ArrowCircleUp28Regular, Delete28Regular, RecordStop28Regular } from '@fluentui/react-icons';

View File

@ -39,6 +39,8 @@ import { ConvertModel, FileExists } from '../../wailsjs/go/backend_golang/App';
import { getStrategy, refreshLocalModels } from '../utils'; import { getStrategy, refreshLocalModels } from '../utils';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { WindowShow } from '../../wailsjs/runtime/runtime'; import { WindowShow } from '../../wailsjs/runtime/runtime';
import strategyImg from '../assets/images/strategy.jpg';
import strategyZhImg from '../assets/images/strategy_zh.jpg';
export type ApiParameters = { export type ApiParameters = {
apiPort: number apiPort: number
@ -633,6 +635,7 @@ export const Configs: FC = observer(() => {
const { t } = useTranslation(); const { t } = useTranslation();
const [selectedIndex, setSelectedIndex] = React.useState(commonStore.currentModelConfigIndex); const [selectedIndex, setSelectedIndex] = React.useState(commonStore.currentModelConfigIndex);
const [selectedConfig, setSelectedConfig] = React.useState(commonStore.modelConfigs[selectedIndex]); const [selectedConfig, setSelectedConfig] = React.useState(commonStore.modelConfigs[selectedIndex]);
const [displayStrategyImg, setDisplayStrategyImg] = React.useState(false);
const navigate = useNavigate(); const navigate = useNavigate();
const port = selectedConfig.apiParameters.apiPort; const port = selectedConfig.apiParameters.apiPort;
@ -928,9 +931,16 @@ export const Configs: FC = observer(() => {
}} /> }} />
} /> } />
} }
{
displayStrategyImg &&
<img style={{ width: '80vh', height: 'auto', zIndex: 100 }} className="fixed left-0 top-0"
src={commonStore.settings.language === 'zh' ? strategyZhImg : strategyImg} />
}
{ {
selectedConfig.modelParameters.device == 'Custom' && selectedConfig.modelParameters.device == 'Custom' &&
<Labeled label="Strategy" desc="https://github.com/BlinkDL/ChatRWKV/blob/main/ChatRWKV-strategy.png" <Labeled label="Strategy"
onMouseEnter={() => setDisplayStrategyImg(true)}
onMouseLeave={() => setDisplayStrategyImg(false)}
content={ content={
<Input className="grow" placeholder="cuda:0 fp16 *20 -> cuda:1 fp16" <Input className="grow" placeholder="cuda:0 fp16 *20 -> cuda:1 fp16"
value={selectedConfig.modelParameters.customStrategy} value={selectedConfig.modelParameters.customStrategy}