feat: make max-calls of schedule nullable

This commit is contained in:
Acbox
2026-02-02 22:48:06 +08:00
parent 78c6758f34
commit 2b8b537523
6 changed files with 48 additions and 16 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ const ScheduleBody = z.object({
name: z.string().min(1, 'Schedule name is required'),
description: z.string().min(1, 'Schedule description is required'),
pattern: z.string().min(1, 'Schedule pattern is required'),
maxCalls: z.number().optional(),
maxCalls: z.number().nullable().optional(),
command: z.string().min(1, 'Schedule command is required'),
}),
}).and(ChatBody)
+1 -6
View File
@@ -7,17 +7,12 @@ export type ScheduleToolParams = {
}
const ScheduleSchema = z.object({
id: z.string(),
name: z.string(),
description: z.string(),
pattern: z.string(),
max_calls: z.number().nullable().optional(),
current_calls: z.number().optional(),
created_at: z.string().optional(),
updated_at: z.string().optional(),
enabled: z.boolean(),
command: z.string(),
user_id: z.string().optional(),
})
export const getScheduleTools = ({ fetch }: ScheduleToolParams) => {
@@ -47,7 +42,7 @@ export const getScheduleTools = ({ fetch }: ScheduleToolParams) => {
name: z.string(),
description: z.string(),
pattern: z.string(),
max_calls: z.number().optional(),
max_calls: z.number().nullable().optional().default(null).describe('Max calls (optional, empty for unlimited)'),
enabled: z.boolean().optional(),
command: z.string(),
}),
+1 -1
View File
@@ -16,7 +16,7 @@ export interface Schedule {
name: string
description: string
pattern: string
maxCalls?: number
maxCalls?: number | null
command: string
}