feat: add Integration Credentials CRUD and Deploy UI
Integration Credentials: - Add IntegrationCredential model with encrypted payload - Add full CRUD: ManageIntegrationCredentialsAction, 4 Tasks, Controller, Requests - Add migration for integration_credentials table - Add Vue pages: Index, Create, Edit - AI tasks now read API keys from DB instead of .env - Add sidebar menu item Deploy UI: - Add DeployTask with full deploy lifecycle management - Extend DeployController with index, log, history endpoints - Add Deploy/Index.vue with live polling and deploy log viewer - Add sidebar menu item and QuickAction for Sveden UI: - Add 'key' icon to SidebarNavItem - Change deploy button color to amber in Main.vue
This commit is contained in:
@@ -2,12 +2,17 @@
|
||||
|
||||
namespace App\Containers\Dashboard\Tasks\AI;
|
||||
|
||||
use App\Containers\Dashboard\Tasks\IntegrationCredentials\GetIntegrationCredentialTask;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CallAiServiceTask
|
||||
{
|
||||
public function __construct(
|
||||
private readonly GetIntegrationCredentialTask $getCredentialTask,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Отправляет текст в AI сервис для извлечения структурированных данных
|
||||
*
|
||||
@@ -23,14 +28,14 @@ class CallAiServiceTask
|
||||
'categories_count' => $categories->count(),
|
||||
]);
|
||||
|
||||
// Проверяем наличие API ключа
|
||||
$apiKey = env('QWEN_API_KEY');
|
||||
if (empty($apiKey)) {
|
||||
$credential = $this->getCredentialTask->run('qwen');
|
||||
if (!$credential) {
|
||||
Log::error('[CallAiServiceTask] API ключ не настроен', [
|
||||
'env_key' => 'QWEN_API_KEY',
|
||||
'provider' => 'qwen',
|
||||
]);
|
||||
throw new \RuntimeException('AI API ключ не настроен в окружении');
|
||||
throw new \RuntimeException('AI API ключ не настроен');
|
||||
}
|
||||
$apiKey = $credential->payload['api_key'] ?? '';
|
||||
|
||||
$categoryList = collect($categories)
|
||||
->map(fn($cat) => "{$cat->id}: {$cat->title}")
|
||||
|
||||
Reference in New Issue
Block a user