RWKV-Runner/frontend/src/Pages/Configs.tsx

89 lines
3.8 KiB
TypeScript
Raw Normal View History

2023-05-06 12:17:39 +00:00
import {Button, Divider, Dropdown, Input, Option, Slider, Switch, Text} from '@fluentui/react-components';
import {AddCircle20Regular, DataUsageSettings20Regular, Delete20Regular, Save20Regular} from '@fluentui/react-icons';
2023-05-05 15:23:34 +00:00
import React, {FC} from 'react';
import {Section} from './components/Section';
import {Labeled} from './components/Labeled';
import {ToolTipButton} from './components/ToolTipButton';
2023-05-04 15:55:24 +00:00
2023-05-05 15:23:34 +00:00
export const Configs: FC = () => {
return (
2023-05-06 12:17:39 +00:00
<div className="flex flex-col gap-2 p-2 h-full">
2023-05-05 15:23:34 +00:00
<Text size={600}>Configs</Text>
2023-05-06 12:17:39 +00:00
<Divider/>
<div className="flex gap-2 items-center w-full">
<Dropdown style={{minWidth: 0}} className="grow"/>
<ToolTipButton desc="New Config" icon={<AddCircle20Regular/>}/>
<ToolTipButton desc="Delete Config" icon={<Delete20Regular/>}/>
<ToolTipButton desc="Save Config" icon={<Save20Regular/>}/>
</div>
<div className="flex flex-col h-full gap-2 overflow-y-hidden">
<Section
title="Default API Parameters"
desc="Hover your mouse over the text to view a detailed description. Settings marked with * will take effect immediately after being saved."
content={
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
2023-05-05 15:23:34 +00:00
<Labeled label="API Port" desc="127.0.0.1:8000" content={
<Input type="number" min={1} max={65535} step={1}/>
}/>
<Labeled label="Max Response Token *" content={
2023-05-06 12:17:39 +00:00
<div className="flex items-center grow">
<Slider style={{minWidth: 0}} className="grow" step={400} min={100} max={8100}/>
2023-05-05 15:23:34 +00:00
<Text>1000</Text>
</div>
}/>
<Labeled label="Temperature *" content={
2023-05-06 12:17:39 +00:00
<Slider style={{minWidth: 0}} className="grow"/>
2023-05-05 15:23:34 +00:00
}/>
<Labeled label="Top_P *" content={
2023-05-06 12:17:39 +00:00
<Slider style={{minWidth: 0}} className="grow"/>
2023-05-05 15:23:34 +00:00
}/>
<Labeled label="Presence Penalty *" content={
2023-05-06 12:17:39 +00:00
<Slider style={{minWidth: 0}} className="grow"/>
2023-05-05 15:23:34 +00:00
}/>
<Labeled label="Count Penalty *" content={
2023-05-06 12:17:39 +00:00
<Slider style={{minWidth: 0}} className="grow"/>
2023-05-05 15:23:34 +00:00
}/>
</div>
2023-05-06 12:17:39 +00:00
}
/>
<Section
title="Model Parameters"
content={
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
<Labeled label="Model" content={
<div className="flex gap-2 grow">
<Dropdown style={{minWidth: 0}} className="grow"/>
<ToolTipButton desc="Manage Models" icon={<DataUsageSettings20Regular/>}/>
</div>
}/>
2023-05-06 13:32:14 +00:00
<ToolTipButton text="Convert" desc="Convert model with these configs"/>
2023-05-05 15:23:34 +00:00
<Labeled label="Device" content={
2023-05-06 12:17:39 +00:00
<Dropdown style={{minWidth: 0}} className="grow">
<Option>CPU</Option>
<Option>CUDA: 0</Option>
</Dropdown>
2023-05-05 15:23:34 +00:00
}/>
<Labeled label="Precision" content={
2023-05-06 12:17:39 +00:00
<Dropdown style={{minWidth: 0}} className="grow">
<Option>fp16</Option>
<Option>int8</Option>
<Option>fp32</Option>
</Dropdown>
2023-05-05 15:23:34 +00:00
}/>
<Labeled label="Streamed Layers" content={
2023-05-06 12:17:39 +00:00
<Slider style={{minWidth: 0}} className="grow"/>
2023-05-05 15:23:34 +00:00
}/>
<Labeled label="Enable High Precision For Last Layer" content={
<Switch/>
}/>
</div>
2023-05-06 12:17:39 +00:00
}
/>
</div>
<div className="flex flex-row-reverse sm:fixed bottom-2 right-2">
2023-05-05 15:23:34 +00:00
<Button appearance="primary" size="large">Run</Button>
</div>
</div>
);
2023-05-04 15:55:24 +00:00
};