FIX: Triage's search_for_text should be case-insensitive (#767)
This commit is contained in:
parent
9019e90b87
commit
eac83eb619
|
@ -38,7 +38,7 @@ module DiscourseAi
|
|||
feature_name: "llm_triage",
|
||||
)&.strip
|
||||
|
||||
if result.present? && result.downcase.include?(search_for_text)
|
||||
if result.present? && result.downcase.include?(search_for_text.downcase)
|
||||
user = User.find_by_username(canned_reply_user) if canned_reply_user.present?
|
||||
user = user || Discourse.system_user
|
||||
if canned_reply.present?
|
||||
|
|
|
@ -108,4 +108,21 @@ describe DiscourseAi::Automation::LlmTriage do
|
|||
|
||||
expect(reviewable&.target).to eq(post)
|
||||
end
|
||||
|
||||
it "treats search_for_text as case-insensitive" do
|
||||
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
|
||||
triage(
|
||||
post: post,
|
||||
model: "custom:#{llm_model.id}",
|
||||
system_prompt: "test %%POST%%",
|
||||
search_for_text: "BAD",
|
||||
flag_post: true,
|
||||
automation: nil,
|
||||
)
|
||||
end
|
||||
|
||||
reviewable = ReviewablePost.last
|
||||
|
||||
expect(reviewable.target).to eq(post)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue