Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/sim/blocks/blocks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
40 changes: 14 additions & 26 deletions apps/sim/blocks/blocks/quiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,25 +190,25 @@ export const QuiverBlock: BlockConfig<QuiverSvgResponse> = {
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<string, unknown>),
...(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: {
Expand All @@ -230,22 +230,10 @@ export const QuiverBlock: BlockConfig<QuiverSvgResponse> = {
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' },
},
},
},
}
2 changes: 1 addition & 1 deletion apps/sim/blocks/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { SelectorKey } from '@/hooks/selectors/types'
import type { ToolResponse } from '@/tools/types'

export type BlockIcon = (props: SVGProps<SVGSVGElement>) => JSX.Element
export type ParamType = 'string' | 'number' | 'boolean' | 'json' | 'array'
export type ParamType = 'string' | 'number' | 'boolean' | 'json' | 'array' | 'file'
export type PrimitiveValueType =
| 'string'
| 'number'
Expand Down
2 changes: 2 additions & 0 deletions apps/sim/lib/uploads/utils/file-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export const RawFileInputSchema = z
{ message: 'File path must reference an uploaded file' }
)

export type RawFileInput = z.infer<typeof RawFileInputSchema>

export const RawFileInputArraySchema = z.array(RawFileInputSchema)

export const FileInputSchema = z.union([RawFileInputSchema, z.string()])
1 change: 1 addition & 0 deletions apps/sim/tools/quiver/image_to_svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const quiverImageToSvgTool: ToolConfig<QuiverImageToSvgParams, QuiverSvgR
request: {
url: '/api/tools/quiver/image-to-svg',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
apiKey: params.apiKey,
model: params.model,
Expand Down
1 change: 1 addition & 0 deletions apps/sim/tools/quiver/text_to_svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const quiverTextToSvgTool: ToolConfig<QuiverTextToSvgParams, QuiverSvgRes
request: {
url: '/api/tools/quiver/text-to-svg',
method: 'POST',
headers: () => ({ 'Content-Type': 'application/json' }),
body: (params) => ({
apiKey: params.apiKey,
prompt: params.prompt,
Expand Down
Loading