This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,11 @@ def execute(args)
1515 summarizer = DiscourseAi ::Summarization . topic_gist ( topic )
1616 gist = summarizer . existing_summary
1717
18- summarizer . delete_cached_summaries! if gist && gist . outdated
18+ if gist . blank? || gist . outdated
19+ summarizer . delete_cached_summaries!
1920
20- summarizer . summarize ( Discourse . system_user )
21+ summarizer . summarize ( Discourse . system_user )
22+ end
2123 end
2224 end
2325 end
Original file line number Diff line number Diff line change 6161 end
6262
6363 it "does nothing if the gist is up to date" do
64- subject . execute ( { } )
64+ updated_gist = "They updated me :("
65+
66+ DiscourseAi ::Completions ::Llm . with_prepared_responses ( [ updated_gist ] ) do
67+ subject . execute ( { } )
68+ end
6569
6670 gist = AiSummary . gist . find_by ( target : topic_1 )
67- expect ( gist . summarized_text ) . to eq ( ai_gist . summarized_text )
71+ expect ( AiSummary . gist . where ( target : topic_1 ) . count ) . to eq ( 1 )
72+ expect ( gist . summarized_text ) . not_to eq ( updated_gist )
6873 expect ( gist . original_content_sha ) . to eq ( ai_gist . original_content_sha )
6974 end
7075
You can’t perform that action at this time.
0 commit comments