Comment to 'Agents get several error only to chat with gpt4 o'
  • The message comes from the sys_ai_log. I accessed the chat directly from the top header icon in the studio using GPT-4. I asked a few questions to test its responses. However, the chat wasn’t very smooth—it seemed to freeze at times, and the replies came in bursts. Because of this, I disabled it. I also noticed that the conversations were posted to the public outline/timeline. I was the only user on the site, which was running on a deicated server with an i5 processor, 8 cores, SSD, 64GB of RAM, and a 1Gb/s connection. The site itself loaded quickly and worked flawlessly, with memcached, nginx-proxy, and a Caddy reverse proxy in front. Despite this, the chat with ChatGPT was slow. Unfortunately, I can't reproduce the issue because I deleted the site; it was just a test upgrade from B2 to RC1, and the problem happened after the upgrade. Now I plan to do a clean install of RC1 to check its performance. It’s possible the issues were caused by the update, as there were other problems as well, so I can’t directly blame ChatGPT or the AI app. My custom config here:

    custom Dockerfile:

    FROM php:8.1-fpm
    
    
    RUN apt-get update && apt-get install -y \
            cron \
            libfreetype6-dev \
            libjpeg62-turbo-dev \
            libmcrypt-dev \
            libpng-dev \
            libonig-dev \
            libmagickwand-dev \
            libzip-dev \
            unzip \
            libmemcached-dev \
            zlib1g-dev \
            libssl-dev \
        && docker-php-ext-configure gd --with-freetype --with-jpeg \
        && docker-php-ext-install -j$(nproc) gd \
        && docker-php-ext-install -j$(nproc) pdo pdo_mysql mysqli \
        && docker-php-ext-install -j$(nproc) zip exif opcache iconv mbstring \
        && pecl install xdebug && docker-php-ext-enable xdebug \
        && pecl install mcrypt-1.0.3 && docker-php-ext-enable mcrypt \
        && pecl install imagick-3.7.0 \
        && pecl install memcached \
        && docker-php-ext-enable imagick memcached
    

    memcached.conf

    upstream memcached_server {
        server 127.0.0.1:11211;
        # Alte servere Memcached pot fi adăugate aici, dacă este cazul
    }
    

    rate_limit.conf

    # rate_limit.conf
    limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;
    
    

    nginx default.conf

    server {
        listen 9992 default_server;
        server_name localhost;
    
    
        root /opt/una;
        access_log  /var/log/nginx/access.log;                                                                                                                                                       
        error_log  /var/log/nginx/error.log;
    
    
        client_max_body_size 1024M;
    
    
        ###########################################################################
        ## Client Timeout                                                        ##
        ###########################################################################
    
    
        ## request timed out -- default 60
        # read timeout for the request body from client, its set for testing purpose
        client_body_timeout 3600;
    
    
        # how long to wait for the client to send a request header, its set for testing purpose
        client_header_timeout 3600;
    
    
        # server will close connection after this time
        keepalive_timeout 3600;
    
    
        ## if client stop responding, free up memory -- default 60
        send_timeout 3600;
    
    
        ## Reset lingering timed out connections. Deflect DDoS.
        ## allow the server to close connection on non responding client, this will free up memory
        reset_timedout_connection on;
    
    
        ###########################################################################
        ## Proxy Timeout                                                         ##
        ###########################################################################
    
    
        proxy_connect_timeout 3600;
        proxy_send_timeout 3600;
        proxy_read_timeout 3600;
    
    
        ###########################################################################
        ## Location /                                                            ##
        ###########################################################################
    
    
    
    
        location / {
            index index.html index.htm index.php;
    
    
            rewrite "^/page/(.*)$" /page.php?i=$1 last;
            rewrite "^/m/(.*)$" /modules/index.php?r=$1 last;
            rewrite "^/s/([a-zA-Z0-9_]+)/([a-zA-Z0-9\.]+)" /storage.php?o=$1&f=$2 last;
    
    
            if (!-e $request_filename) {
                rewrite  ^/(.+) /r.php?_q=$1  last;
                break;
            }
    
    
            # Block requests with suspicious patterns
             ($query_string ~* "(\%60|\%7C|\%26|\%24|\%3B|\%28|\%29)") {
             403;
            #}
    
    
        }
    
    
        index index.php index.html index.htm;
    
    
        location ~ \.php$ {
            fastcgi_pass php:9000;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    
    
            # Adăugați aceste setări de timeout
            fastcgi_connect_timeout 3600;
            fastcgi_send_timeout 3600;
            fastcgi_read_timeout 3600;
            fastcgi_buffer_size 128k;
            fastcgi_buffers 4 256k;
            fastcgi_busy_buffers_size 256k;
            fastcgi_temp_file_write_size 256k;
        }
    
    
        ###########################################################################
        ## HSTS policy                                                           ##
        ###########################################################################
         Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
         X-Frame-Options "SAMEORIGIN" always;
         X-XSS-Protection "1; mode=block" always;
         X-Content-Type-Options "nosniff" always;
        # add_header Content-Security-Policy "default-src 'self'" always;
         Referrer-Policy "strict-origin-when-cross-origin" always;
    
    
        ###########################################################################
        ## serve static files directly Tanks to Alex T https://una.io/u/alex-t   ##
        ###########################################################################
       
        location ~* ^(/cache_public/|/plugins_public/|/modules/|/studio/|/template/).+\.(jpg|jpeg|gif|css|png|js|ico|svg|eot|ttf|woff|woff2|)$ {
            access_log        off;
            expires           1h;
            # root /opt/una
            # add_header Cache-Control "public";
            try_files       $uri =404;
        }
    
    
        ###########################################################################
        ## deny access to hidden files                                           ##
        ###########################################################################
        
        location ~ /(\.ht|\.git) {
            deny  all;
        }
    
    
        ###########################################################################
        ## deny access to specific folders                                       ##
        ###########################################################################
        
        location ~ ^/(cache/|storage/|logs/|plugins/|tmp/) {
            deny  all;
        }
    
    
        ###########################################################################
        ## Memcached Integration                                                 ##
        ###########################################################################
    
    
        location /memcached {
            # Example using just the URI as the key
            # set $memcached_key $uri;
    
    
            # Example with query parameters included
            # set $memcached_key $uri$is_args$args;
    
    
            # Example with a custom key
            set $memcached_key "key-$uri-$arg_user_id";
    
    
            # Pass the key to the Memcached server
            memcached_pass memcached_server;
    
    
            # Define the response type
            default_type application/json;
    
    
            # Handle errors
            error_page 404 = /memcached_not_found;
        }
    
    
        location = /memcached_not_found {
            return 404 "{\"error\": \"Not found in Memcached\"}";
        }
    
    
        ###########################################################################
        ## Permissions-Policy and CORS                                           ##
        ###########################################################################
         Permissions-Policy "accelerometer=(), autoplay=(), camera=(), encrypted-media=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), sync-xhr=(), usb=(), ch-ua-form-factor=('self' 'https://accounts.google.com')" always;
         Access-Control-Allow-Origin "https://www.googleapis.com https://accounts.google.com https://maps.googleapis.com https://www.coozila.com https://coozila.com https://agi.coozila.com https://onesignal.com" always;
         Access-Control-Allow-Credentials "true" always;
         Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With" always;
    }
    

    my custom php.ini

    ; Memcached extension configuration
    [memcached]
    ; Memcached extension configuration
    
    ; Specify the serializer for Memcached
    memcached.serializer = php
    
    ; Specify the session prefix for Memcached
    memcached.sess_prefix = memc.sess.key.
    
    ; Enable binary protocol for Memcached sessions
    memcached.sess_binary = On
    
    ; Use SASL authentication for Memcached (0 = disable, 1 = enable)
    memcached.use_sasl = 0
    
    ; Minimum waiting time for session lock acquisition (in milliseconds)
    memcached.sess_lock_wait_min = 150
    
    ; Maximum waiting time for session lock acquisition (in milliseconds)
    memcached.sess_lock_wait_max = 150
    
    ; Maximum size of POST data that PHP will accept.
    post_max_size = 1024M
    
    ; Maximum allowed size for uploaded files.
    upload_max_filesize = 1024M
    
    ; Maximum execution time of each script, in seconds
    max_execution_time = 3600
    
    ; Maximum amount of time each script may spend parsing request data
    max_input_time = 3600
    
    ; Maximum amount of memory a script may consume
    memory_limit = 1024M
    
    ; Maximum number of files that can be uploaded via a single request
    max_file_uploads = 50
    
    ; Enable HTML error handling
    html_errors = On
    
    ; String to output before an error message
    error_prepend_string = "
    "
    
    ; String to output after an error message
    error_append_string = "
    "
    
    [opcache]
    ; Enables the opcode cache for PHP
    opcache.enable = 1
    
    ; Frequency of checking for updated files (0 = never)
    opcache.revalidate_freq = 0
    
    ; Validates cached files with timestamp checks
    opcache.validate_timestamps = 1
    
    ; Maximum number of files that can be cached in memory
    opcache.max_accelerated_files = 100000
    
    ; Memory consumption by the opcode cache (in MB)
    opcache.memory_consumption = 72
    
    ; Maximum wasted memory percentage before restart
    opcache.max_wasted_percentage = 20
    
    ; Size of the interned strings buffer (in MB)
    opcache.interned_strings_buffer = 16
    
    ; Allows for faster shutting down of the opcode cache
    opcache.fast_shutdown = 1
    
    display_errors = On
    error_reporting = E_ALL