Merge pull request #14 from Jeff-Emmett/add-runpod-AI-API

fix custom shape type validation errors
This commit is contained in:
Jeff Emmett 2025-11-16 03:15:51 -07:00 committed by GitHub
commit 0de17476d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 27 additions and 1 deletions

View File

@ -576,7 +576,33 @@ export function sanitizeRecord(record: any): TLRecord {
if (sanitized.type === 'Transcribe') {
sanitized.type = 'Transcription'
}
// CRITICAL: Normalize case for custom shape types (lowercase → PascalCase)
// The schema expects PascalCase (e.g., "ChatBox" not "chatBox")
const customShapeTypeMap: Record<string, string> = {
'chatBox': 'ChatBox',
'videoChat': 'VideoChat',
'embed': 'Embed',
'markdown': 'Markdown',
'mycrozineTemplate': 'MycrozineTemplate',
'slide': 'Slide',
'prompt': 'Prompt',
'transcription': 'Transcription',
'obsNote': 'ObsNote',
'fathomNote': 'FathomNote',
'holon': 'Holon',
'obsidianBrowser': 'ObsidianBrowser',
'fathomMeetingsBrowser': 'FathomMeetingsBrowser',
'locationShare': 'LocationShare',
'imageGen': 'ImageGen',
}
// Normalize the shape type if it's a custom type with incorrect case
if (sanitized.type && typeof sanitized.type === 'string' && customShapeTypeMap[sanitized.type]) {
console.log(`🔧 Normalizing shape type: "${sanitized.type}" → "${customShapeTypeMap[sanitized.type]}"`)
sanitized.type = customShapeTypeMap[sanitized.type]
}
// CRITICAL: Infer type from properties BEFORE defaulting to 'geo'
// This ensures arrows and other shapes are properly recognized
if (!sanitized.type || typeof sanitized.type !== 'string') {