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(
32
32
33
33
content = llm . tokenizer . truncate ( content , max_post_tokens ) if max_post_tokens . present?
34
34
35
- prompt . push ( type : :user , content : content )
35
+ prompt . push ( type : :user , content : content , upload_ids : post . upload_ids )
36
36
37
37
result = nil
38
38
Original file line number Diff line number Diff line change @@ -164,6 +164,10 @@ def record_prompt(prompt)
164
164
@prompts << prompt . dup if @prompts
165
165
end
166
166
167
+ def prompts
168
+ @prompts
169
+ end
170
+
167
171
def proxy ( model )
168
172
llm_model =
169
173
if model . is_a? ( LlmModel )
Original file line number Diff line number Diff line change @@ -161,4 +161,23 @@ def triage(**args)
161
161
162
162
expect ( reviewable . target ) . to eq ( post )
163
163
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
164
183
end
You can’t perform that action at this time.
0 commit comments