Rename project from any-llm to laravel-llm
- Remove old any-llm related files (Dockerfile, config.yml, web/, setup-laravel.sh) - Update README.md with new Laravel LLM Gateway documentation - Keep docker-compose.yml with laravel-llm container names - Clean project structure for Laravel-only implementation
This commit is contained in:
@@ -41,19 +41,35 @@ class BudgetController extends Controller
|
||||
'custom_duration_days' => 'nullable|integer|min:1|required_if:budget_type,custom',
|
||||
]);
|
||||
|
||||
// Calculate budget_duration_sec based on type
|
||||
$duration = match($validated['budget_type']) {
|
||||
'daily' => 86400, // 1 day
|
||||
'weekly' => 604800, // 7 days
|
||||
'monthly' => 2592000, // 30 days
|
||||
'custom' => ($validated['custom_duration_days'] ?? 1) * 86400,
|
||||
'unlimited' => null,
|
||||
};
|
||||
// Set monthly and daily limits based on budget type
|
||||
$monthlyLimit = null;
|
||||
$dailyLimit = null;
|
||||
|
||||
switch($validated['budget_type']) {
|
||||
case 'daily':
|
||||
$dailyLimit = $validated['max_budget'];
|
||||
break;
|
||||
case 'weekly':
|
||||
$dailyLimit = $validated['max_budget'] / 7;
|
||||
break;
|
||||
case 'monthly':
|
||||
$monthlyLimit = $validated['max_budget'];
|
||||
$dailyLimit = $validated['max_budget'] / 30;
|
||||
break;
|
||||
case 'custom':
|
||||
$days = $validated['custom_duration_days'] ?? 1;
|
||||
$dailyLimit = $validated['max_budget'] / $days;
|
||||
break;
|
||||
case 'unlimited':
|
||||
// No limits
|
||||
break;
|
||||
}
|
||||
|
||||
$budget = Budget::create([
|
||||
'budget_id' => 'budget-' . Str::uuid(),
|
||||
'max_budget' => $validated['max_budget'],
|
||||
'budget_duration_sec' => $duration,
|
||||
'name' => $validated['budget_name'],
|
||||
'monthly_limit' => $monthlyLimit,
|
||||
'daily_limit' => $dailyLimit,
|
||||
]);
|
||||
|
||||
return redirect()
|
||||
@@ -106,23 +122,40 @@ class BudgetController extends Controller
|
||||
$budget = Budget::findOrFail($id);
|
||||
|
||||
$validated = $request->validate([
|
||||
'budget_name' => 'required|string|max:255',
|
||||
'max_budget' => 'required|numeric|min:0',
|
||||
'budget_type' => 'required|in:daily,weekly,monthly,custom,unlimited',
|
||||
'custom_duration_days' => 'nullable|integer|min:1|required_if:budget_type,custom',
|
||||
]);
|
||||
|
||||
// Calculate budget_duration_sec based on type
|
||||
$duration = match($validated['budget_type']) {
|
||||
'daily' => 86400,
|
||||
'weekly' => 604800,
|
||||
'monthly' => 2592000,
|
||||
'custom' => ($validated['custom_duration_days'] ?? 1) * 86400,
|
||||
'unlimited' => null,
|
||||
};
|
||||
// Set monthly and daily limits based on budget type
|
||||
$monthlyLimit = null;
|
||||
$dailyLimit = null;
|
||||
|
||||
switch($validated['budget_type']) {
|
||||
case 'daily':
|
||||
$dailyLimit = $validated['max_budget'];
|
||||
break;
|
||||
case 'weekly':
|
||||
$dailyLimit = $validated['max_budget'] / 7;
|
||||
break;
|
||||
case 'monthly':
|
||||
$monthlyLimit = $validated['max_budget'];
|
||||
$dailyLimit = $validated['max_budget'] / 30;
|
||||
break;
|
||||
case 'custom':
|
||||
$days = $validated['custom_duration_days'] ?? 1;
|
||||
$dailyLimit = $validated['max_budget'] / $days;
|
||||
break;
|
||||
case 'unlimited':
|
||||
// No limits
|
||||
break;
|
||||
}
|
||||
|
||||
$budget->update([
|
||||
'max_budget' => $validated['max_budget'],
|
||||
'budget_duration_sec' => $duration,
|
||||
'name' => $validated['budget_name'],
|
||||
'monthly_limit' => $monthlyLimit,
|
||||
'daily_limit' => $dailyLimit,
|
||||
]);
|
||||
|
||||
return redirect()
|
||||
|
||||
Reference in New Issue
Block a user