__('Please log in to continue.', 'aiwend'), 'forbidden' => __('You do not have permission to do that.', 'aiwend'), 'not_found' => __('Not found.', 'aiwend'), 'invalid_request_id', 'invalid_message' => __('The request was not valid.', 'aiwend'), 'empty_message' => __('Please type a message.', 'aiwend'), 'message_too_long' => __('That message is too long. Please shorten it.', 'aiwend'), 'usage_limit_reached' => __('The assistant has reached its usage limit. Please try again later.', 'aiwend'), 'client_limit_reached' => __('You have reached the daily limit for the assistant. Please come back tomorrow.', 'aiwend'), 'budget_not_configured' => __('The assistant is not available yet. The site owner has not set a usage budget.', 'aiwend'), 'spending_paused' => __('The assistant is paused right now. Please try again later.', 'aiwend'), 'bot_unavailable', 'provider_not_configured', 'xai_public_chat_blocked' =>__('This assistant is not available right now.', 'aiwend'), 'knowledge_unavailable', 'knowledge_failed' => __('This assistant cannot answer right now. Please try again later.', 'aiwend'), 'duplicate_request' => __('This message is already being processed.', 'aiwend'), 'outcome_uncertain' => __('We could not confirm whether your last message was answered. Please send a new message.', 'aiwend'), 'provider_cooling_down' => __('The assistant is temporarily unavailable. Please try again in a few minutes.', 'aiwend'), 'provider_rate_limited' => __('The assistant is busy. Please try again in a moment.', 'aiwend'), 'provider_timeout' => __('The assistant took too long to respond. Please try again.', 'aiwend'), 'provider_empty_response' => __('The assistant did not give an answer. Please try asking again.', 'aiwend'), 'provider_quota_exhausted' => __('The assistant has reached its usage limit with the AI provider. Please try again later.', 'aiwend'), 'provider_output_limit' => __('The assistant could not finish that answer. Please try a shorter or simpler question.', 'aiwend'), 'rate_limited' => __('Too many new conversations from this device. Please wait a few minutes.', 'aiwend'), 'message_rate_limited' => __('You are sending messages too quickly. Please wait a minute and try again.', 'aiwend'), 'publish_confirmation_required' => __('Making a source public needs confirmation: review the affected assistants and repeat the request with the confirmation token.', 'aiwend'), 'publish_stale' => __('The source or the list of affected assistants changed, or the confirmation expired. Review it again and confirm.', 'aiwend'), 'setup_required' => __('Setup is incomplete. An encryption key must be configured first.', 'aiwend'), default => str_starts_with($code, 'provider_') ? __('The assistant could not answer right now. Please try again.', 'aiwend') : __('Something went wrong. Please try again.', 'aiwend'), }; } public static function response(string $code, int $status, ?string $requestId = null): \WP_Error { $data = ['status' => $status]; if ($requestId !== null) { $data['request_id'] = $requestId; } return new \WP_Error('aiwend_' . $code, self::message($code), $data); } }