refactor: remove ai-sdk

This commit is contained in:
Simon
2025-10-17 18:43:41 +08:00
parent 16694ee86a
commit 6f332aa24a
12 changed files with 510 additions and 340 deletions

21
src/llms/utils.ts Normal file
View File

@@ -0,0 +1,21 @@
/**
* Utility functions for LLM integration
*/
import { z } from 'zod'
import type { Tool } from './types'
/**
* Convert Zod schema to OpenAI tool format
* Uses Zod 4 native z.toJSONSchema()
*/
export function zodToOpenAITool(name: string, tool: Tool) {
return {
type: 'function' as const,
function: {
name,
description: tool.description,
parameters: z.toJSONSchema(tool.inputSchema, { target: 'openapi-3.0' }),
},
}
}