Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def suggest
prompt.custom_instruction = params[:custom_prompt]
end

suggest_thumbnails(input) if prompt.id == CompletionPrompt::ILLUSTRATE_POST
return suggest_thumbnails(input) if prompt.id == CompletionPrompt::ILLUSTRATE_POST

hijack do
render json:
Expand Down
14 changes: 14 additions & 0 deletions spec/requests/ai_helper/assistant_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@
end
end

it "prevents double render when mode is ILLUSTRATE_POST" do
DiscourseAi::Completions::Llm.with_prepared_responses([proofread_text]) do
expect {
post "/discourse-ai/ai-helper/suggest",
params: {
mode: CompletionPrompt::ILLUSTRATE_POST,
text: text_to_proofread,
force_default_locale: true,
}
}.not_to raise_error
expect(response.status).to eq(200)
end
end

context "when performing numerous requests" do
it "rate limits" do
RateLimiter.enable
Expand Down