resetPage(); } public function submitTicket(TicketIngestionService $ticketIngestionService): void { $this->submitError = null; $this->lastResult = null; $this->validate([ 'newTicketMessage' => ['required', 'string', 'min:5', 'max:5000'], 'apiUser' => ['nullable', 'string', 'max:255', 'required_with:apiPassword'], 'apiPassword' => ['nullable', 'string', 'max:255', 'required_with:apiUser'], ]); try { $ingested = $ticketIngestionService->ingest(trim($this->newTicketMessage), $this->credentialsPayload()); } catch (OllamaUnavailableException $e) { $this->submitError = 'LLM provider niet beschikbaar. Reden: '.$e->getMessage(); return; } $this->reset(['newTicketMessage', 'apiUser', 'apiPassword']); $this->resetPage(); $this->lastResult = [ 'ticket_id' => $ingested['ticket']->id, 'status' => $ingested['ticket']->status, ]; } private function credentialsPayload(): ?array { if (trim($this->apiUser) === '' && trim($this->apiPassword) === '') { return null; } return [ 'apiuser' => $this->apiUser, 'apipassword' => $this->apiPassword, ]; } public function render(AdminTicketService $service) { return view('livewire.admin.ticket-monitor', [ 'tickets' => $service->paginateWithDecision($this->perPage), ]); } }