Метод getReadableMessagesPage

Расположение

Исходный файл метода в Bitrix Framework

Путь к исходному файлу строки 165–216
~/bitrix/modulesim/lib/V2/Integration/AiAssistant/Tools/Support/ImToolContext.php

Исходный код

PHP
public

Сигнатура метода

public function getReadableMessagesPage(Chat $chat, int $userId, ?int $exclusiveBeforeId, int $limit, array $additionalFilter = []): array

Возвращает: array

Описание

Reads one honest page of chat messages available to the user. The window, hasMore and nextCursor are computed over the raw DESC selection of `limit + 1` messages, while readability filtering is applied only to the window. This keeps pagination monotonic even when a whole page is filtered out: nextCursor still advances, so the next call makes forward progress. The cursor deliberately reuses the shared LAST_ID filter (parity with REST im.v2.Chat.Message.*): `ID < cursor` bounded by the cursor row's DATE_CREATE, while MessageCollection::find orders by (DATE_CREATE, ID). On history where ID order diverges from DATE_CREATE order (imported messages, edited dates) this keyset can skip such anomalous rows; fixing that requires a composite (DATE_CREATE, ID) keyset in MessageCollection::find, shared with REST.

Параметры

5
Имя Тип По умолчанию Флаги
$chat Chat -
-
$userId int -
-
$exclusiveBeforeId ?int -
-
$limit int -
-
$additionalFilter array []
-