= 1 ? $value : self::MAX_MESSAGE_LENGTH; } /** * Get the effective maximum admin response length. * * @since 2.6.0 * @return int */ public static function maxResponseLength(): int { /** * Filter the maximum admin response length. * * @since 2.6.0 * @param int $length Default maximum length in characters. */ $value = (int) apply_filters( 'aipt_chatbot_max_response_length', self::MAX_RESPONSE_LENGTH ); return $value >= 1 ? $value : self::MAX_RESPONSE_LENGTH; } /** * Get the effective maximum user name length. * * @since 2.6.0 * @return int */ public static function maxUserNameLength(): int { /** * Filter the maximum user name length. * * @since 2.6.0 * @param int $length Default maximum length in characters. */ $value = (int) apply_filters( 'aipt_chatbot_max_user_name_length', self::MAX_USER_NAME_LENGTH ); return $value >= 1 ? $value : self::MAX_USER_NAME_LENGTH; } /** * Get the effective maximum history messages count. * * @since 2.6.0 * @return int */ public static function maxHistoryMessages(): int { /** * Filter the maximum conversation history messages per request. * * @since 2.6.0 * @param int $count Default maximum message count. */ $value = (int) apply_filters( 'aipt_chatbot_max_history_messages', self::MAX_HISTORY_MESSAGES ); return $value >= 1 ? $value : self::MAX_HISTORY_MESSAGES; } /** * Get the effective default pagination per-page value. * * @since 2.6.0 * @return int */ public static function defaultPaginationPerPage(): int { /** * Filter the default items per page for message queue listing. * * @since 2.6.0 * @param int $per_page Default items per page. */ $value = (int) apply_filters( 'aipt_chatbot_default_per_page', self::DEFAULT_PAGINATION_PER_PAGE ); return $value >= 1 ? $value : self::DEFAULT_PAGINATION_PER_PAGE; } /** * Get the effective maximum pagination per-page value. * * @since 2.6.0 * @return int */ public static function maxPaginationPerPage(): int { /** * Filter the maximum items per page for message queue listing. * * @since 2.6.0 * @param int $per_page Default maximum items per page. */ $value = (int) apply_filters( 'aipt_chatbot_max_per_page', self::MAX_PAGINATION_PER_PAGE ); return $value >= 1 ? $value : self::MAX_PAGINATION_PER_PAGE; } /** * Get the effective maximum bulk-delete items count. * * @since 2.6.0 * @return int */ public static function maxBulkDeleteItems(): int { /** * Filter the maximum items allowed in a single bulk-delete request. * * @since 2.6.0 * @param int $count Default maximum bulk delete count. */ $value = (int) apply_filters( 'aipt_chatbot_max_bulk_delete', self::MAX_BULK_DELETE_ITEMS ); return $value >= 1 ? $value : self::MAX_BULK_DELETE_ITEMS; } /** * Get the effective default rate-limit max requests. * * @since 2.6.0 * @return int */ public static function defaultRateLimitMaxRequests(): int { /** * Filter the default maximum requests per rate-limit window. * * @since 2.6.0 * @param int $requests Default maximum requests. */ $value = (int) apply_filters( 'aipt_chatbot_default_rate_limit_requests', self::DEFAULT_RATE_LIMIT_MAX_REQUESTS ); if ( $value < 1 || $value > self::MAX_RATE_LIMIT_MAX_REQUESTS ) { return self::DEFAULT_RATE_LIMIT_MAX_REQUESTS; } return $value; } /** * Get the effective default rate-limit window in seconds. * * @since 2.6.0 * @return int */ public static function defaultRateLimitWindowSeconds(): int { /** * Filter the default rate-limit window in seconds. * * @since 2.6.0 * @param int $seconds Default window duration in seconds. */ $value = (int) apply_filters( 'aipt_chatbot_default_rate_limit_window', self::DEFAULT_RATE_LIMIT_WINDOW_SECONDS ); if ( $value < self::MIN_RATE_LIMIT_WINDOW_SECONDS || $value > self::MAX_RATE_LIMIT_WINDOW_SECONDS ) { return self::DEFAULT_RATE_LIMIT_WINDOW_SECONDS; } return $value; } /** * Get the effective default provider cooldown in seconds. * * @since 2.6.0 * @return int */ public static function defaultProviderCooldownSeconds(): int { /** * Filter the default provider cooldown duration in seconds. * * @since 2.6.0 * @param int $seconds Default cooldown duration in seconds. */ $value = (int) apply_filters( 'aipt_chatbot_default_cooldown_seconds', self::DEFAULT_PROVIDER_COOLDOWN_SECONDS ); if ( $value < self::MIN_PROVIDER_COOLDOWN_SECONDS || $value > self::MAX_PROVIDER_COOLDOWN_SECONDS ) { return self::DEFAULT_PROVIDER_COOLDOWN_SECONDS; } return $value; } /** * Get the effective reply budget of a storefront chat request. * * @since 2.8.4 * @return int Seconds. */ public static function replyBudgetSeconds(): int { /** * Filter the seconds a storefront chat request may take before it * answers, provider requests and retries included. * * @since 2.8.4 * @param int $seconds Default reply budget in seconds. */ $value = (int) apply_filters( 'aipt_chatbot_reply_budget_seconds', self::DEFAULT_REPLY_BUDGET_SECONDS ); if ( $value < self::MIN_REPLY_BUDGET_SECONDS || $value > self::MAX_REPLY_BUDGET_SECONDS ) { return self::DEFAULT_REPLY_BUDGET_SECONDS; } return $value; } /** * Get the effective cap on storefront chats answered at the same time. * * @since 2.8.4 * @return int 0 when the cap is off. */ public static function maxConcurrentChats(): int { /** * Filter how many storefront chats are answered at the same time. * * @since 2.8.4 * @param int $max Default cap; 0 turns it off. */ $value = (int) apply_filters( 'aipt_chatbot_max_concurrent_chats', self::DEFAULT_MAX_CONCURRENT_CHATS ); if ( $value < 0 || $value > self::MAX_CONCURRENT_CHATS ) { return self::DEFAULT_MAX_CONCURRENT_CHATS; } return $value; } /** * Get the effective maximum bot name length. * * @since 2.6.0 * @return int */ public static function maxBotNameLength(): int { /** * Filter the maximum bot name length. * * @since 2.6.0 * @param int $length Default maximum length in characters. */ $value = (int) apply_filters( 'aipt_chatbot_max_bot_name_length', self::MAX_BOT_NAME_LENGTH ); return $value >= 1 ? $value : self::MAX_BOT_NAME_LENGTH; } /** * Get the effective maximum greeting message length. * * @since 2.6.0 * @return int */ public static function maxGreetingMessageLength(): int { /** * Filter the maximum greeting message length. * * @since 2.6.0 * @param int $length Default maximum length in characters. */ $value = (int) apply_filters( 'aipt_chatbot_max_greeting_length', self::MAX_GREETING_MESSAGE_LENGTH ); return $value >= 1 ? $value : self::MAX_GREETING_MESSAGE_LENGTH; } /** * Get the effective maximum store context length. * * @since 2.6.0 * @return int */ public static function maxStoreContextLength(): int { /** * Filter the maximum store context length. * * @since 2.6.0 * @param int $length Default maximum length in characters. */ $value = (int) apply_filters( 'aipt_chatbot_max_store_context_length', self::MAX_STORE_CONTEXT_LENGTH ); return $value >= 1 ? $value : self::MAX_STORE_CONTEXT_LENGTH; } /** * Get the effective maximum characters per knowledge-page section. * * @since 2.6.0 * @return int */ public static function maxCharsPerPage(): int { /** * Filter the maximum characters per knowledge-page section in PromptBuilder. * * @since 2.6.0 * @param int $chars Default maximum characters per page. */ $value = (int) apply_filters( 'aipt_chatbot_max_chars_per_page', self::MAX_CHARS_PER_PAGE ); return $value >= 1 ? $value : self::MAX_CHARS_PER_PAGE; } }