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 +23
-1
lines changed
spec/lib/modules/automation Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,9 @@ def self.handle(
6666
6767 changes = { }
6868 changes [ :category_id ] = category_id if category_id . present?
69- changes [ :tags ] = tags if SiteSetting . tagging_enabled? && tags . present?
69+ if SiteSetting . tagging_enabled? && tags . present?
70+ changes [ :tags ] = post . topic . tags . map ( &:name ) . concat ( tags )
71+ end
7072
7173 if changes . present?
7274 first_post = post . topic . posts . where ( post_number : 1 ) . first
Original file line number Diff line number Diff line change @@ -198,4 +198,24 @@ def triage(**args)
198198 expect ( spy . model_params [ :stop_sequences ] ) . to contain_exactly ( *sequences )
199199 end
200200 end
201+
202+ it "append rule tags instead of replacing them" do
203+ tag_1 = Fabricate ( :tag )
204+ tag_2 = Fabricate ( :tag )
205+ post . topic . update! ( tags : [ tag_1 ] )
206+
207+ DiscourseAi ::Completions ::Llm . with_prepared_responses ( [ "bad" ] ) do
208+ triage (
209+ post : post ,
210+ model : "custom:#{ llm_model . id } " ,
211+ system_prompt : "test %%POST%%" ,
212+ search_for_text : "bad" ,
213+ flag_post : true ,
214+ tags : [ tag_2 . name ] ,
215+ automation : nil ,
216+ )
217+ end
218+
219+ expect ( post . topic . reload . tags ) . to contain_exactly ( tag_1 , tag_2 )
220+ end
201221end
You can’t perform that action at this time.
0 commit comments