Commit Graph

26 Commits

Author SHA1 Message Date
Krishav Raj Singh 6baba64271 fix: typo 2025-10-07 21:14:20 +05:30
Krishav Raj Singh 15e073a5df fix: fallback to anthropic when rate limited by bedrock 2025-10-07 20:52:31 +05:30
marko-kraemer ddf2d32f59 feat(admin): add user thread viewer with admin access bypass
 Features:
- Add admin portal thread viewer with pagination
- Display thread list with project names and public status
- Add clickable links to view threads via /share/{thread_id}
- Add admin bypass for accessing all threads (public and private)

🔧 Backend Refactoring:
- Consolidate admin APIs into admin_api.py and billing_admin_api.py
- Remove unused files: users_admin.py, admin/api.py
- Remove unused endpoints: user search, grant-bulk-credits, migrate-user
- Update admin thread endpoint to use share URLs

 Performance:
- Remove message_count from UserThreadSummary (optimization)
- Remove N+1 query issue in thread listing

🔒 Authorization:
- Add admin role bypass in verify_and_authorize_thread_access
- Create RLS migration (20251005160000_admin_roles_access.sql)
- Update thread_select_policy for admin access
- Update message_select_policy for admin access
- Update project_select_policy for admin access
- Update agent_runs_select_policy for admin access

💻 Frontend:
- Add Threads tab to admin user details dialog
- Add useAdminUserThreads hook with pagination
- Remove unused admin hooks (useAdminUserSearch, useAdminAdvancedSearch)
- Display thread metadata with Open button and ExternalLink icon

🗃️ Database:
- Apply RLS policies allowing admin/super_admin roles to bypass restrictions
- Admins can now view any thread, message, project, or agent_run

This enables admins to view and debug any user's threads through the
share page interface, regardless of public/private status.
2025-10-05 18:09:26 +02:00
marko-kraemer 98e9196d41 refactor: simplify backend - fix naming conflicts and centralize DB dependencies
Backend improvements:
- Fixed duplicate TemplateService naming conflict:
  * Renamed marketplace_service.py::TemplateService → MarketplaceService
  * Eliminates confusion between two classes with same name

- Created centralized DB dependency helpers (db_helpers.py):
  * get_db() - FastAPI dependency for DB connection (singleton)
  * get_db_client() - Returns initialized Supabase client
  * get_initialized_db() - For module-level backward compatibility
  * Addresses 100+ DBConnection() instantiations across 53 files

- Applied new DB helpers to high-usage files:
  * services/api_keys_api.py - Now uses get_db() dependency
  * templates/services/marketplace_service.py - Uses get_initialized_db()

- Comprehensive simplification analysis document:
  * Identified 9 modules with duplicate initialize() patterns
  * Documented large files needing breakdown (1700-2000 lines)
  * Analyzed 35 tool files for common patterns
  * Prioritized recommendations for future work

Frontend cleanup:
- Removed unused template preview components and pages
2025-10-04 22:40:16 +02:00
marko-kraemer e0250092a6 temp reg anthropic 2025-10-01 17:05:03 +02:00
marko-kraemer d8100cb7a0 Add Sonnet 4.5 and centralize model configuration system
- Add Claude Sonnet 4.5 (global.anthropic.claude-sonnet-4-5-20250929-v1:0) to registry
- Update all Anthropic models to use bedrock/converse/ endpoint with full ARNs
- Create comprehensive ModelConfig class for centralized provider settings
- Add alias system with raw ARNs for proper LiteLLM response resolution
- Refactor response processor to preserve exact LiteLLM response objects
- Simplify LLM service by merging prepare_params into make_llm_api_call
- Set stream_options include_usage as universal default for all models
- Remove scattered configuration functions in favor of registry-driven approach
- Fix pricing lookup by mapping provider model IDs back to registry entries
2025-10-01 01:32:24 +02:00
marko-kraemer 2b5b8cc0bc Add Sonnet 4.5 model and fix LiteLLM response handling
- Add Claude Sonnet 4.5 (global.anthropic.claude-sonnet-4-5-20250929-v1:0) to model registry
- Update all Anthropic models to use bedrock/converse/ endpoint with full ARNs
- Restore alias system for proper model ID resolution from LiteLLM responses
- Refactor response processor to preserve exact LiteLLM response objects
- Fix pricing lookup by mapping raw ARNs to registry model IDs via aliases
2025-10-01 00:55:24 +02:00
marko-kraemer a1f4b17ad2 wip 2025-09-29 13:07:05 +02:00
marko-kraemer 079d7347da model changes 2025-09-28 23:36:14 +02:00
Krishav Raj Singh bffb0d6297 increase context to 1 mil 2025-09-25 19:04:20 +05:30
marko-kraemer 553844372f wip 2025-09-22 10:15:42 +02:00
marko-kraemer 31c697f774 billing rem old file, other changes 2025-09-21 16:35:14 +02:00
marko-kraemer aaeeca14cf wip 2025-09-18 11:47:52 +02:00
marko-kraemer 1e5542820c wip 2025-09-18 10:57:40 +02:00
marko-kraemer 3af20d6a2e wip 2025-09-18 10:51:58 +02:00
marko-kraemer 2169127960 wip 2025-09-18 10:28:12 +02:00
marko-kraemer bf919ddf9f wip 2025-09-18 09:21:31 +02:00
marko-kraemer d2cfa0c6f2 wip 2025-09-17 20:27:00 +02:00
marko-kraemer ff86931e1a wip 2025-09-17 19:46:34 +02:00
marko-kraemer 7319dc7a56 wip 2025-09-17 19:23:20 +02:00
Saumya f54e2e176e fix: prompt caching and double system prompt 2025-09-14 15:13:00 +05:30
Saumya 9803d3b0d8 make free trial worth 5 dollars 2025-09-12 11:42:23 +05:30
Saumya 5f86bfbf2b free trial functional 2025-09-09 01:53:04 +05:30
Saumya 643a7b4b6b attempt to free trial 2025-09-09 01:53:04 +05:30
marko-kraemer ccfb04bed1 rename 2025-09-04 21:44:27 -07:00
marko-kraemer f73d0f5db6 mv around files, update imports 2025-09-03 22:40:25 -07:00