Skip to content

Commit

Permalink
Merge pull request #145 from PySpur-Dev/bugfix/output-schema
Browse files Browse the repository at this point in the history
Bugfix/output schema
  • Loading branch information
preet-bhadra authored Feb 7, 2025
2 parents 19f54b1 + f368b7c commit b3f8d00
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions frontend/src/components/nodes/nodeSidebar/NodeSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,18 @@ const NodeSidebar: React.FC<NodeSidebarProps> = ({ nodeID }) => {
return incomingNodes.reduce((acc: string[], node) => {
if (!node) return acc
const config = allNodeConfigs[node.id]
if (config?.output_schema) {
if (config?.output_json_schema) {
const nodeTitle = config.title || node.id
return [...acc, ...Object.keys(config.output_schema).map((key) => `${nodeTitle}.${key}`)]
const { schema, error } = extractSchemaFromJsonSchema(config.output_json_schema)
if (error) {
console.error('Error parsing output_json_schema:', error)
return acc
}
if (schema && typeof schema === 'object') {
Object.keys(schema).forEach(key => {
acc.push(`${nodeTitle}.${key}`)
})
}
}
return acc
}, [])
Expand Down Expand Up @@ -561,9 +570,9 @@ const NodeSidebar: React.FC<NodeSidebarProps> = ({ nodeID }) => {
// Add useEffect to validate initial schema
useEffect(() => {
if (currentNodeConfig?.output_json_schema) {
debouncedValidate(currentNodeConfig.output_json_schema);
debouncedValidate(currentNodeConfig.output_json_schema)
}
}, [currentNodeConfig?.output_json_schema]);
}, [currentNodeConfig?.output_json_schema])

// Update renderField to handle vector index selection
const renderField = (key: string, field: any, value: any, parentPath: string = '', isLast: boolean = false) => {
Expand Down

0 comments on commit b3f8d00

Please sign in to comment.