userId !== null) { try { $task = $this->taskProcessingManager->getTask($taskId); if ($task->getUserId() === $this->userId) { $this->initialStateService->provideInitialState('task', $task->jsonSerialize()); return new TemplateResponse(Application::APP_ID, 'assistantPage'); } } catch (Exception|\Throwable $e) { } } return new TemplateResponse('', '403', [], TemplateResponse::RENDER_AS_ERROR, Http::STATUS_FORBIDDEN); } /** * @return TemplateResponse */ #[NoAdminRequired] #[NoCSRFRequired] public function getAssistantStandalonePage(): TemplateResponse { if ($this->userId !== null) { $task = new Task( $this->config->getUserValue($this->userId, Application::APP_ID, 'last_task_type', 'chatty-llm'), ['something' => ''], Application::APP_ID, $this->userId, '' ); $serializedTask = $task->jsonSerialize(); // otherwise the task id is 0 and the default input shape values are not set $serializedTask['id'] = null; $this->initialStateService->provideInitialState('task', $serializedTask); return new TemplateResponse(Application::APP_ID, 'assistantPage'); } return new TemplateResponse('', '403', [], TemplateResponse::RENDER_AS_ERROR, Http::STATUS_FORBIDDEN); } }