Commit Graph

158 Commits

Author SHA1 Message Date
IGNY8 VPS (Salman)
0818dfe385 Add automation routes and enhance header metrics management
- Introduced new routes for Automation Rules and Automation Tasks in the frontend.
- Updated the AppSidebar to include sub-items for Automation navigation.
- Enhanced HeaderMetricsContext to manage credit and page metrics more effectively, ensuring proper merging and clearing of metrics.
- Adjusted AppLayout and TablePageTemplate to maintain credit balance while managing page metrics.
2025-11-17 21:04:46 +00:00
IGNY8 VPS (Salman)
aa74fb0d65 1 2025-11-17 20:50:51 +00:00
IGNY8 VPS (Salman)
a7d432500f docs 2025-11-17 20:35:04 +00:00
IGNY8 VPS (Salman)
b6b1aecdce Update site builder configurations and enhance migration dependencies
- Added `OptimizationConfig` to `INSTALLED_APPS` in `settings.py`.
- Updated migration dependencies in `0001_initial.py` to include `writer` for content source fields.
- Modified the `account` ForeignKey in `PageBlueprint` and `SiteBlueprint` models to use `tenant_id` for better clarity.
- Deleted obsolete implementation plan documents for phases 0-4 to streamline project documentation.
- Improved overall project structure by removing outdated files and enhancing migration clarity.
2025-11-17 20:22:29 +00:00
alorig
f7115190dc Add Linker and Optimizer modules with API integration and frontend components
- Added Linker and Optimizer apps to `INSTALLED_APPS` in `settings.py`.
- Configured API endpoints for Linker and Optimizer in `urls.py`.
- Implemented `OptimizeContentFunction` for content optimization in the AI module.
- Created prompts for content optimization and site structure generation.
- Updated `OptimizerService` to utilize the new AI function for content optimization.
- Developed frontend components including dashboards and content lists for Linker and Optimizer.
- Integrated new routes and sidebar navigation for Linker and Optimizer in the frontend.
- Enhanced content management with source and sync status filters in the Writer module.
- Comprehensive test coverage added for new features and components.
2025-11-18 00:41:00 +05:00
IGNY8 VPS (Salman)
4b9e1a49a9 Remove obsolete scripts and files, update site builder configurations
- Deleted the `import_plans.py`, `run_tests.py`, and `test_run.py` scripts as they are no longer needed.
- Updated the initial migration dependency in `0001_initial.py` to reflect recent changes in the `igny8_core_auth` app.
- Enhanced the implementation plan documentation to include new phases and updates on the site builder project.
- Updated the `vite.config.ts` and `package.json` to integrate testing configurations and dependencies for the site builder.
2025-11-17 17:48:15 +00:00
IGNY8 VPS (Salman)
5a36686844 Add site builder service to Docker Compose and remove obsolete scripts
- Introduced a new service `igny8_site_builder` in `docker-compose.app.yml` for site building functionality, including environment variables and volume mappings.
- Deleted several outdated scripts: `create_test_users.py`, `test_image_write_access.py`, `update_free_plan.py`, and the database file `db.sqlite3` to clean up the backend.
- Updated Django settings and URL configurations to integrate the new site builder module.
2025-11-17 16:08:51 +00:00
IGNY8 VPS (Salman)
e3d4ba2c02 Remove unused files and enhance error handling in serializers.py
- Deleted the outdated backend dependency file for drf-spectacular.
- Removed an unused image from the frontend assets.
- Improved error handling in TasksSerializer by catching ObjectDoesNotExist in addition to AttributeError.
2025-11-17 13:21:32 +00:00
alorig
2605c62eec Revert "Update serializers.py"
This reverts commit 41c1501764.
2025-11-17 17:34:18 +05:00
alorig
41c1501764 Update serializers.py 2025-11-17 17:32:46 +05:00
IGNY8 VPS (Salman)
8a9dd8ed2f aaaa 2025-11-17 11:58:45 +00:00
IGNY8 VPS (Salman)
9930728e8a Add source tracking and sync status fields to Content model; update services module
- Introduced new fields in the Content model for source tracking and sync status, including external references and optimization fields.
- Updated the services module to include new content generation and pipeline services for better organization and clarity.
2025-11-17 11:15:15 +00:00
IGNY8 VPS (Salman)
fe95d09bbe phase 0 to 2 completed 2025-11-16 23:02:22 +00:00
IGNY8 VPS (Salman)
4ecc1706bc celery 2025-11-16 22:57:36 +00:00
IGNY8 VPS (Salman)
0f02bd6409 celery 2025-11-16 22:52:43 +00:00
IGNY8 VPS (Salman)
1134285a12 Update app labels for billing, writer, and planner models; fix foreign key references in automation migrations
- Set app labels for CreditTransaction and CreditUsageLog models to 'billing'.
- Updated app labels for Tasks, Content, and Images models to 'writer'.
- Changed foreign key references in automation migrations from 'account' to 'tenant' for consistency.
2025-11-16 22:37:16 +00:00
IGNY8 VPS (Salman)
1c2c9354ba Add automation module to settings and update app labels
- Registered the new AutomationConfig in the INSTALLED_APPS of settings.py.
- Set the app_label for AutomationRule and ScheduledTask models to 'automation' for better organization and clarity in the database schema.
2025-11-16 22:23:39 +00:00
IGNY8 VPS (Salman)
92f51859fe reaminign phase 1-2 tasks 2025-11-16 22:17:33 +00:00
IGNY8 VPS (Salman)
7f8982a0ab Add scheduled automation task and update URL routing
- Introduced a new scheduled task for executing automation rules every 5 minutes in the Celery beat schedule.
- Updated URL routing to include a new endpoint for automation-related functionalities.
- Refactored imports in various modules to align with the new business layer structure, ensuring backward compatibility for billing models, exceptions, and services.
2025-11-16 22:11:05 +00:00
IGNY8 VPS (Salman)
9ab87416d8 Merge branch 'feature/phase-0-credit-system' 2025-11-16 21:29:55 +00:00
IGNY8 VPS (Salman)
51cd021f85 fixed all phase 0 issues Enhance error handling for ModuleEnableSettings retrieval
- Added a check for the existence of the ModuleEnableSettings table before attempting to retrieve or fixed all phase 0 create settings for an account.
- Implemented logging and a user-friendly error response if the table does not exist, prompting the user to run the necessary migration.
- Updated migration to create the ModuleEnableSettings table using raw SQL to avoid model resolution issues.
2025-11-16 21:16:35 +00:00
IGNY8 VPS (Salman)
fc6dd5623a Add refresh token functionality and improve login response handling
- Introduced RefreshTokenView to allow users to refresh their access tokens using a valid refresh token.
- Enhanced LoginView to ensure correct user/account loading and improved error handling during user serialization.
- Updated API response structure to include access and refresh token expiration times.
- Adjusted frontend API handling to support both new and legacy token response formats.
2025-11-16 21:06:22 +00:00
Desktop
1531f41226 Revert "Fix authentication: Ensure correct user/account is loaded"
This reverts commit a267fc0715.
2025-11-17 01:35:34 +05:00
Desktop
37a64fa1ef Revert "Fix authentication: Use token's account_id as authoritative source"
This reverts commit 46b5b5f1b2.
2025-11-17 01:35:30 +05:00
Desktop
c4daeb1870 Revert "Fix authentication: Follow unified API model - token account_id is authoritative"
This reverts commit 8171014a7e.
2025-11-17 01:35:26 +05:00
Desktop
79aab68acd Revert "Fix credit system: Add developer/system account bypass for credit checks"
This reverts commit 066b81dd2a.
2025-11-17 01:35:23 +05:00
Desktop
11a5a66c8b Revert "Revert to main branch account handling logic"
This reverts commit 219dae83c6.
2025-11-17 01:35:19 +05:00
Desktop
ab292de06c Revert "branch 1st"
This reverts commit 8a9dd44c50.
2025-11-17 01:35:13 +05:00
IGNY8 VPS (Salman)
8a9dd44c50 branch 1st 2025-11-16 20:08:58 +00:00
IGNY8 VPS (Salman)
b2e60b749a 1 2025-11-16 20:02:45 +00:00
IGNY8 VPS (Salman)
9f3c4a6cdd Fix middleware: Don't set request.user, only request.account
- Middleware should only set request.account, not request.user
- Let DRF authentication handle request.user setting
- This prevents conflicts between middleware and DRF authentication
- Fixes /me endpoint returning wrong user issue
2025-11-16 19:49:55 +00:00
IGNY8 VPS (Salman)
219dae83c6 Revert to main branch account handling logic
- Restored fallback to user.account when token account_id is missing/invalid
- Restored validation that user.account matches token account_id
- If user's account changed, use user.account (the correct one)
- Matches main branch behavior which has correct config
- Fixes wrong user/account showing issue
2025-11-16 19:44:18 +00:00
IGNY8 VPS (Salman)
066b81dd2a Fix credit system: Add developer/system account bypass for credit checks
- CreditService.check_credits() now bypasses for:
  1. System accounts (aws-admin, default-account, default)
  2. Developer/admin users (if user provided)
  3. Accounts with developer users (fallback for Celery tasks)
- Updated check_credits_legacy() with same bypass logic
- AIEngine credit check now uses updated CreditService
- Fixes 52 console errors caused by credit checks blocking developers
- Developers can now use AI functions without credit restrictions
2025-11-16 19:40:44 +00:00
IGNY8 VPS (Salman)
8171014a7e Fix authentication: Follow unified API model - token account_id is authoritative
- Simplified authentication logic to match unified API documentation
- Token's account_id is now the sole source of truth for account context
- Removed validation against user.account (no longer valid per unified API model)
- Middleware now simply extracts account_id from JWT and sets request.account
- Matches documented flow: Extract Account ID → Load Account Object → Set request.account
2025-11-16 19:36:18 +00:00
IGNY8 VPS (Salman)
46b5b5f1b2 Fix authentication: Use token's account_id as authoritative source
- Token's account_id is now authoritative for current account context
- For developers/admins: Always use token's account_id (they can access any account)
- For regular users: Verify they belong to token's account, fallback to user.account if not
- This ensures correct account context is set, especially for developers working across accounts
- Fixes bug where wrong user/account was shown after login
2025-11-16 19:34:02 +00:00
IGNY8 VPS (Salman)
a267fc0715 Fix authentication: Ensure correct user/account is loaded
- JWTAuthentication now uses select_related('account', 'account__plan') to get fresh user data
- Added check to use user's current account if it differs from token's account_id
- This ensures correct user/account is shown even if account changed after token was issued
- Fixes bug where wrong user was displayed after login
2025-11-16 19:28:37 +00:00
IGNY8 VPS (Salman)
9ec8908091 Phase 0: Fix ModuleEnableSettings list() - use get() instead of get_or_create
- Changed to use get() with DoesNotExist exception handling
- Creates settings only if they don't exist
- Better error handling with traceback
- Fixes 404 'Setting not found' errors
2025-11-16 19:26:18 +00:00
IGNY8 VPS (Salman)
0d468ef15a Phase 0: Improve ModuleEnableSettings get_queryset to filter by account
- Updated get_queryset to properly filter by account
- Ensures queryset is account-scoped before list() is called
- Prevents potential conflicts with base class behavior
2025-11-16 19:25:36 +00:00
IGNY8 VPS (Salman)
8fc483251e Phase 0: Fix ModuleEnableSettings 404 error - improve error handling
- Added proper exception handling in list() and retrieve() methods
- Use objects.get_or_create() directly instead of class method
- Added *args, **kwargs to method signatures for DRF compatibility
- Better error messages for debugging
- Fixes 404 'Setting not found' errors
2025-11-16 19:25:05 +00:00
IGNY8 VPS (Salman)
4de9128430 Phase 0: Fix ModuleEnableSettings permissions - allow read access to all authenticated users
- Changed permission_classes to get_permissions() method
- Read operations (list, retrieve) now accessible to all authenticated users
- Write operations (update, partial_update) still restricted to admins/owners
- Fixes 403 Forbidden errors when loading module settings in sidebar
2025-11-16 19:14:53 +00:00
IGNY8 VPS (Salman)
f195b6a72a Phase 0: Fix infinite loop in AppSidebar and module settings loading
- Fixed infinite loop by memoizing moduleEnabled with useCallback
- Fixed useEffect dependencies to prevent re-render loops
- Added loading check to prevent duplicate API calls
- Fixed setState calls to only update when values actually change
- Removed unused import (isModuleEnabled from modules.config)
2025-11-16 19:13:12 +00:00
IGNY8 VPS (Salman)
461f3211dd Phase 0: Add monthly credit replenishment Celery Beat task
- Created billing/tasks.py with replenish_monthly_credits task
- Task runs on first day of each month at midnight
- Adds plan.included_credits to all active accounts
- Creates CreditTransaction records for audit trail
- Configured in celery.py beat_schedule
- Handles errors gracefully and logs all operations
2025-11-16 19:02:26 +00:00
IGNY8 VPS (Salman)
abbf6dbabb Phase 0: Remove plan limit checks from billing views
- Updated limits endpoint to show only credits and account management limits
- Removed all operation limit references (keywords, clusters, content ideas, word count, images)
- Limits endpoint now focuses on credit usage by operation type
- Account management limits (users, sites) still shown
2025-11-16 18:51:40 +00:00
IGNY8 VPS (Salman)
a10e89ab08 Phase 0: Remove plan operation limit fields (credit-only system)
- Removed all operation limit fields from Plan model
- Kept account management limits (max_users, max_sites, etc.)
- Updated PlanSerializer to remove limit fields
- Updated PlanAdmin to remove limit fieldsets
- Created migration to remove limit fields from database
- Plan model now only has credits, billing, and account management fields
2025-11-16 18:50:24 +00:00
IGNY8 VPS (Salman)
13bd7fa134 Phase 0: Add ModuleEnableSettings serializer, ViewSet, and URL routing
- Created ModuleEnableSettingsSerializer
- Created ModuleEnableSettingsViewSet with get_or_create logic
- Added URL routing for module enable settings
- One record per account, auto-created on first access
2025-11-16 18:40:10 +00:00
IGNY8 VPS (Salman)
a73b2ae22b Phase 0: Add ModuleEnableSettings model and migration
- Created ModuleEnableSettings model with enabled flags for all modules
- Added migration for ModuleEnableSettings
- Updated imports across system module files
2025-11-16 18:39:16 +00:00
IGNY8 VPS (Salman)
5b11c4001e Phase 0: Update credit costs and CreditService, add credit checks to AI Engine
- Updated CREDIT_COSTS to match Phase 0 spec (flat structure)
- Added get_credit_cost() method to CreditService
- Updated check_credits() to accept operation_type and amount
- Added deduct_credits_for_operation() convenience method
- Updated AI Engine to check credits BEFORE AI call
- Updated AI Engine to deduct credits AFTER successful execution
- Added helper methods for operation type mapping and amount calculation
2025-11-16 18:37:41 +00:00
IGNY8 VPS (Salman)
8521ded923 Resolve merge conflict in authStore.ts - use dynamic import for fetchAPI 2025-11-16 13:47:37 +00:00
IGNY8 VPS (Salman)
3a41ba99bb Refactor AI framework to use IntegrationSettings exclusively for model configuration
- Removed hardcoded model defaults and the MODEL_CONFIG dictionary.
- Updated get_model_config() to require an account parameter and raise clear errors if IntegrationSettings are not configured.
- Eliminated unused helper functions: get_model(), get_max_tokens(), and get_temperature().
- Improved error handling to provide specific messages for missing account or model configurations.
- Cleaned up orphan exports in __init__.py to maintain a streamlined codebase.
2025-11-16 12:23:43 +00:00
IGNY8 VPS (Salman)
8908c11c86 Enhance error handling in AIEngine and update ResourceDebugOverlay
- Added error type handling in AIEngine for better error categorization during model configuration and execution.
- Updated _handle_error method to accept and log error types.
- Improved ResourceDebugOverlay to silently ignore 404 responses from the metrics endpoint, preventing unnecessary logging and retries.
- Refactored authStore to utilize fetchAPI for automatic token handling and improved error logging without throwing exceptions.
2025-11-16 11:44:51 +00:00