DEV: Update rubocop-discourse to version 3.8.0 (#641)

This commit is contained in:
Loïc Guitaut
2024-05-28 11:15:42 +02:00
committed by GitHub
parent 309280cbb6
commit dd4e305ff7
8 changed files with 38 additions and 29 deletions
+2 -2
View File
@@ -13,8 +13,8 @@ module DiscourseAi
plugin.on(:chat_message_created) do |message, channel, user, extra|
next unless SiteSetting.composer_ai_helper_enabled
next unless SiteSetting.ai_helper_automatic_chat_thread_title
next unless extra[:thread].present?
next unless extra[:thread].title.blank?
next if extra[:thread].blank?
next if extra[:thread].title.present?
reply_count = extra[:thread].replies.count
+1 -1
View File
@@ -171,7 +171,7 @@ module DiscourseAi
SiteSetting.ai_embeddings_semantic_search_hyde_model,
).generate(prompt, user: @guardian.user, feature_name: "semantic_search_hyde")
Nokogiri::HTML5.fragment(llm_response).at("ai")&.text&.presence || llm_response
Nokogiri::HTML5.fragment(llm_response).at("ai")&.text.presence || llm_response
end
private
+2 -2
View File
@@ -49,7 +49,7 @@ module DiscourseAi
def topic_truncation(topic, tokenizer, max_length)
text = +topic_information(topic)
if topic&.topic_embed&.embed_content_cache&.present?
if topic&.topic_embed&.embed_content_cache.present?
text << Nokogiri::HTML5.fragment(topic.topic_embed.embed_content_cache).text
text << "\n\n"
end
@@ -66,7 +66,7 @@ module DiscourseAi
def post_truncation(post, tokenizer, max_length)
text = +topic_information(post.topic)
if post.is_first_post? && post.topic&.topic_embed&.embed_content_cache&.present?
if post.is_first_post? && post.topic&.topic_embed&.embed_content_cache.present?
text << Nokogiri::HTML5.fragment(post.topic.topic_embed.embed_content_cache).text
else
text << Nokogiri::HTML5.fragment(post.cooked).text