Skip to content

Commit 5e53757

Browse files
authored
fix(quiver): build fail (#3730)
* Fix test * Fix schema * Fix test * Fix * Fix
1 parent 775daed commit 5e53757

File tree

6 files changed

+20
-28
lines changed

6 files changed

+20
-28
lines changed

apps/sim/blocks/blocks.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ describe.concurrent('Blocks Module', () => {
435435

436436
describe('Input/Output Validation', () => {
437437
it('should have valid input types', () => {
438-
const validTypes = ['string', 'number', 'boolean', 'json', 'array']
438+
const validTypes = ['string', 'number', 'boolean', 'json', 'array', 'file']
439439
const blocks = getAllBlocks()
440440
for (const block of blocks) {
441441
for (const [_, inputConfig] of Object.entries(block.inputs)) {

apps/sim/blocks/blocks/quiver.ts

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -190,25 +190,25 @@ export const QuiverBlock: BlockConfig<QuiverSvgResponse> = {
190190
const normalizedImage = normalizeFileInput(image, { single: true })
191191

192192
return {
193-
...rest,
194-
...(normalizedRefs && { references: normalizedRefs }),
195-
...(normalizedImage && { image: normalizedImage }),
196-
...(rest.n && { n: Number(rest.n) }),
197-
...(rest.temperature && { temperature: Number(rest.temperature) }),
198-
...(topP && { top_p: Number(topP) }),
199-
...(maxOutputTokens && { max_output_tokens: Number(maxOutputTokens) }),
200-
...(presencePenalty && { presence_penalty: Number(presencePenalty) }),
201-
...(targetSize && { target_size: Number(targetSize) }),
202-
...(autoCrop === 'true' && { auto_crop: true }),
193+
...(rest as Record<string, unknown>),
194+
...(normalizedRefs ? { references: normalizedRefs } : {}),
195+
...(normalizedImage ? { image: normalizedImage } : {}),
196+
...(rest.n ? { n: Number(rest.n) } : {}),
197+
...(rest.temperature ? { temperature: Number(rest.temperature) } : {}),
198+
...(topP ? { top_p: Number(topP) } : {}),
199+
...(maxOutputTokens ? { max_output_tokens: Number(maxOutputTokens) } : {}),
200+
...(presencePenalty ? { presence_penalty: Number(presencePenalty) } : {}),
201+
...(targetSize ? { target_size: Number(targetSize) } : {}),
202+
...(autoCrop === 'true' ? { auto_crop: true } : {}),
203203
}
204204
},
205205
},
206206
},
207207
inputs: {
208-
prompt: { type: 'string', required: false },
209-
instructions: { type: 'string', required: false },
210-
references: { type: 'file', required: false },
211-
image: { type: 'file', required: false },
208+
prompt: { type: 'string' },
209+
instructions: { type: 'string' },
210+
references: { type: 'file' },
211+
image: { type: 'file' },
212212
},
213213
outputs: {
214214
file: {
@@ -230,22 +230,10 @@ export const QuiverBlock: BlockConfig<QuiverSvgResponse> = {
230230
usage: {
231231
type: 'json',
232232
description: 'Token usage statistics',
233-
properties: {
234-
totalTokens: { type: 'number', description: 'Total tokens used' },
235-
inputTokens: { type: 'number', description: 'Input tokens used' },
236-
outputTokens: { type: 'number', description: 'Output tokens used' },
237-
},
238233
},
239234
models: {
240235
type: 'json',
241236
description: 'List of available models (list_models operation only)',
242-
optional: true,
243-
properties: {
244-
id: { type: 'string', description: 'Model identifier' },
245-
name: { type: 'string', description: 'Human-readable model name' },
246-
description: { type: 'string', description: 'Model capabilities summary' },
247-
supportedOperations: { type: 'json', description: 'Available operations' },
248-
},
249237
},
250238
},
251239
}

apps/sim/blocks/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { SelectorKey } from '@/hooks/selectors/types'
33
import type { ToolResponse } from '@/tools/types'
44

55
export type BlockIcon = (props: SVGProps<SVGSVGElement>) => JSX.Element
6-
export type ParamType = 'string' | 'number' | 'boolean' | 'json' | 'array'
6+
export type ParamType = 'string' | 'number' | 'boolean' | 'json' | 'array' | 'file'
77
export type PrimitiveValueType =
88
| 'string'
99
| 'number'

apps/sim/lib/uploads/utils/file-schemas.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export const RawFileInputSchema = z
4747
{ message: 'File path must reference an uploaded file' }
4848
)
4949

50+
export type RawFileInput = z.infer<typeof RawFileInputSchema>
51+
5052
export const RawFileInputArraySchema = z.array(RawFileInputSchema)
5153

5254
export const FileInputSchema = z.union([RawFileInputSchema, z.string()])

apps/sim/tools/quiver/image_to_svg.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export const quiverImageToSvgTool: ToolConfig<QuiverImageToSvgParams, QuiverSvgR
6767
request: {
6868
url: '/api/tools/quiver/image-to-svg',
6969
method: 'POST',
70+
headers: () => ({ 'Content-Type': 'application/json' }),
7071
body: (params) => ({
7172
apiKey: params.apiKey,
7273
model: params.model,

apps/sim/tools/quiver/text_to_svg.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export const quiverTextToSvgTool: ToolConfig<QuiverTextToSvgParams, QuiverSvgRes
7373
request: {
7474
url: '/api/tools/quiver/text-to-svg',
7575
method: 'POST',
76+
headers: () => ({ 'Content-Type': 'application/json' }),
7677
body: (params) => ({
7778
apiKey: params.apiKey,
7879
prompt: params.prompt,

0 commit comments

Comments
 (0)