decidim 0.29.1 → 0.30.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/decidim.gemspec +2 -2
- data/docs/antora.yml +1 -1
- data/docs/modules/configure/assets/images/system-dashboard.png +0 -0
- data/docs/modules/configure/assets/images/system-log_in.png +0 -0
- data/docs/modules/configure/pages/environment_variables.adoc +24 -0
- data/docs/modules/configure/pages/initializer.adoc +26 -0
- data/docs/modules/configure/pages/system.adoc +145 -0
- data/docs/modules/customize/pages/menu.adoc +1 -1
- data/docs/modules/develop/assets/images/taxonomies.png +0 -0
- data/docs/modules/develop/pages/ai_tools/lang_detection_formatter.adoc +9 -0
- data/docs/modules/develop/pages/ai_tools/spam_detection_analyzer.adoc +20 -0
- data/docs/modules/develop/pages/ai_tools/spam_detection_service.adoc +25 -0
- data/docs/modules/develop/pages/ai_tools/spam_detection_strategy.adoc +43 -0
- data/docs/modules/develop/pages/ai_tools/spam_detection_trainer.adoc +83 -0
- data/docs/modules/develop/pages/ai_tools.adoc +12 -0
- data/docs/modules/develop/pages/classes/jobs.adoc +1 -1
- data/docs/modules/develop/pages/classes/models.adoc +4 -3
- data/docs/modules/develop/pages/commentable.adoc +127 -0
- data/docs/modules/develop/pages/endorsable.adoc +6 -15
- data/docs/modules/develop/pages/share_tokens.adoc +153 -11
- data/docs/modules/develop/pages/taxonomies.adoc +476 -0
- data/docs/modules/install/pages/manual.adoc +1 -1
- data/docs/modules/install/partials/version_matrix.adoc +4 -2
- data/docs/modules/services/pages/aitools.adoc +164 -0
- data/docs/modules/services/pages/index.adoc +1 -0
- data/docs/modules/services/pages/maps.adoc +2 -2
- data/lib/decidim/version.rb +1 -1
- data/package-lock.json +308 -175
- data/packages/browserslist-config/package.json +2 -2
- data/packages/core/package.json +6 -4
- data/packages/dev/package.json +2 -2
- data/packages/eslint-config/package.json +2 -2
- data/packages/prettier-config/package.json +2 -2
- data/packages/stylelint-config/package.json +2 -2
- data/packages/webpacker/package.json +2 -2
- data/packages/webpacker/src/override-config.js +11 -1
- metadata +56 -43
@@ -2,11 +2,13 @@
|
|
2
2
|
|===
|
3
3
|
|Decidim version |Ruby version |Node version | Status
|
4
4
|
|
5
|
-
|develop | 3.
|
5
|
+
|develop | 3.3.4 | 18.17.x | Unreleased
|
6
|
+
|
7
|
+
|v0.29 | 3.2.2 | 18.17.x | Bug fixes and security updates
|
6
8
|
|
7
9
|
|v0.28 | 3.1.1 | 18.17.x | Bug fixes and security updates
|
8
10
|
|
9
|
-
|v0.27 | 3.0.2 | 16.18.x |
|
11
|
+
|v0.27 | 3.0.2 | 16.18.x | Security updates
|
10
12
|
|
11
13
|
|v0.26 | 2.7.5+ | 16.9.x | Not maintained
|
12
14
|
|
@@ -0,0 +1,164 @@
|
|
1
|
+
= AI tools
|
2
|
+
|
3
|
+
In order to help the moderator communities to manage better their Decidim installations, we have shipped the first version of the AI tools. This is a set of tools that will help the moderators to detect and manage the content that is being published.
|
4
|
+
|
5
|
+
== Functionalities
|
6
|
+
|
7
|
+
=== Spam detection
|
8
|
+
|
9
|
+
This service allows you to install and configure a spam detection service so that any suspicious content get reported at the very early possible step.
|
10
|
+
|
11
|
+
This service can be trained either using the datasets that we provide, or using your own content. This way the engine learns your own business domain and it is able to detect spam or things that are not relevant for your activity.
|
12
|
+
|
13
|
+
== Installation
|
14
|
+
|
15
|
+
In order to install the module, you need to run the following command:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
bundle add decidim-ai
|
19
|
+
```
|
20
|
+
|
21
|
+
== Configuration
|
22
|
+
|
23
|
+
The AI tool allows you to configure most of the parameters using either defaults, or the initializer.
|
24
|
+
In order to get control of your AI installation, you may need to create an initializer in your application.
|
25
|
+
|
26
|
+
You can do it by creating a file in `config/initializers/decidim_ai.rb` with the following content:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
Decidim::Ai::SpamDetection.resource_score_threshold = 0.75 # default
|
30
|
+
# The entry must be a hash with the following keys:
|
31
|
+
# - name: the name of the analyzer
|
32
|
+
# - strategy: the class of the strategy to use
|
33
|
+
# - options: a hash with the options to pass to the strategy
|
34
|
+
# Example:
|
35
|
+
# Decidim::Ai.registered_analyzers = [
|
36
|
+
# {
|
37
|
+
# name: :bayes,
|
38
|
+
# strategy: Decidim::Ai::SpamContent::BayesStrategy,
|
39
|
+
# options: {
|
40
|
+
# adapter: :redis,
|
41
|
+
# params: {
|
42
|
+
# url: lambda { ENV["REDIS_URL"] }
|
43
|
+
# }
|
44
|
+
# }
|
45
|
+
# }
|
46
|
+
# ]
|
47
|
+
Decidim::Ai::SpamDetection.resource_analyzers = [
|
48
|
+
{
|
49
|
+
name: :bayes,
|
50
|
+
strategy: Decidim::Ai::SpamDetection::Strategy::Bayes,
|
51
|
+
options: {
|
52
|
+
adapter: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_RESOURCE", "redis"),
|
53
|
+
params: { url: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_RESOURCE_REDIS_URL", "redis://localhost:6379/2") }
|
54
|
+
}
|
55
|
+
}
|
56
|
+
]
|
57
|
+
|
58
|
+
Decidim::Ai::SpamDetection.reporting_user_email = "your-admin@example.org"
|
59
|
+
|
60
|
+
# If you want to use a different spam detection service,
|
61
|
+
# you can use a class service having the following contract
|
62
|
+
#
|
63
|
+
Decidim::Ai::SpamDetection.resource_detection_service = "Decidim::Ai::SpamDetection::Service"
|
64
|
+
|
65
|
+
# Customize here what are the analyzed models. You may want to use this to
|
66
|
+
# override what we register by default, or to register your own resources.
|
67
|
+
|
68
|
+
Decidim::Ai::SpamDetection.resource_models = {
|
69
|
+
"Decidim::Comments::Comment" => "Decidim::Ai::SpamDetection::Resource::Comment",
|
70
|
+
"Decidim::Initiative" => "Decidim::Ai::SpamDetection::Resource::Initiative",
|
71
|
+
"Decidim::Debates::Debate" => "Decidim::Ai::SpamDetection::Resource::Debate",
|
72
|
+
"Decidim::Meetings::Meeting" => "Decidim::Ai::SpamDetection::Resource::Meeting",
|
73
|
+
"Decidim::Proposals::Proposal" => "Decidim::Ai::SpamDetection::Resource::Proposal",
|
74
|
+
"Decidim::Proposals::CollaborativeDraft" => "Decidim::Ai::SpamDetection::Resource::CollaborativeDraft",
|
75
|
+
"Decidim::UserGroup" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity",
|
76
|
+
"Decidim::User" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity"
|
77
|
+
}
|
78
|
+
|
79
|
+
Decidim::Ai::SpamDetection.user_score_threshold = 0.75 # default
|
80
|
+
|
81
|
+
# The entry must be a hash with the following keys:
|
82
|
+
# - name: the name of the analyzer
|
83
|
+
# - strategy: the class of the strategy to use
|
84
|
+
# - options: a hash with the options to pass to the strategy
|
85
|
+
# Example:
|
86
|
+
# Decidim::Ai::SpamDetection.user_analyzers = [
|
87
|
+
# {
|
88
|
+
# name: :bayes,
|
89
|
+
# strategy: Decidim::Ai::SpamContent::BayesStrategy,
|
90
|
+
# options: {
|
91
|
+
# adapter: :redis,
|
92
|
+
# params: {
|
93
|
+
# url: lambda { ENV["REDIS_URL"] }
|
94
|
+
# }
|
95
|
+
# }
|
96
|
+
# }
|
97
|
+
# ]
|
98
|
+
Decidim::Ai::SpamDetection.user_analyzers = [
|
99
|
+
{
|
100
|
+
name: :bayes,
|
101
|
+
strategy: Decidim::Ai::SpamDetection::Strategy::Bayes,
|
102
|
+
options: {
|
103
|
+
adapter: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_USER", "redis"),
|
104
|
+
params: { url: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_USER_REDIS_URL", "redis://localhost:6379/3") }
|
105
|
+
}
|
106
|
+
}
|
107
|
+
]
|
108
|
+
|
109
|
+
# Customize here what are the analyzed models. You may want to use this to
|
110
|
+
# override what we register by default, or to register your own resources.
|
111
|
+
# Follow the documentation on how to trail more resources
|
112
|
+
Decidim::Ai::SpamDetection.user_models = {
|
113
|
+
"Decidim::UserGroup" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity",
|
114
|
+
"Decidim::User" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity"
|
115
|
+
}
|
116
|
+
|
117
|
+
# If you want to use a different spam detection service, you can define your own service.
|
118
|
+
# Refer to documentation for more details.
|
119
|
+
#
|
120
|
+
Decidim::Ai::SpamDetection.user_detection_service = "Decidim::Ai::SpamDetection::Service"
|
121
|
+
|
122
|
+
```
|
123
|
+
|
124
|
+
== Commands
|
125
|
+
|
126
|
+
Decidim Ai provides a set of commands that you can use to manage the engine.
|
127
|
+
|
128
|
+
=== Create reporting user
|
129
|
+
|
130
|
+
In order to preserve the database integrity, you need to configure a system user that could be used to report content in the application. Use the following command to create an user for each one of the organizations you may have. The email address defined by `Decidim::Ai::SpamDetection.reporting_user_email` will be used to find or create the user.
|
131
|
+
|
132
|
+
```bash
|
133
|
+
bin/rails decidim:ai:spam:create_reporting_user
|
134
|
+
```
|
135
|
+
|
136
|
+
=== Load custom model
|
137
|
+
|
138
|
+
In some cases, when you manage multiple installations, you may want to share the same model between them. You can use the following command to load a simple CSV.
|
139
|
+
|
140
|
+
```bash
|
141
|
+
bin/rails decidim:ai:spam:load_application_dataset[/path/to/file.csv]
|
142
|
+
```
|
143
|
+
|
144
|
+
=== Load the data from your server
|
145
|
+
|
146
|
+
In some cases, like an upgrade, you may want to train your model using your existing data, so you can use:
|
147
|
+
|
148
|
+
```bash
|
149
|
+
bin/rails decidim:ai:spam:train_using_database
|
150
|
+
```
|
151
|
+
|
152
|
+
=== Reset the model
|
153
|
+
|
154
|
+
If the trained model becomes corrupt, you could use the below command to reinitialize the model. Once you do this, you would need to train the model again. using any of the above commands.
|
155
|
+
|
156
|
+
```bash
|
157
|
+
bin/rails decidim:ai:spam:reset_model
|
158
|
+
```
|
159
|
+
|
160
|
+
== Sidekiq
|
161
|
+
|
162
|
+
Decidim Ai comes with a new queue that is aimed to be ran to analyze the content of the platform. We have decided to have it in a separate queue to avoid blocking other events that your sidekiq may use.
|
163
|
+
|
164
|
+
We start to provide the `spam_analysis` queue name.
|
@@ -4,6 +4,7 @@ There are multiple services that can be enabled in a Decidim installation. It is
|
|
4
4
|
|
5
5
|
* xref:services:activejob.adoc[Active Job]
|
6
6
|
* xref:services:activestorage.adoc[Active Storage]
|
7
|
+
* xref:services:aitools.adoc[AI tools]
|
7
8
|
* xref:services:etherpad.adoc[Etherpad]
|
8
9
|
* xref:services:maps.adoc[Maps]
|
9
10
|
* xref:services:sms.adoc[SMS]
|
@@ -241,8 +241,8 @@ As of April 2017, only proposals and meetings have maps and geocoding.
|
|
241
241
|
|
242
242
|
=== Proposals
|
243
243
|
|
244
|
-
In order to enable
|
245
|
-
This works for that specific component, so you can have
|
244
|
+
In order to enable maps for proposals you will need to edit the component configuration and turn on "Maps enabled" configuration.
|
245
|
+
This works for that specific component, so you can have maps enabled for proposals in a participatory process, and disabled for another proposals component in the same participatory process.
|
246
246
|
|
247
247
|
=== Meetings
|
248
248
|
|