From c1ff6c8ebc5e488a0a11291e42a7338fe1adb220 Mon Sep 17 00:00:00 2001 From: orakili Date: Mon, 15 Jan 2024 06:09:46 +0000 Subject: [PATCH 01/20] feat: add ocha_ai_chat module Refs: OPS-9940 --- composer.json | 5 + composer.lock | 474 +++++++++++++++++- ...common_design_subtheme_ochaaichatpopup.yml | 28 ++ config/core.extension.yml | 1 + config/ocha_ai_chat.settings.yml | 93 ++++ config/user.role.beta_tester.yml | 7 +- 6 files changed, 604 insertions(+), 4 deletions(-) create mode 100644 config/block.block.common_design_subtheme_ochaaichatpopup.yml create mode 100644 config/ocha_ai_chat.settings.yml diff --git a/composer.json b/composer.json index dea1c01d5..1ac4ef9cd 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,10 @@ { "type": "composer", "url": "https://asset-packagist.org" + }, + { + "type": "vcs", + "url": "https://github.com/UN-OCHA/ocha_ai_chat.git" } ], "require": { @@ -71,6 +75,7 @@ "reliefweb/simple-datepicker": "^v1.3", "symfony/uid": "^6.2", "unocha/common_design": "^9.2", + "unocha/ocha_ai_chat": "@dev", "unocha/ocha_monitoring": "^1.0", "webflo/drupal-finder": "^1.2.2" }, diff --git a/composer.lock b/composer.lock index c306b0e33..1aa724507 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "938eadbbaa26df10898d4c4724c35e9e", + "content-hash": "ee395a099e7fbac60d9fa8aaf2606e48", "packages": [ { "name": "asm89/stack-cors", @@ -62,6 +62,155 @@ }, "time": "2023-11-14T13:51:46+00:00" }, + { + "name": "aws/aws-crt-php", + "version": "v1.2.4", + "source": { + "type": "git", + "url": "https://github.com/awslabs/aws-crt-php.git", + "reference": "eb0c6e4e142224a10b08f49ebf87f32611d162b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/eb0c6e4e142224a10b08f49ebf87f32611d162b2", + "reference": "eb0c6e4e142224a10b08f49ebf87f32611d162b2", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35||^5.6.3||^9.5", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "ext-awscrt": "Make sure you install awscrt native extension to use any of the functionality." + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "AWS SDK Common Runtime Team", + "email": "aws-sdk-common-runtime@amazon.com" + } + ], + "description": "AWS Common Runtime for PHP", + "homepage": "https://github.com/awslabs/aws-crt-php", + "keywords": [ + "amazon", + "aws", + "crt", + "sdk" + ], + "support": { + "issues": "https://github.com/awslabs/aws-crt-php/issues", + "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.4" + }, + "time": "2023-11-08T00:42:13+00:00" + }, + { + "name": "aws/aws-sdk-php", + "version": "3.296.1", + "source": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-php.git", + "reference": "38e47bbd3b5f76f008dd71c8a68545f9e4e47b6b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/38e47bbd3b5f76f008dd71c8a68545f9e4e47b6b", + "reference": "38e47bbd3b5f76f008dd71c8a68545f9e4e47b6b", + "shasum": "" + }, + "require": { + "aws/aws-crt-php": "^1.2.3", + "ext-json": "*", + "ext-pcre": "*", + "ext-simplexml": "*", + "guzzlehttp/guzzle": "^6.5.8 || ^7.4.5", + "guzzlehttp/promises": "^1.4.0 || ^2.0", + "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", + "mtdowling/jmespath.php": "^2.6", + "php": ">=7.2.5", + "psr/http-message": "^1.0 || ^2.0" + }, + "require-dev": { + "andrewsville/php-token-reflection": "^1.4", + "aws/aws-php-sns-message-validator": "~1.0", + "behat/behat": "~3.0", + "composer/composer": "^1.10.22", + "dms/phpunit-arraysubset-asserts": "^0.4.0", + "doctrine/cache": "~1.4", + "ext-dom": "*", + "ext-openssl": "*", + "ext-pcntl": "*", + "ext-sockets": "*", + "nette/neon": "^2.3", + "paragonie/random_compat": ">= 2", + "phpunit/phpunit": "^5.6.3 || ^8.5 || ^9.5", + "psr/cache": "^1.0", + "psr/simple-cache": "^1.0", + "sebastian/comparator": "^1.2.3 || ^4.0", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", + "doctrine/cache": "To use the DoctrineCacheAdapter", + "ext-curl": "To send requests using cURL", + "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Aws\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Amazon Web Services", + "homepage": "http://aws.amazon.com" + } + ], + "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", + "homepage": "http://aws.amazon.com/sdkforphp", + "keywords": [ + "amazon", + "aws", + "cloud", + "dynamodb", + "ec2", + "glacier", + "s3", + "sdk" + ], + "support": { + "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", + "issues": "https://github.com/aws/aws-sdk-php/issues", + "source": "https://github.com/aws/aws-sdk-php/tree/3.296.1" + }, + "time": "2024-01-14T05:20:33+00:00" + }, { "name": "behat/mink", "version": "v1.11.0", @@ -7260,6 +7409,72 @@ }, "time": "2022-02-23T02:02:42+00:00" }, + { + "name": "mtdowling/jmespath.php", + "version": "2.7.0", + "source": { + "type": "git", + "url": "https://github.com/jmespath/jmespath.php.git", + "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/bbb69a935c2cbb0c03d7f481a238027430f6440b", + "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "symfony/polyfill-mbstring": "^1.17" + }, + "require-dev": { + "composer/xdebug-handler": "^3.0.3", + "phpunit/phpunit": "^8.5.33" + }, + "bin": [ + "bin/jp.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "files": [ + "src/JmesPath.php" + ], + "psr-4": { + "JmesPath\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Declaratively specify how to extract elements from a JSON document", + "keywords": [ + "json", + "jsonpath" + ], + "support": { + "issues": "https://github.com/jmespath/jmespath.php/issues", + "source": "https://github.com/jmespath/jmespath.php/tree/2.7.0" + }, + "time": "2023-08-25T10:54:48+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.11.1", @@ -7920,6 +8135,98 @@ }, "time": "2023-11-21T22:12:22+00:00" }, + { + "name": "openai-php/client", + "version": "v0.7.10", + "source": { + "type": "git", + "url": "https://github.com/openai-php/client.git", + "reference": "f9af25d7d7bd8e58f60ada6c30f1c93d65c73833" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/openai-php/client/zipball/f9af25d7d7bd8e58f60ada6c30f1c93d65c73833", + "reference": "f9af25d7d7bd8e58f60ada6c30f1c93d65c73833", + "shasum": "" + }, + "require": { + "php": "^8.1.0", + "php-http/discovery": "^1.19.1", + "php-http/multipart-stream-builder": "^1.3.0", + "psr/http-client": "^1.0.3", + "psr/http-client-implementation": "^1.0.1", + "psr/http-factory-implementation": "*", + "psr/http-message": "^1.1.0|^2.0.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^7.8.0", + "guzzlehttp/psr7": "^2.6.1", + "laravel/pint": "^1.13.2", + "nunomaduro/collision": "^7.9.0", + "pestphp/pest": "^2.19.2", + "pestphp/pest-plugin-arch": "^2.3.3", + "pestphp/pest-plugin-mock": "^2.0.0", + "pestphp/pest-plugin-type-coverage": "^2.2.0", + "phpstan/phpstan": "^1.10.35", + "rector/rector": "^0.16.0", + "symfony/var-dumper": "^6.3.4" + }, + "type": "library", + "autoload": { + "files": [ + "src/OpenAI.php" + ], + "psr-4": { + "OpenAI\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + }, + { + "name": "Sandro Gehri" + } + ], + "description": "OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API", + "keywords": [ + "GPT-3", + "api", + "client", + "codex", + "dall-e", + "language", + "natural", + "openai", + "php", + "processing", + "sdk" + ], + "support": { + "issues": "https://github.com/openai-php/client/issues", + "source": "https://github.com/openai-php/client/tree/v0.7.10" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/gehrisandro", + "type": "github" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + } + ], + "time": "2023-11-14T13:39:26+00:00" + }, { "name": "orakili/composer-drupal-info-file-patch-helper", "version": "1.0.1", @@ -8252,6 +8559,54 @@ }, "time": "2021-03-21T15:43:46+00:00" }, + { + "name": "pear/text_languagedetect", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/pear/Text_LanguageDetect.git", + "reference": "655b269959782416426cf0aa7bd47e19fed63210" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Text_LanguageDetect/zipball/655b269959782416426cf0aa7bd47e19fed63210", + "reference": "655b269959782416426cf0aa7bd47e19fed63210", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "8.*|9.*" + }, + "suggest": { + "ext-mbstring": "May require the mbstring PHP extension" + }, + "type": "library", + "autoload": { + "psr-0": { + "Text": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "./" + ], + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Nicholas Pisarro", + "email": "taak@php.net", + "role": "Lead" + } + ], + "description": "Identify human languages from text samples", + "homepage": "http://pear.php.net/package/Text_LanguageDetect", + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Text_LanguageDetect", + "source": "https://github.com/pear/Text_LanguageDetect" + }, + "time": "2023-02-27T20:54:21+00:00" + }, { "name": "pelago/emogrifier", "version": "v7.2.0", @@ -8786,6 +9141,62 @@ }, "time": "2023-04-14T15:10:03+00:00" }, + { + "name": "php-http/multipart-stream-builder", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/multipart-stream-builder.git", + "reference": "f5938fd135d9fa442cc297dc98481805acfe2b6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/f5938fd135d9fa442cc297dc98481805acfe2b6a", + "reference": "f5938fd135d9fa442cc297dc98481805acfe2b6a", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "php-http/discovery": "^1.15", + "psr/http-factory-implementation": "^1.0" + }, + "require-dev": { + "nyholm/psr7": "^1.0", + "php-http/message": "^1.5", + "php-http/message-factory": "^1.0.2", + "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Http\\Message\\MultipartStream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com" + } + ], + "description": "A builder class that help you create a multipart stream", + "homepage": "http://php-http.org", + "keywords": [ + "factory", + "http", + "message", + "multipart stream", + "stream" + ], + "support": { + "issues": "https://github.com/php-http/multipart-stream-builder/issues", + "source": "https://github.com/php-http/multipart-stream-builder/tree/1.3.0" + }, + "time": "2023-04-28T14:10:22+00:00" + }, { "name": "php-http/promise", "version": "1.3.0", @@ -15469,6 +15880,64 @@ }, "time": "2024-01-04T12:36:24+00:00" }, + { + "name": "unocha/ocha_ai_chat", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/UN-OCHA/ocha_ai_chat.git", + "reference": "09aa7fa74313a57f9ed408a35c81b3a33edf9ec9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/09aa7fa74313a57f9ed408a35c81b3a33edf9ec9", + "reference": "09aa7fa74313a57f9ed408a35c81b3a33edf9ec9", + "shasum": "" + }, + "require": { + "aws/aws-sdk-php": "^3.283", + "drupal/core": "^10", + "openai-php/client": "^0.7", + "pear/text_languagedetect": "^1.0", + "php": ">=8.2", + "reliefweb/simple-autocomplete": "^v1.3", + "reliefweb/simple-datepicker": "^v1.3", + "symfony/uid": "^6.3" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "drupal/coder": "^8.3", + "phpcompatibility/php-compatibility": "^9.3" + }, + "default-branch": true, + "type": "drupal-module", + "scripts": { + "phpcs": [ + "vendor/bin/phpcs -p ." + ], + "phpcbf": [ + "vendor/bin/phpcbf -p ." + ], + "test": [ + "@phpcs" + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "UNOCHA", + "role": "" + } + ], + "description": "OCHA AI Chat module", + "support": { + "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/develop", + "issues": "https://github.com/UN-OCHA/ocha_ai_chat/issues" + }, + "time": "2024-01-15T05:59:15+00:00" + }, { "name": "unocha/ocha_monitoring", "version": "1.0.3", @@ -16408,7 +16877,8 @@ "drupal/config_split": 5, "drupal/imageapi_optimize_binaries": 10, "drupal/inline_entity_form": 5, - "drupal/mimemail": 15 + "drupal/mimemail": 15, + "unocha/ocha_ai_chat": 20 }, "prefer-stable": true, "prefer-lowest": false, diff --git a/config/block.block.common_design_subtheme_ochaaichatpopup.yml b/config/block.block.common_design_subtheme_ochaaichatpopup.yml new file mode 100644 index 000000000..339a479a6 --- /dev/null +++ b/config/block.block.common_design_subtheme_ochaaichatpopup.yml @@ -0,0 +1,28 @@ +uuid: b9a70ca4-c0f1-435d-9d2f-4ad6abc77a99 +langcode: en +status: true +dependencies: + module: + - node + - ocha_ai_chat + theme: + - common_design_subtheme +id: common_design_subtheme_ochaaichatpopup +theme: common_design_subtheme +region: content +weight: 0 +provider: null +plugin: ocha_ai_chat_chat_popup +settings: + id: ocha_ai_chat_chat_popup + label: 'OCHA AI Chat popup' + label_display: '0' + provider: ocha_ai_chat +visibility: + 'entity_bundle:node': + id: 'entity_bundle:node' + negate: false + context_mapping: + node: '@node.node_route_context:node' + bundles: + report: report diff --git a/config/core.extension.yml b/config/core.extension.yml index ed0923fa0..4d3907910 100644 --- a/config/core.extension.yml +++ b/config/core.extension.yml @@ -51,6 +51,7 @@ module: monitoring: 0 mysql: 0 node: 0 + ocha_ai_chat: 0 ocha_monitoring: 0 options: 0 page_cache: 0 diff --git a/config/ocha_ai_chat.settings.yml b/config/ocha_ai_chat.settings.yml new file mode 100644 index 000000000..8540c0193 --- /dev/null +++ b/config/ocha_ai_chat.settings.yml @@ -0,0 +1,93 @@ +_core: + default_config_hash: sEceqho82ErW-swOq9gnnEcaTFTiX_lrtpKL2ypdmmg +plugins: + completion: + aws_bedrock: + model: amazon.titan-text-express-v1 + endpoint: '' + version: '' + region: REPLACE_WITH_REGION + api_key: REPLACE_WITH_KEY + max_tokens: 512 + prompt_template: |- + {{ context }} + + Based solely on the information above, please answer the following question. Please do not make things up and say you don't know if you cannot answer. + + {{ question }} + api_secret: REPLACE_WITH_SECRET + role_arn: null + azure_openai: + model: gpt-3.5-turbo + endpoint: REPLACE_WITH_ENDPOINT + version: '2023-05-15' + region: REPLACE_WITH_REGION + api_key: REPLACE_WITH_KEY + max_tokens: 512 + prompt_template: |- + Based solely on the information below, please answer the user's question. Please do not make things up and say you don't know if you cannot answer. + + {{ context }} + embedding: + aws_bedrock: + model: amazon.titan-embed-text-v1 + endpoint: '' + version: '' + region: REPLACE_WITH_REGION + api_key: REPLACE_WITH_KEY + batch_size: 1 + dimensions: 1536 + max_tokens: 8192 + api_secret: REPLACE_WITH_SECRET + role_arn: null + azure_openai: + model: text-embedding-ada-002 + endpoint: REPLACE_WITH_ENDPOINT + version: '2023-05-15' + region: REPLACE_WITH_REGION + api_key: REPLACE_WITH_KEY + batch_size: 16 + dimensions: 1536 + max_tokens: 4096 + source: + reliefweb: + api_url: 'https://api.reliefweb.int/v1' + converter_url: 'https://reliefweb.int/search/converter/json' + appname: ocha-ai-chat + cache_enabled: true + cache_lifetime: 600 + text_extractor: + mupdf: + mutool: /usr/bin/mutool + text_splitter: + token: + length: 384 + overlap: 96 + sentence: + length: 4 + overlap: 2 + page: + length: 1 + overlap: 0 + vector_store: + elasticsearch: + url: REPLACE_WITH_URL + indexing_batch_size: 10 + topk: 5 + min_similarity: 0.3 + cutoff_coefficient: 0.5 +defaults: + plugins: + completion: + plugin_id: aws_bedrock + embedding: + plugin_id: aws_bedrock + source: + plugin_id: reliefweb + text_extractor: + application/pdf: + plugin_id: mupdf + text_splitter: + plugin_id: sentence + vector_store: + plugin_id: elasticsearch diff --git a/config/user.role.beta_tester.yml b/config/user.role.beta_tester.yml index 8fa3ce20f..573684923 100644 --- a/config/user.role.beta_tester.yml +++ b/config/user.role.beta_tester.yml @@ -1,9 +1,12 @@ uuid: d32877fc-1a02-4626-902d-577e71464493 langcode: en status: true -dependencies: { } +dependencies: + module: + - ocha_ai_chat id: beta_tester label: 'Beta tester' weight: 7 is_admin: null -permissions: { } +permissions: + - 'access ocha ai chat' From 9e915eb28eb398b3eb0b642f966026cdd40d938f Mon Sep 17 00:00:00 2001 From: orakili Date: Tue, 16 Jan 2024 05:11:04 +0000 Subject: [PATCH 02/20] chore: update ocha_ai_chat Refs: OPS-9940 --- composer.json | 2 +- composer.lock | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 1ac4ef9cd..7c3704ee0 100644 --- a/composer.json +++ b/composer.json @@ -75,7 +75,7 @@ "reliefweb/simple-datepicker": "^v1.3", "symfony/uid": "^6.2", "unocha/common_design": "^9.2", - "unocha/ocha_ai_chat": "@dev", + "unocha/ocha_ai_chat": "^0.0.1", "unocha/ocha_monitoring": "^1.0", "webflo/drupal-finder": "^1.2.2" }, diff --git a/composer.lock b/composer.lock index 1aa724507..831579f85 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ee395a099e7fbac60d9fa8aaf2606e48", + "content-hash": "e3e7c331d56f76255a981cf8727cfc5e", "packages": [ { "name": "asm89/stack-cors", @@ -15882,16 +15882,16 @@ }, { "name": "unocha/ocha_ai_chat", - "version": "dev-develop", + "version": "v0.0.1", "source": { "type": "git", "url": "https://github.com/UN-OCHA/ocha_ai_chat.git", - "reference": "09aa7fa74313a57f9ed408a35c81b3a33edf9ec9" + "reference": "846d0453f8978bb519dbfdc7522dd4c0800721a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/09aa7fa74313a57f9ed408a35c81b3a33edf9ec9", - "reference": "09aa7fa74313a57f9ed408a35c81b3a33edf9ec9", + "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/846d0453f8978bb519dbfdc7522dd4c0800721a9", + "reference": "846d0453f8978bb519dbfdc7522dd4c0800721a9", "shasum": "" }, "require": { @@ -15909,7 +15909,6 @@ "drupal/coder": "^8.3", "phpcompatibility/php-compatibility": "^9.3" }, - "default-branch": true, "type": "drupal-module", "scripts": { "phpcs": [ @@ -15933,10 +15932,10 @@ ], "description": "OCHA AI Chat module", "support": { - "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/develop", + "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/v0.0.1", "issues": "https://github.com/UN-OCHA/ocha_ai_chat/issues" }, - "time": "2024-01-15T05:59:15+00:00" + "time": "2024-01-16T04:57:23+00:00" }, { "name": "unocha/ocha_monitoring", @@ -16877,8 +16876,7 @@ "drupal/config_split": 5, "drupal/imageapi_optimize_binaries": 10, "drupal/inline_entity_form": 5, - "drupal/mimemail": 15, - "unocha/ocha_ai_chat": 20 + "drupal/mimemail": 15 }, "prefer-stable": true, "prefer-lowest": false, From 4d8a175c7311cd02f06a209873dd07c59a83993d Mon Sep 17 00:00:00 2001 From: orakili Date: Wed, 17 Jan 2024 02:05:16 +0000 Subject: [PATCH 03/20] chore: update ocha_ai_chat module Refs: OPS-9973 --- composer.json | 2 +- composer.lock | 14 +++++++------- config/ocha_ai_chat.settings.yml | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 70add6477..e0fffbab0 100644 --- a/composer.json +++ b/composer.json @@ -75,7 +75,7 @@ "reliefweb/simple-datepicker": "^v1.3", "symfony/uid": "^6.2", "unocha/common_design": "^9.3", - "unocha/ocha_ai_chat": "^0.0.1", + "unocha/ocha_ai_chat": "^0.0", "unocha/ocha_monitoring": "^1.0", "webflo/drupal-finder": "^1.2.2" }, diff --git a/composer.lock b/composer.lock index 7723c50dc..2c7bf9f86 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a3214695f9d19b5a70cdd03355fa57b9", + "content-hash": "bf73ee678ced2841545496667ead22ad", "packages": [ { "name": "asm89/stack-cors", @@ -15882,16 +15882,16 @@ }, { "name": "unocha/ocha_ai_chat", - "version": "v0.0.1", + "version": "v0.0.2", "source": { "type": "git", "url": "https://github.com/UN-OCHA/ocha_ai_chat.git", - "reference": "846d0453f8978bb519dbfdc7522dd4c0800721a9" + "reference": "9413db9aa5e917a4efa9d67954c0034106b6ad19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/846d0453f8978bb519dbfdc7522dd4c0800721a9", - "reference": "846d0453f8978bb519dbfdc7522dd4c0800721a9", + "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/9413db9aa5e917a4efa9d67954c0034106b6ad19", + "reference": "9413db9aa5e917a4efa9d67954c0034106b6ad19", "shasum": "" }, "require": { @@ -15932,10 +15932,10 @@ ], "description": "OCHA AI Chat module", "support": { - "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/v0.0.1", + "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/v0.0.2", "issues": "https://github.com/UN-OCHA/ocha_ai_chat/issues" }, - "time": "2024-01-16T04:57:23+00:00" + "time": "2024-01-17T02:05:47+00:00" }, { "name": "unocha/ocha_monitoring", diff --git a/config/ocha_ai_chat.settings.yml b/config/ocha_ai_chat.settings.yml index 8540c0193..9ace73f78 100644 --- a/config/ocha_ai_chat.settings.yml +++ b/config/ocha_ai_chat.settings.yml @@ -71,6 +71,7 @@ plugins: overlap: 0 vector_store: elasticsearch: + base_index_name: ocha_ai_chat url: REPLACE_WITH_URL indexing_batch_size: 10 topk: 5 From 4cdc42fba37835e6f62fcac799c24155ffb70462 Mon Sep 17 00:00:00 2001 From: orakili Date: Thu, 18 Jan 2024 03:44:34 +0000 Subject: [PATCH 04/20] chore: update ocha_ai_chat_module --- composer.lock | 12 ++++++------ config/ocha_ai_chat.settings.yml | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 2c7bf9f86..6f4f3d31c 100644 --- a/composer.lock +++ b/composer.lock @@ -15882,16 +15882,16 @@ }, { "name": "unocha/ocha_ai_chat", - "version": "v0.0.2", + "version": "v0.0.3", "source": { "type": "git", "url": "https://github.com/UN-OCHA/ocha_ai_chat.git", - "reference": "9413db9aa5e917a4efa9d67954c0034106b6ad19" + "reference": "c147bef247e637c8c81f0b85f62891369d30ea32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/9413db9aa5e917a4efa9d67954c0034106b6ad19", - "reference": "9413db9aa5e917a4efa9d67954c0034106b6ad19", + "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/c147bef247e637c8c81f0b85f62891369d30ea32", + "reference": "c147bef247e637c8c81f0b85f62891369d30ea32", "shasum": "" }, "require": { @@ -15932,10 +15932,10 @@ ], "description": "OCHA AI Chat module", "support": { - "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/v0.0.2", + "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/v0.0.3", "issues": "https://github.com/UN-OCHA/ocha_ai_chat/issues" }, - "time": "2024-01-17T02:05:47+00:00" + "time": "2024-01-18T03:25:30+00:00" }, { "name": "unocha/ocha_monitoring", diff --git a/config/ocha_ai_chat.settings.yml b/config/ocha_ai_chat.settings.yml index 9ace73f78..b84e9d296 100644 --- a/config/ocha_ai_chat.settings.yml +++ b/config/ocha_ai_chat.settings.yml @@ -53,6 +53,7 @@ plugins: reliefweb: api_url: 'https://api.reliefweb.int/v1' converter_url: 'https://reliefweb.int/search/converter/json' + site_url: 'https://reliefweb.int' appname: ocha-ai-chat cache_enabled: true cache_lifetime: 600 @@ -89,6 +90,6 @@ defaults: application/pdf: plugin_id: mupdf text_splitter: - plugin_id: sentence + plugin_id: token vector_store: plugin_id: elasticsearch From c0010e74a7359a01d6afe00925c68052d6925149 Mon Sep 17 00:00:00 2001 From: orakili Date: Thu, 18 Jan 2024 03:46:28 +0000 Subject: [PATCH 05/20] feat: alter ai chat form to show message when querying an unsupported report --- .../reliefweb_entities.module | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/html/modules/custom/reliefweb_entities/reliefweb_entities.module b/html/modules/custom/reliefweb_entities/reliefweb_entities.module index 016c4c800..dfbc92673 100644 --- a/html/modules/custom/reliefweb_entities/reliefweb_entities.module +++ b/html/modules/custom/reliefweb_entities/reliefweb_entities.module @@ -17,6 +17,7 @@ use Drupal\Core\Render\Element; use Drupal\media\MediaInterface; use Drupal\reliefweb_entities\BundleEntityInterface; use Drupal\reliefweb_entities\BundleEntityStorageInterface; +use Drupal\reliefweb_entities\Entity\Report; use Drupal\reliefweb_entities\EntityFormAlterServiceBase; use Drupal\reliefweb_utility\Helpers\ClassHelper; use Drupal\reliefweb_utility\Helpers\DateHelper; @@ -842,3 +843,63 @@ function reliefweb_entities_node_delete(EntityInterface $entity) { } } } + +/** + * Implements hook_form_FORM_ID_alter() for `ocha_ai_chat_chat_form`. + */ +function reliefweb_entities_form_ocha_ai_chat_chat_form_alter(array &$form, FormStateInterface $form_state, string $form_id) { + $url = \Drupal::request()?->query?->get('url'); + if (isset($url)) { + $router = \Drupal::service('router.no_access_checks'); + $parameters = $router->match($url); + $node = $parameters['node'] ?? NULL; + + if (isset($node) && $node instanceof Report) { + // No need to show the source when chatting with a single report. + if (isset($form['source'])) { + $form['source']['#access'] = FALSE; + } + + // Only English documents are supported due to LLM limitations. + $is_english_report = FALSE; + foreach ($node->field_language as $item) { + if ($item->target_id == 267) { + $is_english_report = TRUE; + break; + } + } + if (!$is_english_report) { + $reason = t('Sorry, only English reports are supported.'); + } + + // Non supported content formats. + foreach ($node->field_content_format as $item) { + if ($item->target_id == 12) { + $reason = t('Sorry, maps are not supported.'); + break; + } + elseif ($item->target_id == 12570) { + $reason = t('Sorry, infographics are not supported.'); + break; + } + elseif ($item->target_id == 38974) { + $reason = t('Sorry, interactive reports are not supported.'); + break; + } + } + + if (!empty($reason)) { + foreach (Element::children($form) as $key) { + $form[$key]['#access'] = FALSE; + } + $form['unsupported'] = [ + '#type' => 'inline_template', + '#template' => '

{{ reason }}

', + '#context' => [ + 'reason' => $reason, + ], + ]; + } + } + } +} From cbc5788361e8f52aae234d6faa66d018b81a4359 Mon Sep 17 00:00:00 2001 From: orakili Date: Thu, 18 Jan 2024 05:00:21 +0000 Subject: [PATCH 06/20] chore: update ocha_ai_chat_module --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 3c837c465..a1964a338 100644 --- a/composer.lock +++ b/composer.lock @@ -15882,16 +15882,16 @@ }, { "name": "unocha/ocha_ai_chat", - "version": "v0.0.3", + "version": "v0.0.4", "source": { "type": "git", "url": "https://github.com/UN-OCHA/ocha_ai_chat.git", - "reference": "c147bef247e637c8c81f0b85f62891369d30ea32" + "reference": "404bc6d71ed600886c9cff92a4ee0e4bd0500e0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/c147bef247e637c8c81f0b85f62891369d30ea32", - "reference": "c147bef247e637c8c81f0b85f62891369d30ea32", + "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/404bc6d71ed600886c9cff92a4ee0e4bd0500e0b", + "reference": "404bc6d71ed600886c9cff92a4ee0e4bd0500e0b", "shasum": "" }, "require": { @@ -15932,10 +15932,10 @@ ], "description": "OCHA AI Chat module", "support": { - "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/v0.0.3", + "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/v0.0.4", "issues": "https://github.com/UN-OCHA/ocha_ai_chat/issues" }, - "time": "2024-01-18T03:25:30+00:00" + "time": "2024-01-18T05:05:15+00:00" }, { "name": "unocha/ocha_monitoring", From 4bfb7aea78e3a8d604b5d98a3460cf42460b4faa Mon Sep 17 00:00:00 2001 From: orakili Date: Thu, 18 Jan 2024 07:55:47 +0000 Subject: [PATCH 07/20] chore: update ocha_ai_chat_module --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index a1964a338..e50f99eca 100644 --- a/composer.lock +++ b/composer.lock @@ -15882,16 +15882,16 @@ }, { "name": "unocha/ocha_ai_chat", - "version": "v0.0.4", + "version": "v0.0.5", "source": { "type": "git", "url": "https://github.com/UN-OCHA/ocha_ai_chat.git", - "reference": "404bc6d71ed600886c9cff92a4ee0e4bd0500e0b" + "reference": "3c62161a145f61f6d7c6db4821b7110e958c7ee0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/404bc6d71ed600886c9cff92a4ee0e4bd0500e0b", - "reference": "404bc6d71ed600886c9cff92a4ee0e4bd0500e0b", + "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/3c62161a145f61f6d7c6db4821b7110e958c7ee0", + "reference": "3c62161a145f61f6d7c6db4821b7110e958c7ee0", "shasum": "" }, "require": { @@ -15932,10 +15932,10 @@ ], "description": "OCHA AI Chat module", "support": { - "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/v0.0.4", + "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/v0.0.5", "issues": "https://github.com/UN-OCHA/ocha_ai_chat/issues" }, - "time": "2024-01-18T05:05:15+00:00" + "time": "2024-01-18T07:54:22+00:00" }, { "name": "unocha/ocha_monitoring", From a90322a48cc44feed170cb56cb752a49bd26815c Mon Sep 17 00:00:00 2001 From: Chris Ruppel Date: Wed, 31 Jan 2024 16:33:13 +0100 Subject: [PATCH 08/20] fix(ux): simpler template for OCHA AI Chat Refs: RW-857, un-ocha/ocha_ai_chat@81db5004 --- .../layout/page--ai--chat--popup.html.twig | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig diff --git a/html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig b/html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig new file mode 100644 index 000000000..7982aec2f --- /dev/null +++ b/html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig @@ -0,0 +1,54 @@ +{# +/** + * @file + * Theme override to display a single page. + * + * The doctype, html, head and body tags are not in this template. Instead they + * can be found in the html.html.twig template in this directory. + * + * Available variables: + * + * General utility variables: + * - base_path: The base URL path of the Drupal installation. Will usually be + * "/" unless you have installed Drupal in a sub-directory. + * - is_front: A flag indicating if the current page is the front page. + * - logged_in: A flag indicating if the user is registered and signed in. + * - is_admin: A flag indicating if the user has permission to access + * administration pages. + * + * Site identity: + * - front_page: The URL of the front page. Use this instead of base_path when + * linking to the front page. This includes the language domain or prefix. + * + * Page content (in order of occurrence in the default page.html.twig): + * - node: Fully loaded node, if there is an automatically-loaded node + * associated with the page and the node ID is the second argument in the + * page's path (e.g. node/12345 and node/12345/revisions, but not + * comment/reply/12345). + * + * Regions: + * - page.header: Items for the header region. + * - page.primary_menu: Items for the primary menu region. + * - page.secondary_menu: Items for the secondary menu region. + * - page.highlighted: Items for the highlighted content region. + * - page.help: Dynamic help text, mostly for admin pages. + * - page.content: The main content of the current page. + * - page.sidebar_first: Items for the first sidebar. + * - page.sidebar_second: Items for the second sidebar. + * - page.footer: Items for the footer region. + * - page.breadcrumb: Items for the breadcrumb region. + * + * @see template_preprocess_page() + * @see html.html.twig + */ +#} +
+ {# Link to skip to the main content is in html.html.twig #} +
+ {{ page.page_title }} + +
+ {{ page.content }} +
{# /.cd-layout__content #} +
+
From 415a21242adf888cf67c2c39644074c38659e69f Mon Sep 17 00:00:00 2001 From: Chris Ruppel Date: Thu, 1 Feb 2024 14:35:22 +0100 Subject: [PATCH 09/20] fix(ux): remove unnecessary page title from template Refs: RW-857, un-ocha/ocha_ai_chat@4127406e --- .../templates/layout/page--ai--chat--popup.html.twig | 2 -- 1 file changed, 2 deletions(-) diff --git a/html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig b/html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig index 7982aec2f..d877f5900 100644 --- a/html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig +++ b/html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig @@ -45,8 +45,6 @@
{# Link to skip to the main content is in html.html.twig #}
- {{ page.page_title }} -
{{ page.content }}
{# /.cd-layout__content #} From 73d45d4c23688bc839f504cedb82297ea8869c7f Mon Sep 17 00:00:00 2001 From: Chris Ruppel Date: Wed, 7 Feb 2024 10:02:44 +0100 Subject: [PATCH 10/20] style: remove old markup comment Refs: RW-857 --- .../templates/layout/page--ai--chat--popup.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig b/html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig index d877f5900..c8d1e8b7e 100644 --- a/html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig +++ b/html/themes/custom/common_design_subtheme/templates/layout/page--ai--chat--popup.html.twig @@ -47,6 +47,6 @@
{{ page.content }} -
{# /.cd-layout__content #} +
From 6eccb36c71aac88d3255f730452c661687e4402e Mon Sep 17 00:00:00 2001 From: unocha-jenkins Date: Thu, 8 Feb 2024 06:35:36 +0000 Subject: [PATCH 11/20] chore: Update all outdated drupal/* packages. --- composer.lock | 193 +++++++++++++++++++++++--------------------------- 1 file changed, 89 insertions(+), 104 deletions(-) diff --git a/composer.lock b/composer.lock index 04b870c7d..0691795e4 100644 --- a/composer.lock +++ b/composer.lock @@ -2098,16 +2098,16 @@ }, { "name": "doctrine/lexer", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" + "reference": "861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6", + "reference": "861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6", "shasum": "" }, "require": { @@ -2115,11 +2115,11 @@ "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^10", + "doctrine/coding-standard": "^9 || ^12", "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^4.11 || ^5.0" + "vimeo/psalm": "^4.11 || ^5.21" }, "type": "library", "autoload": { @@ -2156,7 +2156,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/2.1.0" + "source": "https://github.com/doctrine/lexer/tree/2.1.1" }, "funding": [ { @@ -2172,7 +2172,7 @@ "type": "tidelift" } ], - "time": "2022-12-14T08:49:07+00:00" + "time": "2024-02-05T11:35:39+00:00" }, { "name": "drupal/admin_denied", @@ -2630,16 +2630,16 @@ }, { "name": "drupal/core", - "version": "10.2.2", + "version": "10.2.3", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "fc9abad1ab687635a5eddec00aa1a5f2a29a23bd" + "reference": "cc8c7952f7013795b735f5c15290e76937163bb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/fc9abad1ab687635a5eddec00aa1a5f2a29a23bd", - "reference": "fc9abad1ab687635a5eddec00aa1a5f2a29a23bd", + "url": "https://api.github.com/repos/drupal/core/zipball/cc8c7952f7013795b735f5c15290e76937163bb7", + "reference": "cc8c7952f7013795b735f5c15290e76937163bb7", "shasum": "" }, "require": { @@ -2787,22 +2787,22 @@ ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", "support": { - "source": "https://github.com/drupal/core/tree/10.2.2" + "source": "https://github.com/drupal/core/tree/10.2.3" }, - "time": "2024-01-16T21:10:58+00:00" + "time": "2024-02-07T22:44:48+00:00" }, { "name": "drupal/core-composer-scaffold", - "version": "10.2.2", + "version": "10.2.3", "source": { "type": "git", "url": "https://github.com/drupal/core-composer-scaffold.git", - "reference": "97bd91856535a354e9b1b815f0957893e26b6622" + "reference": "63effa1bc644e80a269e8b4415e627491d26fd3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-composer-scaffold/zipball/97bd91856535a354e9b1b815f0957893e26b6622", - "reference": "97bd91856535a354e9b1b815f0957893e26b6622", + "url": "https://api.github.com/repos/drupal/core-composer-scaffold/zipball/63effa1bc644e80a269e8b4415e627491d26fd3f", + "reference": "63effa1bc644e80a269e8b4415e627491d26fd3f", "shasum": "" }, "require": { @@ -2837,13 +2837,13 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-composer-scaffold/tree/10.2.2" + "source": "https://github.com/drupal/core-composer-scaffold/tree/10.2.3" }, - "time": "2023-11-15T23:23:28+00:00" + "time": "2024-01-26T14:59:30+00:00" }, { "name": "drupal/core-dev", - "version": "10.2.2", + "version": "10.2.3", "source": { "type": "git", "url": "https://github.com/drupal/core-dev.git", @@ -2893,22 +2893,22 @@ ], "description": "require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.", "support": { - "source": "https://github.com/drupal/core-dev/tree/10.2.2" + "source": "https://github.com/drupal/core-dev/tree/10.2.3" }, "time": "2023-12-12T22:01:45+00:00" }, { "name": "drupal/core-recommended", - "version": "10.2.2", + "version": "10.2.3", "source": { "type": "git", "url": "https://github.com/drupal/core-recommended.git", - "reference": "d8cb769d86449af5ad763f3517c7f3c0e226ed60" + "reference": "ee5d148455ca5792108a1fd007ae162ea2ffe859" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-recommended/zipball/d8cb769d86449af5ad763f3517c7f3c0e226ed60", - "reference": "d8cb769d86449af5ad763f3517c7f3c0e226ed60", + "url": "https://api.github.com/repos/drupal/core-recommended/zipball/ee5d148455ca5792108a1fd007ae162ea2ffe859", + "reference": "ee5d148455ca5792108a1fd007ae162ea2ffe859", "shasum": "" }, "require": { @@ -2917,7 +2917,7 @@ "doctrine/annotations": "~1.14.3", "doctrine/deprecations": "~1.1.2", "doctrine/lexer": "~2.1.0", - "drupal/core": "10.2.2", + "drupal/core": "10.2.3", "egulias/email-validator": "~4.0.2", "guzzlehttp/guzzle": "~7.8.1", "guzzlehttp/promises": "~2.0.2", @@ -2978,9 +2978,9 @@ ], "description": "Core and its dependencies with known-compatible minor versions. Require this project INSTEAD OF drupal/core.", "support": { - "source": "https://github.com/drupal/core-recommended/tree/10.2.2" + "source": "https://github.com/drupal/core-recommended/tree/10.2.3" }, - "time": "2024-01-16T21:10:58+00:00" + "time": "2024-02-07T22:44:48+00:00" }, { "name": "drupal/ctools", @@ -7531,16 +7531,16 @@ }, { "name": "open-telemetry/api", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "401d04c6afe349afa78250ac862db2f89dbf94f6" + "reference": "87de95d926f46262885d0d390060c095af13e2e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/401d04c6afe349afa78250ac862db2f89dbf94f6", - "reference": "401d04c6afe349afa78250ac862db2f89dbf94f6", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/87de95d926f46262885d0d390060c095af13e2e5", + "reference": "87de95d926f46262885d0d390060c095af13e2e5", "shasum": "" }, "require": { @@ -7594,7 +7594,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-01-10T13:04:59+00:00" + "time": "2024-02-06T01:32:25+00:00" }, { "name": "open-telemetry/context", @@ -7786,16 +7786,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.0.7", + "version": "1.0.8", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "818263750d299df5b9612a738440e56d92e5a296" + "reference": "1da4c0ca4f1a3c0fe84b81729dadec16f464fa77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/818263750d299df5b9612a738440e56d92e5a296", - "reference": "818263750d299df5b9612a738440e56d92e5a296", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/1da4c0ca4f1a3c0fe84b81729dadec16f464fa77", + "reference": "1da4c0ca4f1a3c0fe84b81729dadec16f464fa77", "shasum": "" }, "require": { @@ -7865,7 +7865,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-01-24T12:00:22+00:00" + "time": "2024-02-02T03:42:40+00:00" }, { "name": "open-telemetry/sem-conv", @@ -8447,16 +8447,16 @@ }, { "name": "phenx/php-font-lib", - "version": "0.5.5", + "version": "0.5.6", "source": { "type": "git", "url": "https://github.com/dompdf/php-font-lib.git", - "reference": "671df0f3516252011aa94f9e8e3b3b66199339f8" + "reference": "a1681e9793040740a405ac5b189275059e2a9863" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/671df0f3516252011aa94f9e8e3b3b66199339f8", - "reference": "671df0f3516252011aa94f9e8e3b3b66199339f8", + "url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/a1681e9793040740a405ac5b189275059e2a9863", + "reference": "a1681e9793040740a405ac5b189275059e2a9863", "shasum": "" }, "require": { @@ -8485,9 +8485,9 @@ "homepage": "https://github.com/PhenX/php-font-lib", "support": { "issues": "https://github.com/dompdf/php-font-lib/issues", - "source": "https://github.com/dompdf/php-font-lib/tree/0.5.5" + "source": "https://github.com/dompdf/php-font-lib/tree/0.5.6" }, - "time": "2024-01-07T18:13:29+00:00" + "time": "2024-01-29T14:45:26+00:00" }, { "name": "phootwork/collection", @@ -11544,16 +11544,16 @@ }, { "name": "seld/jsonlint", - "version": "1.10.1", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "76d449a358ece77d6f1d6331c68453e657172202" + "reference": "9bb7db07b5d66d90f6ebf542f09fc67d800e5259" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/76d449a358ece77d6f1d6331c68453e657172202", - "reference": "76d449a358ece77d6f1d6331c68453e657172202", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9bb7db07b5d66d90f6ebf542f09fc67d800e5259", + "reference": "9bb7db07b5d66d90f6ebf542f09fc67d800e5259", "shasum": "" }, "require": { @@ -11592,7 +11592,7 @@ ], "support": { "issues": "https://github.com/Seldaek/jsonlint/issues", - "source": "https://github.com/Seldaek/jsonlint/tree/1.10.1" + "source": "https://github.com/Seldaek/jsonlint/tree/1.10.2" }, "funding": [ { @@ -11604,7 +11604,7 @@ "type": "tidelift" } ], - "time": "2023-12-18T13:03:25+00:00" + "time": "2024-02-07T12:57:50+00:00" }, { "name": "seld/phar-utils", @@ -13734,16 +13734,16 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" + "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/861391a8da9a04cbad2d232ddd9e4893220d6e25", + "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25", "shasum": "" }, "require": { @@ -13751,9 +13751,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -13790,7 +13787,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.29.0" }, "funding": [ { @@ -13806,20 +13803,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", "shasum": "" }, "require": { @@ -13827,9 +13824,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -13869,7 +13863,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" }, "funding": [ { @@ -13885,20 +13879,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -13906,9 +13900,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -13952,7 +13943,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -13968,20 +13959,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b" + "reference": "c565ad1e63f30e7477fc40738343c62b40bc672d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/7581cd600fa9fd681b797d00b02f068e2f13263b", - "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/c565ad1e63f30e7477fc40738343c62b40bc672d", + "reference": "c565ad1e63f30e7477fc40738343c62b40bc672d", "shasum": "" }, "require": { @@ -13989,9 +13980,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -14031,7 +14019,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.29.0" }, "funding": [ { @@ -14047,20 +14035,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php82", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php82.git", - "reference": "7716bea9c86776fb3362d6b52fe1fc9471056a49" + "reference": "559d488c38784112c78b9bf17c5ce8366a265643" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/7716bea9c86776fb3362d6b52fe1fc9471056a49", - "reference": "7716bea9c86776fb3362d6b52fe1fc9471056a49", + "url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/559d488c38784112c78b9bf17c5ce8366a265643", + "reference": "559d488c38784112c78b9bf17c5ce8366a265643", "shasum": "" }, "require": { @@ -14068,9 +14056,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -14110,7 +14095,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php82/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php82/tree/v1.29.0" }, "funding": [ { @@ -14126,7 +14111,7 @@ "type": "tidelift" } ], - "time": "2023-08-25T17:27:25+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php83", @@ -15956,17 +15941,17 @@ }, { "name": "drupal/devel_php", - "version": "1.5.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/devel_php.git", - "reference": "8.x-1.5" + "reference": "8.x-1.6" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/devel_php-8.x-1.5.zip", - "reference": "8.x-1.5", - "shasum": "eca4f0fba9f89ffcc104478a1107de2e2f9fe926" + "url": "https://ftp.drupal.org/files/projects/devel_php-8.x-1.6.zip", + "reference": "8.x-1.6", + "shasum": "c65b291b39f70275ed47f82a7fb25d23f3ec3640" }, "require": { "drupal/core": "^9.2 || ^10", @@ -15975,8 +15960,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.5", - "datestamp": "1649422110", + "version": "8.x-1.6", + "datestamp": "1706781306", "security-coverage": { "status": "not-covered", "message": "Project has not opted into security advisory coverage!" From fcc5f9300850dee8aca302dac506cc217f8a9faf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 23:26:27 +0000 Subject: [PATCH 12/20] chore(deps): bump composer/composer from 2.6.6 to 2.7.0 Bumps [composer/composer](https://github.com/composer/composer) from 2.6.6 to 2.7.0. - [Release notes](https://github.com/composer/composer/releases) - [Changelog](https://github.com/composer/composer/blob/main/CHANGELOG.md) - [Commits](https://github.com/composer/composer/compare/2.6.6...2.7.0) --- updated-dependencies: - dependency-name: composer/composer dependency-type: indirect ... Signed-off-by: dependabot[bot] --- composer.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 0691795e4..93006eae0 100644 --- a/composer.lock +++ b/composer.lock @@ -556,16 +556,16 @@ }, { "name": "composer/composer", - "version": "2.6.6", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "683557bd2466072777309d039534bb1332d0dda5" + "reference": "96d107e2bfe61bb9eafe55a9d45bd7faed1dd461" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/683557bd2466072777309d039534bb1332d0dda5", - "reference": "683557bd2466072777309d039534bb1332d0dda5", + "url": "https://api.github.com/repos/composer/composer/zipball/96d107e2bfe61bb9eafe55a9d45bd7faed1dd461", + "reference": "96d107e2bfe61bb9eafe55a9d45bd7faed1dd461", "shasum": "" }, "require": { @@ -583,7 +583,7 @@ "seld/jsonlint": "^1.4", "seld/phar-utils": "^1.2", "seld/signal-handler": "^2.0", - "symfony/console": "^5.4.11 || ^6.0.11", + "symfony/console": "^5.4.11 || ^6.0.11 || ^7", "symfony/filesystem": "^5.4 || ^6.0 || ^7", "symfony/finder": "^5.4 || ^6.0 || ^7", "symfony/polyfill-php73": "^1.24", @@ -597,7 +597,7 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1", "phpstan/phpstan-symfony": "^1.2.10", - "symfony/phpunit-bridge": "^6.0 || ^7" + "symfony/phpunit-bridge": "^6.4.1 || ^7.0.1" }, "suggest": { "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", @@ -610,7 +610,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.6-dev" + "dev-main": "2.7-dev" }, "phpstan": { "includes": [ @@ -650,7 +650,7 @@ "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", "security": "https://github.com/composer/composer/security/policy", - "source": "https://github.com/composer/composer/tree/2.6.6" + "source": "https://github.com/composer/composer/tree/2.7.0" }, "funding": [ { @@ -666,7 +666,7 @@ "type": "tidelift" } ], - "time": "2023-12-08T17:32:26+00:00" + "time": "2024-02-08T14:09:19+00:00" }, { "name": "composer/installers", From 13a9c0d8aeab3a6197dabea1691906b3b6c1fb80 Mon Sep 17 00:00:00 2001 From: left23 Date: Mon, 12 Feb 2024 11:01:15 +0100 Subject: [PATCH 13/20] chore: replace hum insight with hum action Refs: RW-886 --- .../templates/cd/cd-header/cd-ocha.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/themes/custom/common_design_subtheme/templates/cd/cd-header/cd-ocha.html.twig b/html/themes/custom/common_design_subtheme/templates/cd/cd-header/cd-ocha.html.twig index fe6ff99c3..cbd305763 100644 --- a/html/themes/custom/common_design_subtheme/templates/cd/cd-header/cd-ocha.html.twig +++ b/html/themes/custom/common_design_subtheme/templates/cd/cd-header/cd-ocha.html.twig @@ -3,7 +3,7 @@ {% block related_platforms %} - + {% endblock %} From 7aa6d359a634a5e796e012887c26f2aed2f3fb4a Mon Sep 17 00:00:00 2001 From: Peter Lieverdink Date: Mon, 12 Feb 2024 23:36:32 +0000 Subject: [PATCH 14/20] fix: Update the composer invocation to allow running as root. And do a bit of tidying up as well. No NODE_ENV is needed because we no longer use node. --- docker/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 974bf4936..200c96625 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,15 +3,16 @@ FROM public.ecr.aws/unocha/php-k8s:8.2-stable as builder ARG BRANCH_ENVIRONMENT -ENV NODE_ENV=$BRANCH_ENVIRONMENT - # Copy only the files necessary to build the code (see .dockerignore in root). COPY . /srv/www WORKDIR /srv/www # Clean up previous composer installation and run new one. -RUN rm -rf ./vendor && composer install --no-interaction --no-dev +RUN rm -rf ./vendor && \ + COMPOSER_ALLOW_SUPERUSER=1 \ + COMPOSER_MEMORY_LIMIT=-1 \ + composer install --no-interaction --no-dev --prefer-dist # Copy settings to default site location. RUN cp -a docker/settings.php docker/services.yml docker/memcache.services.yml html/sites/default From 50424ad6cb6e6a45f05a89f281083f68c7881bfc Mon Sep 17 00:00:00 2001 From: unocha-jenkins Date: Thu, 15 Feb 2024 06:35:57 +0000 Subject: [PATCH 15/20] chore: Update all outdated drupal/* packages. --- composer.lock | 118 ++++++++++++-------------------------------------- 1 file changed, 28 insertions(+), 90 deletions(-) diff --git a/composer.lock b/composer.lock index 93006eae0..3ec5e4150 100644 --- a/composer.lock +++ b/composer.lock @@ -556,16 +556,16 @@ }, { "name": "composer/composer", - "version": "2.7.0", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "96d107e2bfe61bb9eafe55a9d45bd7faed1dd461" + "reference": "aaf6ed5ccd27c23f79a545e351b4d7842a99d0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/96d107e2bfe61bb9eafe55a9d45bd7faed1dd461", - "reference": "96d107e2bfe61bb9eafe55a9d45bd7faed1dd461", + "url": "https://api.github.com/repos/composer/composer/zipball/aaf6ed5ccd27c23f79a545e351b4d7842a99d0bc", + "reference": "aaf6ed5ccd27c23f79a545e351b4d7842a99d0bc", "shasum": "" }, "require": { @@ -650,7 +650,7 @@ "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", "security": "https://github.com/composer/composer/security/policy", - "source": "https://github.com/composer/composer/tree/2.7.0" + "source": "https://github.com/composer/composer/tree/2.7.1" }, "funding": [ { @@ -666,7 +666,7 @@ "type": "tidelift" } ], - "time": "2024-02-08T14:09:19+00:00" + "time": "2024-02-09T14:26:28+00:00" }, { "name": "composer/installers", @@ -2338,16 +2338,16 @@ }, { "name": "drupal/coder", - "version": "8.3.22", + "version": "8.3.23", "source": { "type": "git", "url": "https://github.com/pfrenssen/coder.git", - "reference": "ba6e62303d567863275fb086941f50a06dc7d08f" + "reference": "1a1613d83c08dac5be593f2775c9eccae1b41805" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pfrenssen/coder/zipball/ba6e62303d567863275fb086941f50a06dc7d08f", - "reference": "ba6e62303d567863275fb086941f50a06dc7d08f", + "url": "https://api.github.com/repos/pfrenssen/coder/zipball/1a1613d83c08dac5be593f2775c9eccae1b41805", + "reference": "1a1613d83c08dac5be593f2775c9eccae1b41805", "shasum": "" }, "require": { @@ -2385,7 +2385,7 @@ "issues": "https://www.drupal.org/project/issues/coder", "source": "https://www.drupal.org/project/coder" }, - "time": "2023-10-15T09:55:50+00:00" + "time": "2024-01-27T18:13:12+00:00" }, { "name": "drupal/components", @@ -5152,22 +5152,21 @@ }, { "name": "enshrined/svg-sanitize", - "version": "0.16.0", + "version": "0.17.0", "source": { "type": "git", "url": "https://github.com/darylldoyle/svg-sanitizer.git", - "reference": "239e257605e2141265b429e40987b2ee51bba4b4" + "reference": "a1af5cd21636306414da3f6ad4707b98c7601582" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/239e257605e2141265b429e40987b2ee51bba4b4", - "reference": "239e257605e2141265b429e40987b2ee51bba4b4", + "url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/a1af5cd21636306414da3f6ad4707b98c7601582", + "reference": "a1af5cd21636306414da3f6ad4707b98c7601582", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", - "ezyang/htmlpurifier": "^4.16", "php": "^5.6 || ^7.0 || ^8.0" }, "require-dev": { @@ -5192,70 +5191,9 @@ "description": "An SVG sanitizer for PHP", "support": { "issues": "https://github.com/darylldoyle/svg-sanitizer/issues", - "source": "https://github.com/darylldoyle/svg-sanitizer/tree/0.16.0" - }, - "time": "2023-03-20T10:51:12+00:00" - }, - { - "name": "ezyang/htmlpurifier", - "version": "v4.17.0", - "source": { - "type": "git", - "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/bbc513d79acf6691fa9cf10f192c90dd2957f18c", - "reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c", - "shasum": "" - }, - "require": { - "php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0" - }, - "require-dev": { - "cerdic/css-tidy": "^1.7 || ^2.0", - "simpletest/simpletest": "dev-master" - }, - "suggest": { - "cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.", - "ext-bcmath": "Used for unit conversion and imagecrash protection", - "ext-iconv": "Converts text to and from non-UTF-8 encodings", - "ext-tidy": "Used for pretty-printing HTML" - }, - "type": "library", - "autoload": { - "files": [ - "library/HTMLPurifier.composer.php" - ], - "psr-0": { - "HTMLPurifier": "library/" - }, - "exclude-from-classmap": [ - "/library/HTMLPurifier/Language/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1-or-later" - ], - "authors": [ - { - "name": "Edward Z. Yang", - "email": "admin@htmlpurifier.org", - "homepage": "http://ezyang.com" - } - ], - "description": "Standards compliant HTML filter written in PHP", - "homepage": "http://htmlpurifier.org/", - "keywords": [ - "html" - ], - "support": { - "issues": "https://github.com/ezyang/htmlpurifier/issues", - "source": "https://github.com/ezyang/htmlpurifier/tree/v4.17.0" + "source": "https://github.com/darylldoyle/svg-sanitizer/tree/0.17.0" }, - "time": "2023-11-17T15:01:25+00:00" + "time": "2024-02-14T17:34:36+00:00" }, { "name": "fileeye/mimemap", @@ -7059,16 +6997,16 @@ }, { "name": "mglaman/phpstan-drupal", - "version": "1.2.6", + "version": "1.2.7", "source": { "type": "git", "url": "https://github.com/mglaman/phpstan-drupal.git", - "reference": "ba8678f8cbea42cc41022c21751004eb677cf5a4" + "reference": "32f79fcf48c74532014248687ae3850581a22416" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/ba8678f8cbea42cc41022c21751004eb677cf5a4", - "reference": "ba8678f8cbea42cc41022c21751004eb677cf5a4", + "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/32f79fcf48c74532014248687ae3850581a22416", + "reference": "32f79fcf48c74532014248687ae3850581a22416", "shasum": "" }, "require": { @@ -7143,7 +7081,7 @@ "description": "Drupal extension and rules for PHPStan", "support": { "issues": "https://github.com/mglaman/phpstan-drupal/issues", - "source": "https://github.com/mglaman/phpstan-drupal/tree/1.2.6" + "source": "https://github.com/mglaman/phpstan-drupal/tree/1.2.7" }, "funding": [ { @@ -7159,7 +7097,7 @@ "type": "tidelift" } ], - "time": "2024-01-16T00:42:10+00:00" + "time": "2024-02-14T04:38:08+00:00" }, { "name": "micheh/phpcs-gitlab", @@ -9276,16 +9214,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.57", + "version": "1.10.58", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" + "reference": "a23518379ec4defd9e47cbf81019526861623ec2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a23518379ec4defd9e47cbf81019526861623ec2", + "reference": "a23518379ec4defd9e47cbf81019526861623ec2", "shasum": "" }, "require": { @@ -9334,7 +9272,7 @@ "type": "tidelift" } ], - "time": "2024-01-24T11:51:34+00:00" + "time": "2024-02-12T20:02:57+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", From 3253cfcdc7782df4a86023a61c48beabd133cae3 Mon Sep 17 00:00:00 2001 From: orakili Date: Thu, 15 Feb 2024 09:58:06 +0000 Subject: [PATCH 16/20] feat: use new OCHA AI module Refs: OPS-10081 --- composer.json | 4 +- composer.lock | 42 ++++++++--------- config/core.extension.yml | 1 + config/ocha_ai.settings.yml | 78 +++++++++++++++++++++++++++++++ config/ocha_ai_chat.settings.yml | 80 -------------------------------- 5 files changed, 102 insertions(+), 103 deletions(-) create mode 100644 config/ocha_ai.settings.yml diff --git a/composer.json b/composer.json index 0a339cc0d..d4b1b69c6 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, { "type": "vcs", - "url": "https://github.com/UN-OCHA/ocha_ai_chat.git" + "url": "https://github.com/UN-OCHA/ocha_ai.git" } ], "require": { @@ -75,7 +75,7 @@ "reliefweb/simple-datepicker": "^v1.3", "symfony/uid": "^6.2", "unocha/common_design": "^9", - "unocha/ocha_ai_chat": "^0.0", + "unocha/ocha_ai": "^1.0", "unocha/ocha_monitoring": "^1.0", "webflo/drupal-finder": "^1.2.2" }, diff --git a/composer.lock b/composer.lock index c3737376d..2c8ea40f9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3855da6623ddf6d2cfe0743e06e9b59a", + "content-hash": "c263550e3f43641ae8261ebbcf1c1872", "packages": [ { "name": "asm89/stack-cors", @@ -118,16 +118,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.296.1", + "version": "3.299.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "38e47bbd3b5f76f008dd71c8a68545f9e4e47b6b" + "reference": "76d1165568d949b430a87eaa42f6dbc4b6705b6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/38e47bbd3b5f76f008dd71c8a68545f9e4e47b6b", - "reference": "38e47bbd3b5f76f008dd71c8a68545f9e4e47b6b", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/76d1165568d949b430a87eaa42f6dbc4b6705b6f", + "reference": "76d1165568d949b430a87eaa42f6dbc4b6705b6f", "shasum": "" }, "require": { @@ -207,9 +207,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.296.1" + "source": "https://github.com/aws/aws-sdk-php/tree/3.299.0" }, - "time": "2024-01-14T05:20:33+00:00" + "time": "2024-02-15T19:08:34+00:00" }, { "name": "behat/mink", @@ -3840,7 +3840,7 @@ "shasum": "fc8ea60619b6b4682bade340e13fb4565d3a7e0c" }, "require": { - "drupal/core": "^9.1 || ^10" + "drupal/core": "^10" }, "type": "drupal-module", "extra": { @@ -4039,7 +4039,7 @@ "shasum": "c25246747dac4372c7d5a5a5fd0f276d9e468eff" }, "require": { - "drupal/core": "^9.3 || ^10", + "drupal/core": "^10", "drupal/mailsystem": "^4" }, "require-dev": { @@ -4741,7 +4741,7 @@ "shasum": "77906ae731878b68a181f82b073617b798e5f110" }, "require": { - "drupal/core": "^9.3 || ^10", + "drupal/core": "^10", "enshrined/svg-sanitize": ">=0.15 <1.0" }, "type": "drupal-module", @@ -4889,7 +4889,7 @@ "shasum": "9ea9eee91cf75f21fcc939704baa6a7ec10d7748" }, "require": { - "drupal/core": "^8.9 || ^9 || ^10" + "drupal/core": "^10" }, "type": "drupal-module", "extra": { @@ -15881,17 +15881,17 @@ "time": "2024-01-17T09:30:38+00:00" }, { - "name": "unocha/ocha_ai_chat", - "version": "v0.0.5", + "name": "unocha/ocha_ai", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/UN-OCHA/ocha_ai_chat.git", - "reference": "3c62161a145f61f6d7c6db4821b7110e958c7ee0" + "url": "https://github.com/UN-OCHA/ocha_ai.git", + "reference": "e87d9e7d4a9e65d831c21f3a58cb582ee6c79356" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_ai_chat/zipball/3c62161a145f61f6d7c6db4821b7110e958c7ee0", - "reference": "3c62161a145f61f6d7c6db4821b7110e958c7ee0", + "url": "https://api.github.com/repos/UN-OCHA/ocha_ai/zipball/e87d9e7d4a9e65d831c21f3a58cb582ee6c79356", + "reference": "e87d9e7d4a9e65d831c21f3a58cb582ee6c79356", "shasum": "" }, "require": { @@ -15930,12 +15930,12 @@ "role": "" } ], - "description": "OCHA AI Chat module", + "description": "OCHA AI module", "support": { - "source": "https://github.com/UN-OCHA/ocha_ai_chat/tree/v0.0.5", - "issues": "https://github.com/UN-OCHA/ocha_ai_chat/issues" + "source": "https://github.com/UN-OCHA/ocha_ai/tree/v1.0.0", + "issues": "https://github.com/UN-OCHA/ocha_ai/issues" }, - "time": "2024-01-18T07:54:22+00:00" + "time": "2024-02-15T08:35:26+00:00" }, { "name": "unocha/ocha_monitoring", diff --git a/config/core.extension.yml b/config/core.extension.yml index 4d3907910..e05333a5e 100644 --- a/config/core.extension.yml +++ b/config/core.extension.yml @@ -51,6 +51,7 @@ module: monitoring: 0 mysql: 0 node: 0 + ocha_ai: 0 ocha_ai_chat: 0 ocha_monitoring: 0 options: 0 diff --git a/config/ocha_ai.settings.yml b/config/ocha_ai.settings.yml new file mode 100644 index 000000000..a9114cf11 --- /dev/null +++ b/config/ocha_ai.settings.yml @@ -0,0 +1,78 @@ +plugins: + completion: + aws_bedrock: + model: amazon.titan-text-express-v1 + endpoint: '' + version: '' + region: REPLACE_WITH_REGION + api_key: REPLACE_WITH_KEY + max_tokens: 512 + prompt_template: |- + {{ context }} + + Based solely on the information above, please answer the following question. Please do not make things up and say you don't know if you cannot answer. + + {{ question }} + api_secret: REPLACE_WITH_SECRET + role_arn: null + azure_openai: + model: gpt-3.5-turbo + endpoint: REPLACE_WITH_ENDPOINT + version: '2023-05-15' + region: REPLACE_WITH_REGION + api_key: REPLACE_WITH_KEY + max_tokens: 512 + prompt_template: |- + Based solely on the information below, please answer the user's question. Please do not make things up and say you don't know if you cannot answer. + + {{ context }} + embedding: + aws_bedrock: + model: amazon.titan-embed-text-v1 + endpoint: '' + version: '' + region: REPLACE_WITH_REGION + api_key: REPLACE_WITH_KEY + batch_size: 1 + dimensions: 1536 + max_tokens: 8192 + api_secret: REPLACE_WITH_SECRET + role_arn: null + azure_openai: + model: text-embedding-ada-002 + endpoint: REPLACE_WITH_ENDPOINT + version: '2023-05-15' + region: REPLACE_WITH_REGION + api_key: REPLACE_WITH_KEY + batch_size: 16 + dimensions: 1536 + max_tokens: 4096 + source: + reliefweb: + api_url: 'https://api.reliefweb.int/v1' + converter_url: 'https://reliefweb.int/search/converter/json' + site_url: 'https://reliefweb.int' + appname: ocha-ai + cache_enabled: true + cache_lifetime: 600 + text_extractor: + mupdf: + mutool: /usr/bin/mutool + text_splitter: + token: + length: 384 + overlap: 96 + sentence: + length: 4 + overlap: 2 + page: + length: 1 + overlap: 0 + vector_store: + elasticsearch: + url: REPLACE_WITH_URL + base_index_name: ocha_ai + indexing_batch_size: 10 + topk: 5 + min_similarity: 0.3 + cutoff_coefficient: 0.5 diff --git a/config/ocha_ai_chat.settings.yml b/config/ocha_ai_chat.settings.yml index b84e9d296..024d1a93b 100644 --- a/config/ocha_ai_chat.settings.yml +++ b/config/ocha_ai_chat.settings.yml @@ -1,83 +1,3 @@ -_core: - default_config_hash: sEceqho82ErW-swOq9gnnEcaTFTiX_lrtpKL2ypdmmg -plugins: - completion: - aws_bedrock: - model: amazon.titan-text-express-v1 - endpoint: '' - version: '' - region: REPLACE_WITH_REGION - api_key: REPLACE_WITH_KEY - max_tokens: 512 - prompt_template: |- - {{ context }} - - Based solely on the information above, please answer the following question. Please do not make things up and say you don't know if you cannot answer. - - {{ question }} - api_secret: REPLACE_WITH_SECRET - role_arn: null - azure_openai: - model: gpt-3.5-turbo - endpoint: REPLACE_WITH_ENDPOINT - version: '2023-05-15' - region: REPLACE_WITH_REGION - api_key: REPLACE_WITH_KEY - max_tokens: 512 - prompt_template: |- - Based solely on the information below, please answer the user's question. Please do not make things up and say you don't know if you cannot answer. - - {{ context }} - embedding: - aws_bedrock: - model: amazon.titan-embed-text-v1 - endpoint: '' - version: '' - region: REPLACE_WITH_REGION - api_key: REPLACE_WITH_KEY - batch_size: 1 - dimensions: 1536 - max_tokens: 8192 - api_secret: REPLACE_WITH_SECRET - role_arn: null - azure_openai: - model: text-embedding-ada-002 - endpoint: REPLACE_WITH_ENDPOINT - version: '2023-05-15' - region: REPLACE_WITH_REGION - api_key: REPLACE_WITH_KEY - batch_size: 16 - dimensions: 1536 - max_tokens: 4096 - source: - reliefweb: - api_url: 'https://api.reliefweb.int/v1' - converter_url: 'https://reliefweb.int/search/converter/json' - site_url: 'https://reliefweb.int' - appname: ocha-ai-chat - cache_enabled: true - cache_lifetime: 600 - text_extractor: - mupdf: - mutool: /usr/bin/mutool - text_splitter: - token: - length: 384 - overlap: 96 - sentence: - length: 4 - overlap: 2 - page: - length: 1 - overlap: 0 - vector_store: - elasticsearch: - base_index_name: ocha_ai_chat - url: REPLACE_WITH_URL - indexing_batch_size: 10 - topk: 5 - min_similarity: 0.3 - cutoff_coefficient: 0.5 defaults: plugins: completion: From 3cc28dcb0e399a358fada3b400ac8403481fd16a Mon Sep 17 00:00:00 2001 From: orakili Date: Fri, 16 Feb 2024 02:26:48 +0000 Subject: [PATCH 17/20] fix: do not show the chat popup on the node forms Refs: OPS-10081 --- .../block.block.common_design_subtheme_ochaaichatpopup.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/block.block.common_design_subtheme_ochaaichatpopup.yml b/config/block.block.common_design_subtheme_ochaaichatpopup.yml index 339a479a6..70dd616d6 100644 --- a/config/block.block.common_design_subtheme_ochaaichatpopup.yml +++ b/config/block.block.common_design_subtheme_ochaaichatpopup.yml @@ -5,6 +5,7 @@ dependencies: module: - node - ocha_ai_chat + - system theme: - common_design_subtheme id: common_design_subtheme_ochaaichatpopup @@ -26,3 +27,7 @@ visibility: node: '@node.node_route_context:node' bundles: report: report + request_path: + id: request_path + negate: true + pages: '/node/*/*' From 82f62524cb93ed28d75e5a2159a1f22a4fc934d6 Mon Sep 17 00:00:00 2001 From: orakili Date: Fri, 16 Feb 2024 02:28:22 +0000 Subject: [PATCH 18/20] fix: update ocha_ai module to fix issue with chat instructions settings Refs: OPS-10081 --- composer.json | 4 ---- composer.lock | 31 ++++++++++--------------------- config/ocha_ai_chat.settings.yml | 4 ++++ 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index d4b1b69c6..2f6e03290 100644 --- a/composer.json +++ b/composer.json @@ -17,10 +17,6 @@ { "type": "composer", "url": "https://asset-packagist.org" - }, - { - "type": "vcs", - "url": "https://github.com/UN-OCHA/ocha_ai.git" } ], "require": { diff --git a/composer.lock b/composer.lock index 7ee78e415..4591899cc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c263550e3f43641ae8261ebbcf1c1872", + "content-hash": "619e13e717581ab4c7c2805ab415e53a", "packages": [ { "name": "asm89/stack-cors", @@ -15809,16 +15809,16 @@ }, { "name": "unocha/ocha_ai", - "version": "v1.0.0", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/UN-OCHA/ocha_ai.git", - "reference": "e87d9e7d4a9e65d831c21f3a58cb582ee6c79356" + "reference": "9fc3cdf0b9a425c521bdfa20b953c10eb1a6a6be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_ai/zipball/e87d9e7d4a9e65d831c21f3a58cb582ee6c79356", - "reference": "e87d9e7d4a9e65d831c21f3a58cb582ee6c79356", + "url": "https://api.github.com/repos/UN-OCHA/ocha_ai/zipball/9fc3cdf0b9a425c521bdfa20b953c10eb1a6a6be", + "reference": "9fc3cdf0b9a425c521bdfa20b953c10eb1a6a6be", "shasum": "" }, "require": { @@ -15837,32 +15837,21 @@ "phpcompatibility/php-compatibility": "^9.3" }, "type": "drupal-module", - "scripts": { - "phpcs": [ - "vendor/bin/phpcs -p ." - ], - "phpcbf": [ - "vendor/bin/phpcbf -p ." - ], - "test": [ - "@phpcs" - ] - }, + "notification-url": "https://packagist.org/downloads/", "license": [ "GPL-2.0-or-later" ], "authors": [ { - "name": "UNOCHA", - "role": "" + "name": "UNOCHA" } ], "description": "OCHA AI module", "support": { - "source": "https://github.com/UN-OCHA/ocha_ai/tree/v1.0.0", - "issues": "https://github.com/UN-OCHA/ocha_ai/issues" + "issues": "https://github.com/UN-OCHA/ocha_ai/issues", + "source": "https://github.com/UN-OCHA/ocha_ai/tree/v1.0.1" }, - "time": "2024-02-15T08:35:26+00:00" + "time": "2024-02-16T01:12:59+00:00" }, { "name": "unocha/ocha_monitoring", diff --git a/config/ocha_ai_chat.settings.yml b/config/ocha_ai_chat.settings.yml index 024d1a93b..ac6fc19d9 100644 --- a/config/ocha_ai_chat.settings.yml +++ b/config/ocha_ai_chat.settings.yml @@ -1,4 +1,8 @@ defaults: + form: + instructions: + value: '' + format: markdown_editor plugins: completion: plugin_id: aws_bedrock From 33cf2ab1f9d2d11e55fa54c78de7bad6ef61eb2b Mon Sep 17 00:00:00 2001 From: orakili Date: Fri, 16 Feb 2024 03:57:02 +0000 Subject: [PATCH 19/20] chore: update ocha_ai module and ES settings --- composer.lock | 12 ++++++------ config/ocha_ai.settings.yml | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 4591899cc..db1b0fc3d 100644 --- a/composer.lock +++ b/composer.lock @@ -15809,16 +15809,16 @@ }, { "name": "unocha/ocha_ai", - "version": "v1.0.1", + "version": "v1.0.2", "source": { "type": "git", "url": "https://github.com/UN-OCHA/ocha_ai.git", - "reference": "9fc3cdf0b9a425c521bdfa20b953c10eb1a6a6be" + "reference": "9a6c4a2ce929a2ff3b551203b8a7fd2c413c47b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_ai/zipball/9fc3cdf0b9a425c521bdfa20b953c10eb1a6a6be", - "reference": "9fc3cdf0b9a425c521bdfa20b953c10eb1a6a6be", + "url": "https://api.github.com/repos/UN-OCHA/ocha_ai/zipball/9a6c4a2ce929a2ff3b551203b8a7fd2c413c47b3", + "reference": "9a6c4a2ce929a2ff3b551203b8a7fd2c413c47b3", "shasum": "" }, "require": { @@ -15849,9 +15849,9 @@ "description": "OCHA AI module", "support": { "issues": "https://github.com/UN-OCHA/ocha_ai/issues", - "source": "https://github.com/UN-OCHA/ocha_ai/tree/v1.0.1" + "source": "https://github.com/UN-OCHA/ocha_ai/tree/v1.0.2" }, - "time": "2024-02-16T01:12:59+00:00" + "time": "2024-02-16T02:57:42+00:00" }, { "name": "unocha/ocha_monitoring", diff --git a/config/ocha_ai.settings.yml b/config/ocha_ai.settings.yml index a9114cf11..9079af562 100644 --- a/config/ocha_ai.settings.yml +++ b/config/ocha_ai.settings.yml @@ -72,6 +72,9 @@ plugins: elasticsearch: url: REPLACE_WITH_URL base_index_name: ocha_ai + shards: 1 + replicas: 0 + nested_object_limit: 100000 indexing_batch_size: 10 topk: 5 min_similarity: 0.3 From 849c14cc8086622508fd87817e157cd0c5542b91 Mon Sep 17 00:00:00 2001 From: orakili Date: Mon, 19 Feb 2024 06:07:30 +0000 Subject: [PATCH 20/20] fix: add possibility to pass more options to the mutool command used to extract thumbnails Refs: RW-878 --- .../src/Plugin/Field/FieldType/ReliefWebFile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/modules/custom/reliefweb_files/src/Plugin/Field/FieldType/ReliefWebFile.php b/html/modules/custom/reliefweb_files/src/Plugin/Field/FieldType/ReliefWebFile.php index d2156db69..ab987f3ea 100644 --- a/html/modules/custom/reliefweb_files/src/Plugin/Field/FieldType/ReliefWebFile.php +++ b/html/modules/custom/reliefweb_files/src/Plugin/Field/FieldType/ReliefWebFile.php @@ -877,8 +877,8 @@ protected function extractPreview($source_uri, $destination_uri, $page, $rotatio $mutool = \Drupal::state()->get('mutool', '/usr/bin/mutool'); if (is_executable($mutool)) { - // @todo add max dimensions. - $command = "{$mutool} draw -R {$rotation} -o {$destination} {$source} {$page}"; + $options = \Drupal::state()->get('mutool_options', ''); + $command = "{$mutool} draw {$options} -R {$rotation} -o {$destination} {$source} {$page}"; exec($command, $output, $return_val); // @todo log error? return empty($return_val) && @file_exists($destination_uri);