mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-06-27 10:02:16 +00:00
FIX: Double render error with thumbnail suggestions (#968)
This PR fixes a bug where a double render error appears in the logs when thumbnails are suggested
This commit is contained in:
parent
dabef02919
commit
4da033c667
@ -35,7 +35,7 @@ module DiscourseAi
|
|||||||
prompt.custom_instruction = params[:custom_prompt]
|
prompt.custom_instruction = params[:custom_prompt]
|
||||||
end
|
end
|
||||||
|
|
||||||
suggest_thumbnails(input) if prompt.id == CompletionPrompt::ILLUSTRATE_POST
|
return suggest_thumbnails(input) if prompt.id == CompletionPrompt::ILLUSTRATE_POST
|
||||||
|
|
||||||
hijack do
|
hijack do
|
||||||
render json:
|
render json:
|
||||||
|
@ -101,6 +101,20 @@ RSpec.describe DiscourseAi::AiHelper::AssistantController do
|
|||||||
end
|
end
|
||||||
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
|
context "when performing numerous requests" do
|
||||||
it "rate limits" do
|
it "rate limits" do
|
||||||
RateLimiter.enable
|
RateLimiter.enable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user