2023-02-17 09:33:47 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-02-22 18:46:53 -05:00
|
|
|
# name: discourse-ai
|
2023-02-17 09:33:47 -05:00
|
|
|
# about: TODO
|
|
|
|
# version: 0.0.1
|
|
|
|
# authors: Discourse
|
|
|
|
# url: TODO
|
|
|
|
# required_version: 2.7.0
|
|
|
|
|
2023-04-19 10:55:59 -04:00
|
|
|
gem "tokenizers", "0.3.2", platform: RUBY_PLATFORM
|
|
|
|
|
2023-02-23 09:08:34 -05:00
|
|
|
enabled_site_setting :discourse_ai_enabled
|
2023-02-17 09:33:47 -05:00
|
|
|
|
2023-03-15 16:02:20 -04:00
|
|
|
register_asset "stylesheets/modules/ai-helper/common/ai-helper.scss"
|
2023-04-04 10:24:09 -04:00
|
|
|
register_asset "stylesheets/modules/summarization/common/summarization.scss"
|
2023-03-15 16:02:20 -04:00
|
|
|
|
2023-03-14 15:03:50 -04:00
|
|
|
module ::DiscourseAi
|
|
|
|
PLUGIN_NAME = "discourse-ai"
|
|
|
|
end
|
|
|
|
|
2023-03-07 13:39:28 -05:00
|
|
|
require_relative "lib/discourse_ai/engine"
|
|
|
|
|
2023-02-24 05:53:43 -05:00
|
|
|
after_initialize do
|
2023-03-07 14:14:39 -05:00
|
|
|
require_relative "lib/shared/inference/discourse_classifier"
|
|
|
|
require_relative "lib/shared/inference/discourse_reranker"
|
|
|
|
require_relative "lib/shared/inference/openai_completions"
|
|
|
|
require_relative "lib/shared/inference/openai_embeddings"
|
2023-04-10 10:04:42 -04:00
|
|
|
require_relative "lib/shared/inference/anthropic_completions"
|
2023-03-07 14:14:39 -05:00
|
|
|
|
2023-02-28 09:17:03 -05:00
|
|
|
require_relative "lib/shared/classificator"
|
|
|
|
require_relative "lib/shared/post_classificator"
|
|
|
|
require_relative "lib/shared/chat_message_classificator"
|
2023-02-24 05:53:43 -05:00
|
|
|
|
2023-04-19 10:55:59 -04:00
|
|
|
require_relative "lib/shared/tokenizer/tokenizer"
|
|
|
|
|
2023-03-15 16:21:45 -04:00
|
|
|
require_relative "lib/shared/database/connection"
|
|
|
|
|
2023-02-24 05:53:43 -05:00
|
|
|
require_relative "lib/modules/nsfw/entry_point"
|
|
|
|
require_relative "lib/modules/toxicity/entry_point"
|
|
|
|
require_relative "lib/modules/sentiment/entry_point"
|
2023-03-15 16:02:20 -04:00
|
|
|
require_relative "lib/modules/ai_helper/entry_point"
|
2023-03-15 16:21:45 -04:00
|
|
|
require_relative "lib/modules/embeddings/entry_point"
|
2023-04-04 10:24:09 -04:00
|
|
|
require_relative "lib/modules/summarization/entry_point"
|
2023-02-22 18:46:53 -05:00
|
|
|
|
2023-03-07 13:39:28 -05:00
|
|
|
[
|
2023-03-15 16:21:45 -04:00
|
|
|
DiscourseAi::Embeddings::EntryPoint.new,
|
2023-03-14 15:03:50 -04:00
|
|
|
DiscourseAi::NSFW::EntryPoint.new,
|
|
|
|
DiscourseAi::Toxicity::EntryPoint.new,
|
|
|
|
DiscourseAi::Sentiment::EntryPoint.new,
|
2023-03-15 16:02:20 -04:00
|
|
|
DiscourseAi::AiHelper::EntryPoint.new,
|
2023-04-04 10:24:09 -04:00
|
|
|
DiscourseAi::Summarization::EntryPoint.new,
|
2023-03-07 13:39:28 -05:00
|
|
|
].each do |a_module|
|
2023-02-23 13:50:10 -05:00
|
|
|
a_module.load_files
|
|
|
|
a_module.inject_into(self)
|
|
|
|
end
|
2023-03-07 13:39:28 -05:00
|
|
|
|
2023-03-14 15:03:50 -04:00
|
|
|
register_reviewable_type ReviewableAiChatMessage
|
|
|
|
register_reviewable_type ReviewableAiPost
|
2023-03-07 13:39:28 -05:00
|
|
|
|
|
|
|
on(:reviewable_transitioned_to) do |new_status, reviewable|
|
|
|
|
ModelAccuracy.adjust_model_accuracy(new_status, reviewable)
|
|
|
|
end
|
2023-02-22 18:46:53 -05:00
|
|
|
end
|