0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-11 02:59:07 +08:00
discourse/plugins/discourse-ai/lib/configuration
Rafael dos Santos Silva 0dfc9e997f
DEV: exercise streaming in LLM model Run Test (#39983)
## Summary
- The "Run Test" button on the Discourse AI LLM admin form only issued a
non-streaming completion, so configurations that worked for that probe
could still fail in production when a streaming response was requested.
- `LlmValidator#run_test` now runs the non-streaming probe followed by a
streaming probe (block-form `Llm#generate`) and raises if either returns
nothing. It tracks `last_failed_mode` (`:non_streaming` / `:streaming`).
- The controller surfaces `failed_mode` in the JSON response and the
admin form renders a mode-specific error string so operators can see
which path is broken.
- Per-user rate limit on `POST /admin/plugins/discourse-ai/ai-llms/test`
doubled (3 → 6 / minute) to absorb the extra request per click.

## Test plan
- [ ] `bin/rspec
plugins/discourse-ai/spec/configuration/llm_validator_spec.rb`
- [ ] `bin/rspec
plugins/discourse-ai/spec/requests/admin/ai_llms_controller_spec.rb -e
"POST #test"`
- [ ] In admin UI, click "Run test" on an LLM config and confirm both
probes are exercised (success path).
- [ ] Configure an endpoint where streaming is broken and confirm the
form reports "Streaming request failed: …".
2026-05-13 14:09:57 -03:00
..
agent_enumerator.rb DEV: AI persona to agent migration (#38319) 2026-03-10 15:59:45 +11:00
embedding_defs_enumerator.rb
embedding_defs_validator.rb DEV: Fix assigned but unused variable Prism warnings (#39436) 2026-04-22 12:42:14 +02:00
embeddings_module_validator.rb
feature.rb DEV: Add the ability to register an AI module for data explorer (#38891) 2026-04-03 13:59:06 +08:00
llm_dependency_validator.rb
llm_enumerator.rb DEV: AI persona to agent migration (#38319) 2026-03-10 15:59:45 +11:00
llm_validator.rb DEV: exercise streaming in LLM model Run Test (#39983) 2026-05-13 14:09:57 -03:00
llm_vision_enumerator.rb
module.rb DEV: Add the ability to register an AI module for data explorer (#38891) 2026-04-03 13:59:06 +08:00
simple_llm_validator.rb
spam_detection_validator.rb