in /var/www/neuralnetwork/data/www/neuralnetwork.advokat-malov.ru/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php at line 211
private function sendRequest(Closure $callable): ResponseInterface { try { return $callable(); } catch (ClientExceptionInterface $clientException) { if ($clientException instanceof ClientException) { $this->throwIfJsonError($clientException->getResponse(), $clientException->getResponse()->getBody()->getContents()); } throw new TransporterException($clientException); } } private function throwIfJsonError(ResponseInterface $response, string|ResponseInterface $contents): void { if ($response->getStatusCode() < 400) { return; }
* {@inheritDoc} */ public function requestObject(Payload $payload): Response { $request = $payload->toRequest($this->baseUri, $this->headers, $this->queryParams); $response = $this->sendRequest(fn (): \Psr\Http\Message\ResponseInterface => $this->client->sendRequest($request)); $contents = $response->getBody()->getContents(); if (str_contains($response->getHeaderLine('Content-Type'), ContentType::TEXT_PLAIN->value)) { return Response::from($contents, $response->getHeaders()); }
{ $this->ensureNotStreamed($parameters); $payload = Payload::create('chat/completions', $parameters); /** @var Response<array{id: string, object: string, created: int, model: string, system_fingerprint?: string, choices: array<int, array{index: int, message: array{role: string, content: ?string, function_call: ?array{name: string, arguments: string}, tool_calls: ?array<int, array{id: string, type: string, function: array{name: string, arguments: string}}>}, finish_reason: string|null}>, usage: array{prompt_tokens: int, completion_tokens: int|null, total_tokens: int}}> $response */ $response = $this->transporter->requestObject($payload); return CreateResponse::from($response->data(), $response->meta()); } /** * Creates a streamed completion for the chat message
])) ->make(); $result = $client->chat()->create([ 'model' => 'gpt-4-0125-preview', 'messages' => [ ['role' => 'user', 'content' => $request->post('input'), ], ], ]); if (!empty($result)) {
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug(Route requested: '$route', __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; $config = require __DIR__ . '/../config/web.php'; (new yii\web\Application($config))->run();
$_GET = [ 'token' => '2_ksj45azo12xFq12', ]; $_POST = [ 'input' => 'Напиши description длиной до 200 символов для страницы: Статья 17. Утратила силу Пример текущего description, который нужно исправить: Статья 17. Утратила силу. Образцы документов, онлайн консультация.', 'token' => '2_ksj45azo12xFq12', ];