mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-05-03 08:50:26 +02:00
Convert string to number
This commit is contained in:
parent
5c39bcd874
commit
36aa5dfe14
@ -42,7 +42,7 @@ export default function DemoAppPage() {
|
||||
|
||||
function NewTaskForm({ handleCreateTask }: { handleCreateTask: typeof createTask }) {
|
||||
const [description, setDescription] = useState<string>('');
|
||||
const [todaysHours, setTodaysHours] = useState<string>('8');
|
||||
const [todaysHours, setTodaysHours] = useState<number>(8);
|
||||
const [response, setResponse] = useState<GeneratedSchedule | null>({
|
||||
mainTasks: [
|
||||
{
|
||||
@ -186,7 +186,7 @@ function NewTaskForm({ handleCreateTask }: { handleCreateTask: typeof createTask
|
||||
max={24}
|
||||
className='min-w-[7rem] text-gray-800/90 text-center font-medium rounded-md border border-gray-200 bg-yellow-50 hover:bg-yellow-100 shadow-md focus:outline-none focus:border-transparent focus:shadow-none duration-200 ease-in-out hover:shadow-none'
|
||||
value={todaysHours}
|
||||
onChange={(e) => setTodaysHours(e.currentTarget.value)}
|
||||
onChange={(e) => setTodaysHours(+e.currentTarget.value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -25,7 +25,7 @@ function setUpOpenAi(): OpenAI {
|
||||
|
||||
//#region Actions
|
||||
const generateGptResponseInputSchema = z.object({
|
||||
hours: z.string().regex(/^\d+(\.\d+)?$/, 'Hours must be a number'),
|
||||
hours: z.number(),
|
||||
});
|
||||
|
||||
type GenerateGptResponseInput = z.infer<typeof generateGptResponseInputSchema>;
|
||||
@ -206,7 +206,7 @@ export const getAllTasksByUser: GetAllTasksByUser<void, Task[]> = async (_args,
|
||||
};
|
||||
//#endregion
|
||||
|
||||
async function generateScheduleWithGpt(tasks: Task[], hours: string): Promise<GeneratedSchedule | null> {
|
||||
async function generateScheduleWithGpt(tasks: Task[], hours: number): Promise<GeneratedSchedule | null> {
|
||||
const parsedTasks = tasks.map(({ description, time }) => ({
|
||||
description,
|
||||
time,
|
||||
|
Loading…
x
Reference in New Issue
Block a user