Skip to content

Commit

Permalink
Feat: AI의 파라미터를 핸들링할 컴포넌트 생성 #52
Browse files Browse the repository at this point in the history
- temperature는 0 ~ 1, repetitionPenalty은 1 ~ 2 사이로 구현
- 일단 화면에서 확인하기 위해서 아직 구현되지 않은 개인 프로필 페이지에 적용
  • Loading branch information
soulchicken committed Oct 31, 2023
1 parent d1e14ed commit 63df3a2
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/components/common/tuneSetting/TuneSetting.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { ChangeEvent, FormEvent, useState } from 'react';
import Button from '../button/Button';

const TuneSetting = () => {
const [temperature, setTemperature] = useState(0.3);
const [repetitionPenalty, setRepetitionPenalty] = useState(1.5);

const temperatureHandler = (e: ChangeEvent<HTMLInputElement>) => {
setTemperature(parseFloat(e.target.value));
};
const repetitionPenaltyHandler = (e: ChangeEvent<HTMLInputElement>) => {
setRepetitionPenalty(parseFloat(e.target.value));
};

const handleSubmit = (e: FormEvent) => {
e.preventDefault();
console.log(temperature, repetitionPenalty);
};

return (
<form onSubmit={handleSubmit}>
<div>
<label htmlFor="temperature">{`Temperature : ${temperature}`}</label>
<input
type="range"
name="temperature"
id="temperature"
value={temperature}
onChange={temperatureHandler}
min="0"
max="0.99"
step="0.01"
/>
</div>
<div>
<label htmlFor="repetitionPenalty">{`Repetition Penalty : ${repetitionPenalty}`}</label>
<input
type="range"
name="repetitionPenalty"
id="repetitionPenalty"
value={repetitionPenalty}
onChange={repetitionPenaltyHandler}
min="1"
max="2"
step="0.01"
/>
</div>
<Button theme="green">Set up</Button>
</form>
);
};
export default TuneSetting;
5 changes: 5 additions & 0 deletions src/pages/profile/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { css } from '@emotion/react';
import BottomNavBar from '@/components/common/bottomNavBar/BottomNavBar';
import SEO from '@/components/common/head/SEO';
import TuneSetting from '@/components/common/tuneSetting/TuneSetting';
import Dialog from '@/components/common/dialog/Dialog';

const Profile = () => (
<>
<SEO title="Profile" />
<Dialog theme="white" closeModal={() => { console.log('모달 클로즈'); }}>
<TuneSetting />
</Dialog>
<section css={pageCSS}>
프로필 기능은 추후 제공될 예정입니다.
</section>
Expand Down

0 comments on commit 63df3a2

Please sign in to comment.