mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-05-04 01:10:29 +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 }) {
|
function NewTaskForm({ handleCreateTask }: { handleCreateTask: typeof createTask }) {
|
||||||
const [description, setDescription] = useState<string>('');
|
const [description, setDescription] = useState<string>('');
|
||||||
const [todaysHours, setTodaysHours] = useState<string>('8');
|
const [todaysHours, setTodaysHours] = useState<number>(8);
|
||||||
const [response, setResponse] = useState<GeneratedSchedule | null>({
|
const [response, setResponse] = useState<GeneratedSchedule | null>({
|
||||||
mainTasks: [
|
mainTasks: [
|
||||||
{
|
{
|
||||||
@ -186,7 +186,7 @@ function NewTaskForm({ handleCreateTask }: { handleCreateTask: typeof createTask
|
|||||||
max={24}
|
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'
|
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}
|
value={todaysHours}
|
||||||
onChange={(e) => setTodaysHours(e.currentTarget.value)}
|
onChange={(e) => setTodaysHours(+e.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,7 +25,7 @@ function setUpOpenAi(): OpenAI {
|
|||||||
|
|
||||||
//#region Actions
|
//#region Actions
|
||||||
const generateGptResponseInputSchema = z.object({
|
const generateGptResponseInputSchema = z.object({
|
||||||
hours: z.string().regex(/^\d+(\.\d+)?$/, 'Hours must be a number'),
|
hours: z.number(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type GenerateGptResponseInput = z.infer<typeof generateGptResponseInputSchema>;
|
type GenerateGptResponseInput = z.infer<typeof generateGptResponseInputSchema>;
|
||||||
@ -206,7 +206,7 @@ export const getAllTasksByUser: GetAllTasksByUser<void, Task[]> = async (_args,
|
|||||||
};
|
};
|
||||||
//#endregion
|
//#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 }) => ({
|
const parsedTasks = tasks.map(({ description, time }) => ({
|
||||||
description,
|
description,
|
||||||
time,
|
time,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user