Skip to content

Conversation

@bledden
Copy link

@bledden bledden commented Jan 6, 2026

Summary

Fixes #117 - Frontend crashes when model is an array instead of a string.

Problem

The frontend code calls model.split('/') but some API responses return model as an array (e.g., ["openai/gpt-4o"]) instead of a string, causing:

TypeError: finalResponse.model.split is not a function

Solution

Added getModelDisplayName() helper in frontend/src/utils.js that handles:

  • Arrays (extracts first element)
  • null/undefined (returns "Unknown")
  • Non-string types (converts to string)
  • Missing slash (returns whole string)

Updated Stage1, Stage2, and Stage3 components to use this helper.

Validation

// BEFORE (crashes):
finalResponse.model = ["openai/gpt-4o"]
finalResponse.model.split('/')  TypeError: split is not a function

// AFTER (works):
getModelDisplayName(["openai/gpt-4o"])  "gpt-4o"

Test plan

  • Verify frontend doesn't crash when model is returned as array
  • Verify normal string models still display correctly

🤖 Generated with Claude Code

Fixes karpathy#117 - handles arrays, null/undefined, and missing slashes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"finalResponse.model.split is not a function"

1 participant