diff --git a/apps/sim/blocks/blocks.test.ts b/apps/sim/blocks/blocks.test.ts index 9f668aab81..0fd58168f7 100644 --- a/apps/sim/blocks/blocks.test.ts +++ b/apps/sim/blocks/blocks.test.ts @@ -435,7 +435,7 @@ describe.concurrent('Blocks Module', () => { describe('Input/Output Validation', () => { it('should have valid input types', () => { - const validTypes = ['string', 'number', 'boolean', 'json', 'array'] + const validTypes = ['string', 'number', 'boolean', 'json', 'array', 'file'] const blocks = getAllBlocks() for (const block of blocks) { for (const [_, inputConfig] of Object.entries(block.inputs)) { diff --git a/apps/sim/blocks/blocks/quiver.ts b/apps/sim/blocks/blocks/quiver.ts index 689a47d971..4f09fb0c37 100644 --- a/apps/sim/blocks/blocks/quiver.ts +++ b/apps/sim/blocks/blocks/quiver.ts @@ -190,25 +190,25 @@ export const QuiverBlock: BlockConfig = { const normalizedImage = normalizeFileInput(image, { single: true }) return { - ...rest, - ...(normalizedRefs && { references: normalizedRefs }), - ...(normalizedImage && { image: normalizedImage }), - ...(rest.n && { n: Number(rest.n) }), - ...(rest.temperature && { temperature: Number(rest.temperature) }), - ...(topP && { top_p: Number(topP) }), - ...(maxOutputTokens && { max_output_tokens: Number(maxOutputTokens) }), - ...(presencePenalty && { presence_penalty: Number(presencePenalty) }), - ...(targetSize && { target_size: Number(targetSize) }), - ...(autoCrop === 'true' && { auto_crop: true }), + ...(rest as Record), + ...(normalizedRefs ? { references: normalizedRefs } : {}), + ...(normalizedImage ? { image: normalizedImage } : {}), + ...(rest.n ? { n: Number(rest.n) } : {}), + ...(rest.temperature ? { temperature: Number(rest.temperature) } : {}), + ...(topP ? { top_p: Number(topP) } : {}), + ...(maxOutputTokens ? { max_output_tokens: Number(maxOutputTokens) } : {}), + ...(presencePenalty ? { presence_penalty: Number(presencePenalty) } : {}), + ...(targetSize ? { target_size: Number(targetSize) } : {}), + ...(autoCrop === 'true' ? { auto_crop: true } : {}), } }, }, }, inputs: { - prompt: { type: 'string', required: false }, - instructions: { type: 'string', required: false }, - references: { type: 'file', required: false }, - image: { type: 'file', required: false }, + prompt: { type: 'string' }, + instructions: { type: 'string' }, + references: { type: 'file' }, + image: { type: 'file' }, }, outputs: { file: { @@ -230,22 +230,10 @@ export const QuiverBlock: BlockConfig = { usage: { type: 'json', description: 'Token usage statistics', - properties: { - totalTokens: { type: 'number', description: 'Total tokens used' }, - inputTokens: { type: 'number', description: 'Input tokens used' }, - outputTokens: { type: 'number', description: 'Output tokens used' }, - }, }, models: { type: 'json', description: 'List of available models (list_models operation only)', - optional: true, - properties: { - id: { type: 'string', description: 'Model identifier' }, - name: { type: 'string', description: 'Human-readable model name' }, - description: { type: 'string', description: 'Model capabilities summary' }, - supportedOperations: { type: 'json', description: 'Available operations' }, - }, }, }, } diff --git a/apps/sim/blocks/types.ts b/apps/sim/blocks/types.ts index 0e02b26a17..cfed6eeb7b 100644 --- a/apps/sim/blocks/types.ts +++ b/apps/sim/blocks/types.ts @@ -3,7 +3,7 @@ import type { SelectorKey } from '@/hooks/selectors/types' import type { ToolResponse } from '@/tools/types' export type BlockIcon = (props: SVGProps) => JSX.Element -export type ParamType = 'string' | 'number' | 'boolean' | 'json' | 'array' +export type ParamType = 'string' | 'number' | 'boolean' | 'json' | 'array' | 'file' export type PrimitiveValueType = | 'string' | 'number' diff --git a/apps/sim/lib/uploads/utils/file-schemas.ts b/apps/sim/lib/uploads/utils/file-schemas.ts index b010a99b63..36d85ba8a2 100644 --- a/apps/sim/lib/uploads/utils/file-schemas.ts +++ b/apps/sim/lib/uploads/utils/file-schemas.ts @@ -47,6 +47,8 @@ export const RawFileInputSchema = z { message: 'File path must reference an uploaded file' } ) +export type RawFileInput = z.infer + export const RawFileInputArraySchema = z.array(RawFileInputSchema) export const FileInputSchema = z.union([RawFileInputSchema, z.string()]) diff --git a/apps/sim/tools/quiver/image_to_svg.ts b/apps/sim/tools/quiver/image_to_svg.ts index ec05c4b20d..ffdcdddcd9 100644 --- a/apps/sim/tools/quiver/image_to_svg.ts +++ b/apps/sim/tools/quiver/image_to_svg.ts @@ -67,6 +67,7 @@ export const quiverImageToSvgTool: ToolConfig ({ 'Content-Type': 'application/json' }), body: (params) => ({ apiKey: params.apiKey, model: params.model, diff --git a/apps/sim/tools/quiver/text_to_svg.ts b/apps/sim/tools/quiver/text_to_svg.ts index 200d7778e7..cb3599feb5 100644 --- a/apps/sim/tools/quiver/text_to_svg.ts +++ b/apps/sim/tools/quiver/text_to_svg.ts @@ -73,6 +73,7 @@ export const quiverTextToSvgTool: ToolConfig ({ 'Content-Type': 'application/json' }), body: (params) => ({ apiKey: params.apiKey, prompt: params.prompt,