Comment forker un plugin qui est maintenant dans le cœur

J’ai l’intention de revitaliser le sujet ; cependant, avec la dernière mise à jour, j’ai intégré le plugin IA, et en passant au système principal, les modifications que j’avais apportées ont été perdues. Comment pourrais-je implémenter une solution similaire à celle-ci ?

Je dois modifier ce fichier : discourse/plugins/discourse-ai/assets/javascripts/discourse/services/ai-bot-conversations-hidden-submit.js at main · discourse/discourse · GitHub

Actuellement, lorsque les utilisateurs envoient des messages via l’IA, je les publie comme des sujets classiques.

Pourquoi ? J’apprécie grandement la conception qui consiste à poser des questions via l’IA, car elle est très pratique. Nous ne perdons pas de temps à sélectionner des titres ou des catégories. Je veux que les utilisateurs puissent simplement poser leurs questions (espérons qu’un jour Discourse supportera cette conception pour la création de nouveaux sujets).

Merci

Si vous avez forké le plugin ai, vous pouvez inclure votre fork comme vous le faisiez auparavant en ajoutant un

 rm - rf discourse-ai

Avant de le cloner.

Merci. Comment puis-je m’assurer que le plugin IA reçoive les mises à jour ? Je ne souhaite pas manquer les nouvelles fonctionnalités. Auparavant, j’approuvais chaque modification individuellement, puis je reconfigurais les paramètres en conséquence. De cette façon, le plugin reste à jour. Merci.

Ce serait exactement la même chose.

Tout ce que j’ai suggéré, c’est une façon pour vous de continuer à utiliser votre fork au lieu de ce qui est maintenant inclus dans le cœur. Vous ajouterez une ligne à votre app.yml et tout le reste sera exactement le même qu’auparavant.

Je n’ai pas pu réussir ; chaque tentative a entraîné une erreur. J’ai entré le code dans le conteneur et j’ai essayé de l’exécuter, mais cela n’a pas fonctionné (rm -rf plugins/discourse-ai). Je l’ai également ajouté au fichier app.yml, mais cela n’a toujours pas résolu le problème.

Pourriez-vous s’il vous plaît m’expliquer les étapes exactes à suivre de manière simple ? Merci.

Ceci est dans votre app.yml.

## Les plugins vont ici
## voir https://meta.discourse.org/t/19157 pour les détails
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - rm -rf discourse-ai
          - git clone https://github.com/your-user/discourse-ai

Si vous vouliez le faire à la main dans le conteneur, vous feriez ceci :

./launcher enter app
cd /var/www/discourse/plugins
rm -rf discourse-ai
git clone https://github.com/your-user/discourse-ai
sv restart unicorn

Si vous faites cela, cela sera effacé la prochaine fois que vous démarrerez un nouveau conteneur.

1 « J'aime »

J’ai tenté la méthode initiale pour app.yml, mais l’erreur que j’ai rencontrée reste identique à la précédente :


I, [2025-08-29T14:42:33.085518 #1]  INFO -- : > cd /var/www/discourse & su discourse -c 'find /var/www/discourse/vendor/bundle -name cache -not -path "/var/www/discourse/vendor/bundle/gems/*" -type d -exec rm -rf {} +'
I, [2025-08-29T14:42:33.264304 #1]  INFO -- :
I, [2025-08-29T14:42:33.264403 #1]  INFO -- : > cd /var/www/discourse & su discourse -c 'find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +'
I, [2025-08-29T14:42:33.396576 #1]  INFO -- :
I, [2025-08-29T14:42:33.396878 #1]  INFO -- : > cd /var/www/discourse & su discourse -c 'LOAD_PLUGINS=0 bundle exec rake plugin:pull_compatible_all'
I, [2025-08-29T14:42:36.229535 #1]  INFO -- : discourse-ai est déjà à la dernière version compatible
discourse-akismet est déjà à la dernière version compatible
discourse-follow est déjà à la dernière version compatible
discourse-google-one-tap est déjà à la dernière version compatible
discourse-matheditor est déjà à la dernière version compatible
discourse-no-bump est déjà à la dernière version compatible
discourse-restricted-replies est déjà à la dernière version compatible
discourse-saved-searches est déjà à la dernière version compatible
docker_manager est déjà à la dernière version compatible

I, [2025-08-29T14:42:36.229694 #1]  INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2025-08-29T14:42:36.231265 #1]  INFO -- : > sleep 10
853:C 29 Aug 2025 14:42:36.237 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
853:C 29 Aug 2025 14:42:36.237 # Redis version=7.0.15, bits=64, commit=00000000, modified=0, pid=853, just started
853:C 29 Aug 2025 14:42:36.237 # Configuration loaded
853:M 29 Aug 2025 14:42:36.237 * monotonic clock: POSIX clock_gettime
853:M 29 Aug 2025 14:42:36.238 # Warning: Could not create server TCP listening socket *:6379: bind: Address already in use
853:M 29 Aug 2025 14:42:36.238 # Failed listening on port 6379 (TCP), aborting.
I, [2025-08-29T14:42:46.233563 #1]  INFO -- :
I, [2025-08-29T14:42:46.234230 #1]  INFO -- : > cd /var/www/discourse & su discourse -c 'bundle exec rake db:migrate'
rake aborted!
Gem::LoadError: can't activate tokenizers-0.5.4-x86_64-linux, already activated tokenizers-0.5.5-x86_64-linux (Gem::LoadError)
/var/www/discourse/lib/plugin_gem.rb:25:in `load'
/var/www/discourse/lib/plugin/instance.rb:861:in `gem'
/var/www/discourse/plugins/discourse-ai/plugin.rb:11:in `activate!'
/var/www/discourse/lib/plugin/instance.rb:806:in `instance_eval'
/var/www/discourse/lib/plugin/instance.rb:806:in `activate!'
/var/www/discourse/lib/discourse.rb:344:in `block in activate_plugins!'
/var/www/discourse/lib/discourse.rb:341:in `each'
/var/www/discourse/lib/discourse.rb:341:in `activate_plugins!'
/var/www/discourse/config/application.rb:196:in `block in <class:Application>'
/var/www/discourse/lib/plugin.rb:6:in `initialization_guard'
/var/www/discourse/config/application.rb:196:in `<class:Application>'
/var/www/discourse/config/application.rb:62:in `<module:Discourse>'
/var/www/discourse/config/application.rb:61:in `<top (required)>'
/var/www/discourse/Rakefile:7:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
(See full trace by running task with --trace)
I, [2025-08-29T14:42:47.939777 #1]  INFO -- : gem install tokenizers -v 0.5.4 -i /var/www/discourse/plugins/discourse-ai/gems/3.3.8 --no-document --ignore-dependencies --no-user-install
Successfully installed tokenizers-0.5.4-x86_64-linux
1 gem installed

I, [2025-08-29T14:42:47.940175 #1]  INFO -- : Terminating async processes
I, [2025-08-29T14:42:47.940208 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/15/bin/postmaster -D /etc/postgresql/15/main pid: 45
I, [2025-08-29T14:42:47.940241 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 112
2025-08-29 14:42:47.940 UTC [45] LOG:  received fast shutdown request
112:signal-handler (1756478567) Received SIGTERM scheduling shutdown...
2025-08-29 14:42:47.942 UTC [45] LOG:  aborting any active transactions
2025-08-29 14:42:47.946 UTC [45] LOG:  background worker "logical replication launcher" (PID 59) exited with exit code 1
112:M 29 Aug 2025 14:42:47.946 # User requested shutdown...
112:M 29 Aug 2025 14:42:47.946 * Saving the final RDB snapshot before exiting.
2025-08-29 14:42:47.949 UTC [54] LOG:  shutting down
2025-08-29 14:42:47.951 UTC [54] LOG:  checkpoint starting: shutdown immediate
2025-08-29 14:42:47.963 UTC [54] LOG:  checkpoint complete: wrote 4 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.006 s, sync=0.002 s, total=0.014 s; sync files=3, longest=0.001 s, average=0.001 s; distance=6 kB, estimate=6 kB
2025-08-29 14:42:47.986 UTC [45] LOG:  database system is shut down
112:M 29 Aug 2025 14:42:48.021 * DB saved on disk
112:M 29 Aug 2025 14:42:48.021 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse & su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 857 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.3.0/lib/pups/exec_command.rb:131:in `spawn'
exec failed with the params {"cd"=>"$home", "tag"=>"migrate", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

J’investis votre temps pour quelque chose de simple, et j’ai honte de demander de l’aide, mais si j’y parviens, je me sentirai soulagé, croyez-moi.

Il semble donc que vous incluiez une Gem et que vous deviez supprimer cette ligne de Gem du plugin.

Je pense que vous devez simplement supprimer cette ligne de Gem du plugin. Le plugin d’origine inclut-il maintenant cette ligne ?

I have deleted this line from the plugin.rb file.

# gem "tokenizers", "0.5.4"
# gem "afm", "0.2.2", require: false

# gem "ed25519", "1.2.4" #TODO remove this as existing ssl gem should handle this

#gem "pdf-reader", "2.14.1", require: false

During the reinstallation process, a new error has emerged concerning the plugin’s attempt to create existing tables:

Caused by:
PG::DuplicateTable: ERROR: relation “index_ai_topics_embeddings_on_topic_id_and_model_id” already exists (PG::DuplicateTable)

To resolve this issue, we might consider deleting the old tables. However, I am uncertain about the proper procedure to do so. Alternatively, how can we modify the plugin to bypass the creation of tables if they already exist?

I, [2025-08-29T15:30:10.323550 #1]  INFO -- :
I, [2025-08-29T15:30:10.324272 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
Plugin name is 'DiscourseMatheditor', but plugin directory is named 'discourse-matheditor'
2025-08-29 15:30:20.141 UTC [977] discourse@discourse ERROR:  relation "index_ai_topics_embeddings_on_topic_id_and_model_id" already exists
2025-08-29 15:30:20.141 UTC [977] discourse@discourse STATEMENT:  CREATE INDEX "index_ai_topics_embeddings_on_topic_id_and_model_id" ON "ai_topics_embeddings" ("topic_id", "model_id")
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)

PG::DuplicateTable: ERROR:  relation "index_ai_topics_embeddings_on_topic_id_and_model_id" already exists
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rack-mini-profiler-4.0.1/lib/patches/db/pg/alias_method.rb:109:in `exec'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rack-mini-profiler-4.0.1/lib/patches/db/pg/alias_method.rb:109:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `perform_query'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:556:in `block (2 levels) in raw_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:1015:in `block in with_raw_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:984:in `with_raw_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:555:in `block in raw_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:1135:in `log'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:554:in `raw_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:591:in `internal_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:137:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:27:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:40:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/postgresql/schema_statements.rb:531:in `add_index'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration/default_strategy.rb:10:in `method_missing'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1056:in `block in method_missing'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1022:in `block in say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/benchmark.rb:17:in `realtime'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1022:in `say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1045:in `method_missing'
/var/www/discourse/plugins/discourse-ai/db/migrate/20250722082515_add_index_to_ai_topics_embeddings.rb:5:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:994:in `public_send'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:994:in `exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/benchmark-0.4.1/lib/benchmark.rb:305:in `measure'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:975:in `block (2 levels) in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/benchmark.rb:17:in `realtime'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:974:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:412:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:973:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1187:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1535:in `block in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1586:in `ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1534:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1509:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1509:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1454:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1606:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1454:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1261:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1236:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/tasks/database_tasks.rb:270:in `migrate'
/var/www/discourse/lib/tasks/db.rake:267:in `block (2 levels) in <main>'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/lib/tasks/db.rake:242:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'

Caused by:
ActiveRecord::StatementInvalid: PG::DuplicateTable: ERROR:  relation "index_ai_topics_embeddings_on_topic_id_and_model_id" already exists (ActiveRecord::StatementInvalid)
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rack-mini-profiler-4.0.1/lib/patches/db/pg/alias_method.rb:109:in `exec'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rack-mini-profiler-4.0.1/lib/patches/db/pg/alias_method.rb:109:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `perform_query'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:556:in `block (2 levels) in raw_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:1015:in `block in with_raw_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:984:in `with_raw_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:555:in `block in raw_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:1135:in `log'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:554:in `raw_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:591:in `internal_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:137:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:27:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:40:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/postgresql/schema_statements.rb:531:in `add_index'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration/default_strategy.rb:10:in `method_missing'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1056:in `block in method_missing'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1022:in `block in say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/benchmark.rb:17:in `realtime'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1022:in `say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1045:in `method_missing'
/var/www/discourse/plugins/discourse-ai/db/migrate/20250722082515_add_index_to_ai_topics_embeddings.rb:5:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:994:in `public_send'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:994:in `exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/benchmark-0.4.1/lib/benchmark.rb:305:in `measure'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:975:in `block (2 levels) in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/benchmark.rb:17:in `realtime'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:974:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:412:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:973:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1187:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1535:in `block in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1586:in `ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1534:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1509:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1509:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1454:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1606:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1454:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1261:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1236:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/tasks/database_tasks.rb:270:in `migrate'
/var/www/discourse/lib/tasks/db.rake:267:in `block (2 levels) in <main>'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/lib/tasks/db.rake:242:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'

Caused by:
PG::DuplicateTable: ERROR:  relation "index_ai_topics_embeddings_on_topic_id_and_model_id" already exists (PG::DuplicateTable)
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rack-mini-profiler-4.0.1/lib/patches/db/pg/alias_method.rb:109:in `exec'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rack-mini-profiler-4.0.1/lib/patches/db/pg/alias_method.rb:109:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `perform_query'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:556:in `block (2 levels) in raw_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:1015:in `block in with_raw_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:984:in `with_raw_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:555:in `block in raw_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:1135:in `log'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:554:in `raw_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:591:in `internal_execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:137:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:27:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:40:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/postgresql/schema_statements.rb:531:in `add_index'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration/default_strategy.rb:10:in `method_missing'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1056:in `block in method_missing'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1022:in `block in say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/benchmark.rb:17:in `realtime'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1022:in `say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1045:in `method_missing'
/var/www/discourse/plugins/discourse-ai/db/migrate/20250722082515_add_index_to_ai_topics_embeddings.rb:5:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:994:in `public_send'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:994:in `exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/benchmark-0.4.1/lib/benchmark.rb:305:in `measure'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:975:in `block (2 levels) in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/benchmark.rb:17:in `realtime'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:974:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:412:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:973:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1187:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1535:in `block in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1586:in `ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1534:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1509:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1509:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1454:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1606:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1454:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1261:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/migration.rb:1236:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-8.0.2.1/lib/active_record/tasks/database_tasks.rb:270:in `migrate'
/var/www/discourse/lib/tasks/db.rake:267:in `block (2 levels) in <main>'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/lib/tasks/db.rake:242:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2025-08-29T15:30:20.177205 #1]  INFO -- : gem install tiktoken_ruby -v 0.0.11.1 -i /var/www/discourse/plugins/discourse-ai/gems/3.3.8 --no-document --ignore-dependencies --no-user-install
Successfully installed tiktoken_ruby-0.0.11.1-x86_64-linux
1 gem installed
gem install discourse_ai-tokenizers -v 0.3.1 -i /var/www/discourse/plugins/discourse-ai/gems/3.3.8 --no-document --ignore-dependencies --no-user-install
Successfully installed discourse_ai-tokenizers-0.3.1
1 gem installed
gem install Ascii85 -v 2.0.1 -i /var/www/discourse/plugins/discourse-ai/gems/3.3.8 --no-document --ignore-dependencies --no-user-install
Successfully installed Ascii85-2.0.1
1 gem installed
gem install ruby-rc4 -v 0.1.5 -i /var/www/discourse/plugins/discourse-ai/gems/3.3.8 --no-document --ignore-dependencies --no-user-install
Successfully installed ruby-rc4-0.1.5
1 gem installed
gem install hashery -v 2.1.2 -i /var/www/discourse/plugins/discourse-ai/gems/3.3.8 --no-document --ignore-dependencies --no-user-install
Successfully installed hashery-2.1.2
1 gem installed
gem install ttfunk -v 1.8.0 -i /var/www/discourse/plugins/discourse-ai/gems/3.3.8 --no-document --ignore-dependencies --no-user-install
Successfully installed ttfunk-1.8.0
1 gem installed
gem install google-id-token -v 1.4.2 -i /var/www/discourse/plugins/discourse-google-one-tap/gems/3.3.8 --no-document --ignore-dependencies --no-user-install
Successfully installed google-id-token-1.4.2
1 gem installed
== 20250722082515 AddIndexToAiTopicsEmbeddings: migrating =====================
-- add_index(:ai_topics_embeddings, [:topic_id, :model_id])

I, [2025-08-29T15:30:20.177603 #1]  INFO -- : Terminating async processes
I, [2025-08-29T15:30:20.177633 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/15/bin/postmaster -D /etc/postgresql/15/main pid: 45
I, [2025-08-29T15:30:20.177665 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 112
2025-08-29 15:30:20.177 UTC [45] LOG:  received fast shutdown request
112:signal-handler (1756481420) Received SIGTERM scheduling shutdown...
2025-08-29 15:30:20.182 UTC [45] LOG:  aborting any active transactions
2025-08-29 15:30:20.187 UTC [45] LOG:  background worker "logical replication launcher" (PID 59) exited with exit code 1
2025-08-29 15:30:20.187 UTC [54] LOG:  shutting down
2025-08-29 15:30:20.189 UTC [54] LOG:  checkpoint starting: shutdown immediate
112:M 29 Aug 2025 15:30:20.192 # User requested shutdown...
112:M 29 Aug 2025 15:30:20.192 * Saving the final RDB snapshot before exiting.
2025-08-29 15:30:20.201 UTC [54] LOG:  checkpoint complete: wrote 4 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.007 s, sync=0.002 s, total=0.014 s; sync files=3, longest=0.001 s, average=0.001 s; distance=7 kB, estimate=7 kB
2025-08-29 15:30:20.222 UTC [45] LOG:  database system is shut down
112:M 29 Aug 2025 15:30:20.265 * DB saved on disk
112:M 29 Aug 2025 15:30:20.265 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 856 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.3.0/lib/pups/exec_command.rb:131:in `spawn'
exec failed with the params {"cd"=>"$home", "tag"=>"migrate", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

Let’s retrieve the plugin files from the discourse and test them; please wait for about five minutes. :slight_smile:

Ouais. Je commencerais d’abord par voir si le plugin principal fonctionne.

Ensuite, je lancerais un nouveau sujet sur votre fork et pourquoi et si elle est nécessaire ou la meilleure façon de résoudre le problème que votre fork essaie de résoudre.

1 « J'aime »

Une fin heureuse…

J’ai téléchargé le fichier du plugin depuis le dépôt (original de Discourse) et l’ai téléchargé dans le répertoire cloné (en supprimant les anciens fichiers).

Ensuite, j’ai modifié les paramètres dans app.yml :

hooks:
  after_code:
     - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - rm -rf discourse-ai
          - git clone https://github.com/KilicSelcuk/discourse-ai.git

J’ai recompilé et je n’ai rencontré aucune erreur. Les modifications que j’ai apportées dans le dépôt sont également mises à jour dans le panneau d’administration, et tout fonctionne comme je le souhaite.

<3

Je sais que je vous ai causé des ennuis et pris de votre temps. Cependant, je vous envoie de merveilleux sentiments de bonne volonté et de gratitude à travers l’univers. Merci.

2 « J'aime »

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.