diff --git a/template/app/src/demo-ai-app/DemoAppPage.tsx b/template/app/src/demo-ai-app/DemoAppPage.tsx index a14dc54..75d5e6d 100644 --- a/template/app/src/demo-ai-app/DemoAppPage.tsx +++ b/template/app/src/demo-ai-app/DemoAppPage.tsx @@ -42,7 +42,7 @@ export default function DemoAppPage() { function NewTaskForm({ handleCreateTask }: { handleCreateTask: typeof createTask }) { const [description, setDescription] = useState(''); - const [todaysHours, setTodaysHours] = useState('8'); + const [todaysHours, setTodaysHours] = useState(8); const [response, setResponse] = useState({ 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)} /> diff --git a/template/app/src/demo-ai-app/operations.ts b/template/app/src/demo-ai-app/operations.ts index 29c8bfe..a9c1039 100644 --- a/template/app/src/demo-ai-app/operations.ts +++ b/template/app/src/demo-ai-app/operations.ts @@ -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; @@ -206,7 +206,7 @@ export const getAllTasksByUser: GetAllTasksByUser = async (_args, }; //#endregion -async function generateScheduleWithGpt(tasks: Task[], hours: string): Promise { +async function generateScheduleWithGpt(tasks: Task[], hours: number): Promise { const parsedTasks = tasks.map(({ description, time }) => ({ description, time,