mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
feat(tools): added textract, added v2 for mistral, updated tag dropdown (#2904)
* feat(tools): added textract * cleanup * ack pr comments * reorder * removed upload for textract async version * fix additional fields dropdown in editor, update parser to leave validation to be done on the server * added mistral v2, files v2, and finalized textract * updated the rest of the old file patterns, updated mistral outputs for v2 * updated tag dropdown to parse non-operation fields as well * updated extension finder * cleanup * added description for inputs to workflow * use helper for internal route check * fix tag dropdown merge conflict change * remove duplicate code --------- Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
This commit is contained in:
@@ -562,14 +562,26 @@ function generateOutputPathsWithTypes(
|
||||
* Gets the tool outputs for a block operation.
|
||||
*
|
||||
* @param blockConfig - The block configuration containing tools config
|
||||
* @param operation - The selected operation for the tool
|
||||
* @param subBlocks - SubBlock values to pass to the tool selector
|
||||
* @returns Outputs schema for the tool, or empty object on error
|
||||
*/
|
||||
export function getToolOutputs(blockConfig: BlockConfig, operation: string): Record<string, any> {
|
||||
export function getToolOutputs(
|
||||
blockConfig: BlockConfig,
|
||||
subBlocks?: Record<string, SubBlockWithValue>
|
||||
): Record<string, any> {
|
||||
if (!blockConfig?.tools?.config?.tool) return {}
|
||||
|
||||
try {
|
||||
const toolId = blockConfig.tools.config.tool({ operation })
|
||||
// Build params object from subBlock values for tool selector
|
||||
// This allows tool selectors to use any field (operation, provider, etc.)
|
||||
const params: Record<string, any> = {}
|
||||
if (subBlocks) {
|
||||
for (const [key, subBlock] of Object.entries(subBlocks)) {
|
||||
params[key] = subBlock.value
|
||||
}
|
||||
}
|
||||
|
||||
const toolId = blockConfig.tools.config.tool(params)
|
||||
if (!toolId) return {}
|
||||
|
||||
const toolConfig = getTool(toolId)
|
||||
@@ -577,7 +589,7 @@ export function getToolOutputs(blockConfig: BlockConfig, operation: string): Rec
|
||||
|
||||
return toolConfig.outputs
|
||||
} catch (error) {
|
||||
logger.warn('Failed to get tool outputs for operation', { operation, error })
|
||||
logger.warn('Failed to get tool outputs', { error })
|
||||
return {}
|
||||
}
|
||||
}
|
||||
@@ -586,16 +598,14 @@ export function getToolOutputs(blockConfig: BlockConfig, operation: string): Rec
|
||||
* Generates output paths for a tool-based block.
|
||||
*
|
||||
* @param blockConfig - The block configuration containing tools config
|
||||
* @param operation - The selected operation for the tool
|
||||
* @param subBlocks - Optional subBlock values for condition evaluation
|
||||
* @param subBlocks - SubBlock values for tool selection and condition evaluation
|
||||
* @returns Array of output paths for the tool, or empty array on error
|
||||
*/
|
||||
export function getToolOutputPaths(
|
||||
blockConfig: BlockConfig,
|
||||
operation: string,
|
||||
subBlocks?: Record<string, SubBlockWithValue>
|
||||
): string[] {
|
||||
const outputs = getToolOutputs(blockConfig, operation)
|
||||
const outputs = getToolOutputs(blockConfig, subBlocks)
|
||||
|
||||
if (!outputs || Object.keys(outputs).length === 0) return []
|
||||
|
||||
@@ -630,16 +640,16 @@ export function getOutputPathsFromSchema(outputs: Record<string, any>): string[]
|
||||
* Gets the output type for a specific path in a tool's outputs.
|
||||
*
|
||||
* @param blockConfig - The block configuration containing tools config
|
||||
* @param operation - The selected operation for the tool
|
||||
* @param subBlocks - SubBlock values for tool selection
|
||||
* @param path - The dot-separated path to the output field
|
||||
* @returns The type of the output field, or 'any' if not found
|
||||
*/
|
||||
export function getToolOutputType(
|
||||
blockConfig: BlockConfig,
|
||||
operation: string,
|
||||
subBlocks: Record<string, SubBlockWithValue> | undefined,
|
||||
path: string
|
||||
): string {
|
||||
const outputs = getToolOutputs(blockConfig, operation)
|
||||
const outputs = getToolOutputs(blockConfig, subBlocks)
|
||||
if (!outputs || Object.keys(outputs).length === 0) return 'any'
|
||||
|
||||
const pathsWithTypes = generateOutputPathsWithTypes(outputs)
|
||||
|
||||
Reference in New Issue
Block a user