mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 19:30:17 +08:00
refactor(types): convert Tool interface to zod schema
Use zod schema for better type safety and validation capabilities
This commit is contained in:
parent
84aab66aa6
commit
62d2da3815
@ -19,12 +19,14 @@ export const isAgentType = (type: unknown): type is AgentType => {
|
||||
|
||||
export type SessionMessageType = TextStreamPart<Record<string, any>>['type']
|
||||
|
||||
export interface Tool {
|
||||
id: string
|
||||
name: string
|
||||
description?: string
|
||||
requirePermissions?: boolean
|
||||
}
|
||||
export const ToolSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
description: z.string().optional(),
|
||||
requirePermissions: z.boolean().optional()
|
||||
})
|
||||
|
||||
export type Tool = z.infer<typeof ToolSchema>
|
||||
|
||||
export const AgentConfigurationSchema = z
|
||||
.object({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user