mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(quiver): build fail (#3730)
* Fix test * Fix schema * Fix test * Fix * Fix
This commit is contained in:
committed by
GitHub
parent
775daed2ea
commit
5e53757ca9
@@ -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)) {
|
||||
|
||||
@@ -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: {
|
||||
@@ -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' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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()])
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user