Skip to content

Commit

Permalink
fix: valueAsNumber for level options
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Mar 13, 2023
1 parent e22b1fd commit dda1ef6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
32 changes: 21 additions & 11 deletions components/PromptOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export function PromptOptions({
getValues,
}: {
// TODO: add types
getValues: UseFormReturn["getValues"];
register: any;
getValues: UseFormReturn["getValues"];
}) {
const shouldShowTimestamp = getValues('showTimestamp');
const shouldShowTimestamp = getValues("showTimestamp");
return (
<div className="mt-6 md:mt-10 grid grid-cols-2 md:grid-cols-3 items-center gap-x-10 gap-y-2 md:gap-y-6">
<div className="mt-6 grid grid-cols-2 items-center gap-x-10 gap-y-2 md:mt-10 md:grid-cols-3 md:gap-y-6">
<label className="relative inline-flex cursor-pointer items-center">
<input
type="checkbox"
Expand Down Expand Up @@ -49,7 +49,9 @@ export function PromptOptions({
{...register("outputLanguage")}
>
{Object.keys(PROMPT_LANGUAGE_MAP).map((k: string) => (
<option value={PROMPT_LANGUAGE_MAP[k]}>{k}</option>
<option key={PROMPT_LANGUAGE_MAP[k]} value={PROMPT_LANGUAGE_MAP[k]}>
{k}
</option>
))}
</select>
</div>
Expand All @@ -60,16 +62,20 @@ export function PromptOptions({
className="mb-2 block text-sm font-medium text-gray-900 dark:text-white"
>
要点个数
<span className="text-gray-500">(≤{getValues("sentenceNumber")})</span>
<span className="text-gray-500">
(≤{getValues("sentenceNumber")})
</span>
</label>
<input
id="sentenceNumber"
type="range"
min={3}
max={10}
step={1}
className="h-2 w-full cursor-pointer accent-black rounded-lg bg-gray-200 dark:bg-gray-700"
{...register("sentenceNumber")}
className="h-2 w-full cursor-pointer rounded-lg bg-gray-200 accent-black dark:bg-gray-700"
{...register("sentenceNumber", {
valueAsNumber: true,
})}
/>
</div>
<div>
Expand All @@ -86,9 +92,11 @@ export function PromptOptions({
min={1}
max={5}
step={1}
className="h-2 w-full cursor-pointer accent-black rounded-lg bg-gray-200 dark:bg-gray-700"
className="h-2 w-full cursor-pointer rounded-lg bg-gray-200 accent-black dark:bg-gray-700"
disabled={shouldShowTimestamp}
{...register("outlineLevel")}
{...register("outlineLevel", {
valueAsNumber: true,
})}
/>
</div>
<div>
Expand All @@ -105,8 +113,10 @@ export function PromptOptions({
min={300}
max={1000}
step={10}
className="h-2 w-full accent-black cursor-pointer rounded-lg bg-gray-200 dark:bg-gray-700"
{...register("detailLevel")}
className="h-2 w-full cursor-pointer rounded-lg bg-gray-200 accent-black dark:bg-gray-700"
{...register("detailLevel", {
valueAsNumber: true,
})}
/>
</div>
</div>
Expand Down
7 changes: 5 additions & 2 deletions pages/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,15 @@ export const Home: NextPage<{
};

return (
<div className="mt-10 w-full sm:mt-40 px-4 lg:px-0">
<div className="mt-10 w-full px-4 sm:mt-40 lg:px-0">
<UsageDescription />
<TypingSlogan />
<UsageAction />
<UserKeyInput value={userKey} onChange={handleApiKeyChange} />
<form onSubmit={handleSubmit(onFormSubmit)} className="grid place-items-center">
<form
onSubmit={handleSubmit(onFormSubmit)}
className="grid place-items-center"
>
<input
type="text"
value={currentVideoUrl}
Expand Down

1 comment on commit dda1ef6

@vercel
Copy link

@vercel vercel bot commented on dda1ef6 Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployment failed with the following error:

Tried to attach Edge Config ecfg_bpimtz9yfzkggkhjr014d3grn9yj, but it does not exist. Remove or update the EDGE_CONFIG environment variable and try again.

Learn More: https://vercel.com/docs/errors#error-list/invalid-edge-config-connection-string

Please sign in to comment.