fix: add community config endpoint and fix provider routing#96
fix: add community config endpoint and fix provider routing#96neuromechanist merged 4 commits intodevelopfrom
Conversation
- Add GET /{community_id}/ endpoint to return community configuration
including default_model and default_model_provider
- Fix OpenRouter provider routing: change "only" to "order"
(OpenRouter rejects {"only": [provider]} but accepts {"order": [provider]})
- Update widget to call correct endpoint (/{communityId}/ not /communities/{communityId})
- Remove hardcoded fallback model from widget, show proper errors instead
Fixes the two main issues:
1. Widget showing old default model (openai/gpt-oss-120b)
2. Backend failing with "No allowed providers are available" error
Tested with curl - DeepInfra/FP8 provider now works correctly.
- Add .context/api-structure.md with comprehensive API implementation guide
- Community-based routing pattern (/{community_id}/...)
- Model selection logic and provider routing details
- Common mistakes and how to avoid them (provider format, fallbacks, etc.)
- Testing and adding new communities
- Reorganize CLAUDE.md Key Documentation section
- Group by purpose (API, Security, Tools, Architecture, etc.)
- Add clear directive on which doc to read for which task
- Emphasize api-structure.md as starting point for API work
This prevents issues like the provider routing bug and /communities/
pattern mistake from happening again.
🚀 Preview Deployment
This preview will be updated automatically when you push new commits. |
PR Review SummaryOverall Assessment: Conditional Approval - Core fixes are correct, but widget needs better error handling before merge. Issues Found
What's Good ✅
RecommendationFix the 3 critical widget issues before merging:
The high-priority backend exception handling can be addressed in a follow-up PR as it's a pre-existing pattern across endpoints. Review completed by: code-reviewer, comment-analyzer, silent-failure-hunter agents |
Addresses critical PR review findings: 1. Add disableWidget() function that disables input/send button when config invalid 2. Call disableWidget() on all fetchCommunityDefaultModel() error paths: - Invalid community ID - HTTP errors (404, 500, etc.) - Missing default_model in response - Network/timeout errors 3. Show error state in settings modal dropdown when model is null 4. Show error state in model hint when model is null (red text) This prevents the widget from appearing functional when it's actually broken, making failures visible to users immediately rather than silently continuing with null communityDefaultModel. Fixes silent failure issues identified in PR #96 review.
Addresses minor PR review findings:
1. Add validation in GET /{community_id}/ endpoint to ensure default_model
is non-null before returning (raises HTTP 500 with clear error if missing)
2. Clarify port number in testing examples (38529 is dev, 38528 is prod)
These changes improve error reporting for misconfigured communities and
prevent confusion when following the testing guide.
✅ All Critical Issues AddressedFixes Applied
High-Priority Issue🟡 Broad exception handling - Deferred to follow-up PR as it's a pre-existing pattern across all endpoints Status: Ready to merge ✅ All critical widget error handling issues have been resolved. The widget now:
The provider routing fix ( |
Summary
Fixes two critical issues preventing the Qwen model from working:
GET /communities/{communityId}but that endpoint didn't exist{"only": [provider]}but OpenRouter requires{"order": [provider]}Changes
Backend
GET /{community_id}/endpoint to return community configuration (id, name, description, default_model, default_model_provider)litellm_llm.py: change"only"to"order"Frontend
/{communityId}/instead of/communities/{communityId}openai/gpt-oss-120b)Documentation
.context/api-structure.md- comprehensive API implementation guideTesting
Tested locally:
GET /hed/returns correct config withqwen/qwen3-235b-a22b-2507{"order": ["DeepInfra/FP8"]}(tested with curl)Impact
Closes #93