<?php
namespace App\AI\Contexts\Reports; class AriaReports extends \App\AI\Contexts\ContextAbstract { protected function checkPermission_generate_aria_aggregated_report() : bool { return \App\UserAccess\CurrentUserAccessFast::getInstance()->hasAccessToSection('Modules/Reports/AriaReports'); } protected function generateFunctionObject_generate_aria_aggregated_report(\App\AI\Api\ChatGpt\Responses\ToolFunction $funcObj) : \App\AI\Api\ChatGpt\Responses\ToolFunction { $servCodeObj = new \App\AI\Api\ChatGpt\Responses\Property(); $servCodeObj->type = "string"; $servCodeObj->description = "The report generating prompt entered by the user."; $funcObj->parameters->addProperty("userPrompt", $servCodeObj); $funcObj->parameters->required = ['userPrompt']; return $funcObj; } protected function executeFunction_generate_aria_aggregated_report(string $arguments) : array { $args = json_decode($arguments, 1); $results = []; if ($args['userPrompt']) { $results['ariaUrl'] = \Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Reports/AriaReports', 'index', ['userPrompt' => $args['userPrompt'], 'sendUserPrompt' => 1]); } return $results; } protected function developerMessage_generate_aria_aggregated_report(string $arguments): string { $developerMessage = "If the user did not enter any prompt for initiating the ARIA reports ask him to enter one. Guide him to create a pivot table report based on the following sources: client invoice rows, supplier invoice rows, order services."; $developerMessage .= "\n\nIf the response of the function call `generate_aria_aggregated_report` contains an `ariaUrl` value, use it to generate a link for the user to click on it to start creating the ARIA report."; return $developerMessage; } } 