Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMPROVE: logged error #15

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions app/jobs/regular/ai_topic_summary_summarise_topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ class ::Jobs::AiTopicSummarySummariseTopic < Jobs::Base
sidekiq_options retry: 5

def execute(opts)
topic_id = opts[:topic_id]
begin
topic_id = opts[:topic_id]

::AiTopicSummary::Summarise.retrieve_and_post_summary(topic_id)
::AiTopicSummary::Summarise.retrieve_and_post_summary(topic_id)

rescue => e
status = e.response[:status]
message = e.response[:body]["error"]["message"]
Rails.logger.error("AI Topic Summary: Summarise Job: There was a problem, but will retry til limit: status: #{status}, message: #{message}")
end
end
end
2 changes: 1 addition & 1 deletion plugin.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# name: discourse-ai-topic-summary
# about: Uses a remote (OpenAI) AI language model to prepare and post a summary of a Topic
# version: 0.2.0
# version: 0.2.1
# authors: Robert Barrow
# contact_emails: merefield@gmail.com
# url: https://github.com/merefield/discourse-ai-topic-summary
Expand Down