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,11 +2,16 @@
|
||||
|
||||
namespace App\Containers\Dashboard\Tasks\AI;
|
||||
|
||||
use App\Containers\Dashboard\Tasks\IntegrationCredentials\GetIntegrationCredentialTask;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CallAiServiceForFileSelectionTask
|
||||
{
|
||||
public function __construct(
|
||||
private readonly GetIntegrationCredentialTask $getCredentialTask,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Отправляет фрагменты файлов в AI для определения основного файла
|
||||
*
|
||||
@@ -19,6 +24,15 @@ class CallAiServiceForFileSelectionTask
|
||||
'fragments_count' => count($fragments),
|
||||
]);
|
||||
|
||||
$credential = $this->getCredentialTask->run('qwen');
|
||||
if (!$credential) {
|
||||
Log::error('[CallAiServiceForFileSelectionTask] API ключ не настроен', [
|
||||
'provider' => 'qwen',
|
||||
]);
|
||||
return null;
|
||||
}
|
||||
$apiKey = $credential->payload['api_key'] ?? '';
|
||||
|
||||
$prompt = $this->buildPrompt($fragments);
|
||||
|
||||
Log::info('[CallAiServiceForFileSelectionTask] Отправка запроса к AI');
|
||||
@@ -26,7 +40,7 @@ class CallAiServiceForFileSelectionTask
|
||||
try {
|
||||
$response = Http::timeout(30) // Таймаут 30 секунд
|
||||
->withHeaders([
|
||||
'Authorization' => 'Bearer ' . env('QWEN_API_KEY'),
|
||||
'Authorization' => 'Bearer ' . $apiKey,
|
||||
'Content-Type' => 'application/json',
|
||||
])->post('https://routerai.ru/api/v1/chat/completions', [
|
||||
'model' => 'qwen/qwen3.5-flash-02-23',
|
||||
|
||||
Reference in New Issue
Block a user