This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
spec/lib/modules/automation Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def self.handle(
3232
3333 content = llm . tokenizer . truncate ( content , max_post_tokens ) if max_post_tokens . present?
3434
35- prompt . push ( type : :user , content : content )
35+ prompt . push ( type : :user , content : content , upload_ids : post . upload_ids )
3636
3737 result = nil
3838
Original file line number Diff line number Diff line change @@ -164,6 +164,10 @@ def record_prompt(prompt)
164164 @prompts << prompt . dup if @prompts
165165 end
166166
167+ def prompts
168+ @prompts
169+ end
170+
167171 def proxy ( model )
168172 llm_model =
169173 if model . is_a? ( LlmModel )
Original file line number Diff line number Diff line change @@ -161,4 +161,23 @@ def triage(**args)
161161
162162 expect ( reviewable . target ) . to eq ( post )
163163 end
164+
165+ it "includes post uploads when triaging" do
166+ post_upload = Fabricate ( :image_upload , posts : [ post ] )
167+
168+ DiscourseAi ::Completions ::Llm . with_prepared_responses ( [ "bad" ] ) do
169+ triage (
170+ post : post ,
171+ model : "custom:#{ llm_model . id } " ,
172+ system_prompt : "test %%POST%%" ,
173+ search_for_text : "bad" ,
174+ flag_post : true ,
175+ automation : nil ,
176+ )
177+
178+ triage_prompt = DiscourseAi ::Completions ::Llm . prompts . last
179+
180+ expect ( triage_prompt . messages . last [ :upload_ids ] ) . to contain_exactly ( post_upload . id )
181+ end
182+ end
164183end
You can’t perform that action at this time.
0 commit comments