+
+
+
+
+
Credits & Billing
+
+ Manage your credits, view transactions, and monitor usage
+
+
+
+
+
+ {/* Credit Balance Cards */}
+
+
+
+
+ sum + log.credits_used, 0)}
+ icon={ClockIcon}
+ color="purple"
+ iconColor="text-purple-500"
+ />
+
+
+ {/* Tabs */}
+
+
+
+
+ {/* Tab Content */}
+ {activeTab === 'overview' && (
+
+ {/* Recent Transactions */}
+
+
+ {transactions.slice(0, 5).map((transaction) => (
+
+
+
+
+ {transaction.transaction_type}
+
+
+ {transaction.description}
+
+
+
+ {new Date(transaction.created_at).toLocaleString()}
+
+
+
+
0 ? 'text-green-600' : 'text-red-600'}`}>
+ {transaction.amount > 0 ? '+' : ''}{transaction.amount}
+
+
+ Balance: {transaction.balance_after}
+
+
+
+ ))}
+ {transactions.length === 0 && (
+
+ No transactions yet
+
+ )}
+
+
+
+ {/* Recent Usage */}
+
+
+ {usageLogs.slice(0, 5).map((log) => (
+
+
+
+ {formatOperationType(log.operation_type)}
+
+
+ {log.model_used} • {new Date(log.created_at).toLocaleString()}
+
+
+
+
+ {log.credits_used} credits
+
+
+
+ ))}
+ {usageLogs.length === 0 && (
+
+ No usage history yet
+
+ )}
+
+
+
+ )}
+
+ {activeTab === 'transactions' && (
+
+
+
+
+
+ |
+ Date
+ |
+
+ Type
+ |
+
+ Description
+ |
+
+ Amount
+ |
+
+ Balance
+ |
+
+
+
+ {transactions.map((transaction) => (
+
+ |
+ {new Date(transaction.created_at).toLocaleDateString()}
+ |
+
+
+ {transaction.transaction_type}
+
+ |
+
+ {transaction.description}
+ |
+ 0 ? 'text-green-600' : 'text-red-600'
+ }`}>
+ {transaction.amount > 0 ? '+' : ''}{transaction.amount}
+ |
+
+ {transaction.balance_after}
+ |
+
+ ))}
+
+
+
+
+ )}
+
+ {activeTab === 'usage' && (
+
+
+
+
+
+ |
+ Date
+ |
+
+ Operation
+ |
+
+ Model
+ |
+
+ Credits
+ |
+
+
+
+ {usageLogs.map((log) => (
+
+ |
+ {new Date(log.created_at).toLocaleString()}
+ |
+
+ {formatOperationType(log.operation_type)}
+ |
+
+ {log.model_used || 'N/A'}
+ |
+
+ {log.credits_used}
+ |
+
+ ))}
+
+
+
+
+ )}
+
+ );
+};
+
+export default CreditsAndBilling;
diff --git a/frontend/src/services/automationService.ts b/frontend/src/services/automationService.ts
index 344e55a9..c4913ccd 100644
--- a/frontend/src/services/automationService.ts
+++ b/frontend/src/services/automationService.ts
@@ -25,10 +25,14 @@ export interface StageResult {
export interface AutomationRun {
run_id: string;
- status: 'running' | 'paused' | 'completed' | 'failed';
+ status: 'running' | 'paused' | 'cancelled' | 'completed' | 'failed';
current_stage: number;
trigger_type: 'manual' | 'scheduled';
started_at: string;
+ completed_at?: string | null;
+ paused_at?: string | null;
+ resumed_at?: string | null;
+ cancelled_at?: string | null;
total_credits_used: number;
stage_1_result: StageResult | null;
stage_2_result: StageResult | null;
@@ -56,6 +60,24 @@ export interface PipelineStage {
type: 'AI' | 'Local' | 'Manual';
}
+export interface ProcessingItem {
+ id: number;
+ title: string;
+ type: string;
+}
+
+export interface ProcessingState {
+ stage_number: number;
+ stage_name: string;
+ stage_type: 'AI' | 'Local' | 'Manual';
+ total_items: number;
+ processed_items: number;
+ percentage: number;
+ currently_processing: ProcessingItem[];
+ up_next: ProcessingItem[];
+ remaining_count: number;
+}
+
function buildUrl(endpoint: string, params?: Record