Step 1: Module Installation
- Log in to your PrestaShop admin panel.
- Navigate to the Modules section in the sidebar.
- Click on the Upload a module button.
- Select the .zip file of the NextGenAiAssistant module that you downloaded earlier.
- Once the upload is complete, PrestaShop will automatically install the module.
- Follow any on-screen prompts to finalize the installation process.
- After installation, ensure the module is enabled by checking its status in the Modules section.
- Clear your PrestaShop cache to avoid potential issues and ensure that the module works properly.
Step 2: File Permissions Configuration
Before running the module, it’s essential to configure the correct file permissions for certain directories to ensure the system can store logs, backups, and temporary files.
Set permissions to 777 (read, write, execute) for the following directories:
modules/next_gen_ai_assistant/logs
modules/next_gen_ai_assistant/backups
modules/next_gen_ai_assistant/files
chmod -R 777 modules/next_gen_ai_assistant/logs
chmod -R 777 modules/next_gen_ai_assistant/backups
chmod -R 777 modules/next_gen_ai_assistant/files
This ensures that the module can create, update, and access the necessary files without issues.
⚠️ Note: While
chmod 777
is the most permissive setting and ensures compatibility, it may not be the most secure option for production environments. If possible, consult your server administrator to configure permissions that are secure yet functional (e.g.,chmod 775
with proper ownership settings).
Step 3: Configuring Cron Jobs
Below are the details for each cron job used in the NextGenAiAssistant module. Each cron job performs a specific task, and it is recommended to run them every minute to ensure smooth operation. Alternatively, you can use the --worker
argument to run a script continuously in the background, which eliminates the need for frequent cron executions.
⚡ Why Use Workers?
Workers are highly recommended for better performance, especially if your store uses the module extensively or processes a high volume of operations. Workers allow real-time processing, minimize delays, and improve efficiency by running scripts continuously in the background.
Learn more about setting up workers in our Worker Configuration Guide.
Create New Threads Cron Job
Command:
php /path/to/prestashop/bin/console ai-assistant:openai:create-new-threads
This job processes the queued content creation tasks (prompts). It is responsible for turning raw data into generated content.
Available Parameters
--prompt_type
(optional): Specifies the type of prompts to process. If omitted, all prompt types will be processed.--size
(optional, default:10
): Maximum number of results to process in a single run.
⚠️ Note: If you increase this value, it is recommended to increase the interval between job executions.--sync
(optional, default:true
): Determines whether the tasks are processed synchronously (true
) or asynchronously (false
).
⚠️ Note: This option is primarily for debugging purposes and should generally not be changed.
Example Usaage
Process 20 product_description
prompts synchronously:
php /path/to/prestashop/bin/console ai-assistant:openai:create-new-threads
--prompt_type="product_description" --size=20 --sync=true
Run with default settings (recommended):
php /path/to/prestashop/bin/console ai-assistant:openai:create-new-threads
Process Queue Cron Job
Command:
php /path/to/prestashop/bin/console ai-assistant:process-queue
This job handles various tasks related to communication with the AI model and others. It processes jobs stored in a specified queue.
Available Parameters
--queue
(optional, default:default
): The name of the queue to process. If omitted, it will process the default queue.
⚠️ Note: Currently, the module only supports a single queue (default
). It is not recommended to change this parameter as other queues are not supported.--size
(optional, default:10
): The maximum number of jobs to process at once.
⚠️ Note: Increasing this value requires a longer interval between job runs to avoid system overload.--max_tries
(optional, default:3
): The maximum number of retry attempts for each job in the queue if failed.
⚠️ Note: Increasing this value may increase operational costs, as in the event of an error, the system will attempt to retry the operation up to the specified number of times, potentially generating more requests and incurring additional charges.
Example Usage
Process the default queue, with a maximum of 20 jobs and 5 retry attempts per job:
php /path/to/prestashop/bin/console ai-assistant:process-queue --queue="default" --size=20 --max_tries=5
Run with default settings (recommended):
php /path/to/prestashop/bin/console ai-assistant:process-queue
Process Thread Messages Cron Job
Command:
php bin/console ai-assistant:openai:process-thread-messages
This job checks the status of ongoing prompt runs and retrieves the messages returned by OpenAI. The responses are then saved in the database.
Example Usage
Run with default settings (no parameters):
php bin/console ai-assistant:openai:process-thread-messages
Summary of Cron Jobs
To ensure the smooth operation of the module and efficient processing of content, it is recommended to configure these cron jobs to run every minute. This ensures that pending tasks are processed in near real-time, and responses from the AI model are promptly retrieved and saved.
Make sure to adjust cron job intervals and size
parameters according to your server’s performance and workload. If you need further assistance with configuration, feel free to reach out to our support team.