mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-06 02:46:40 +00:00
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com> Co-authored-by: 谨欣 <echo.cmy@antgroup.com> Co-authored-by: 严志勇 <yanzhiyong@tiansuixiansheng.com> Co-authored-by: yanzhiyong <932374019@qq.com>
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import IconFont from '@/new-components/common/Icon';
|
|
import { Dropdown, Slider } from 'antd';
|
|
import React, { useContext } from 'react';
|
|
import { MobileChatContext } from '../';
|
|
|
|
const Thermometer: React.FC = () => {
|
|
const { temperature, setTemperature } = useContext(MobileChatContext);
|
|
|
|
// temperature变化;
|
|
const onChange = (value: any) => {
|
|
if (isNaN(value)) {
|
|
return;
|
|
}
|
|
setTemperature(value);
|
|
};
|
|
|
|
return (
|
|
<Dropdown
|
|
trigger={['click']}
|
|
dropdownRender={() => {
|
|
return (
|
|
<div className='flex h-28 bg-white dark:bg-[rgba(255,255,255,0.5)] items-center justify-center rounded-xl py-3'>
|
|
<Slider
|
|
defaultValue={0.5}
|
|
max={1.0}
|
|
min={0.0}
|
|
step={0.1}
|
|
vertical={true}
|
|
onChange={onChange}
|
|
value={temperature}
|
|
/>
|
|
</div>
|
|
);
|
|
}}
|
|
placement='top'
|
|
>
|
|
<div className='flex items-center justify-between border rounded-xl bg-white dark:bg-black w-14 p-2 flex-shrink-0'>
|
|
<IconFont type='icon-icons-temperature' className='text-sm' />
|
|
<span className='text-xs font-medium'>{temperature}</span>
|
|
</div>
|
|
</Dropdown>
|
|
);
|
|
};
|
|
|
|
export default Thermometer;
|