mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-26 17:30:30 +08:00
## 🔍 Overview This update adds AI enhancement to the quick search feature of Discourse. When the setting: `ai_embeddings_semantic_quick_search_enabled` is enabled and a search is made using quick search menu yielding only a few results or none, AI results will be appended to the result. ## 📹 Preview ### Before https://github.com/user-attachments/assets/f3880cc3-9e9e-4b1e-8fd2-bb2cc27fd7de ### After https://github.com/user-attachments/assets/c6975690-2aa3-44a9-b8e8-ad4d42effa9b
20 lines
772 B
JavaScript
Vendored
20 lines
772 B
JavaScript
Vendored
import { module, test } from "qunit";
|
|
import AiQuickSearch from "discourse/plugins/discourse-ai/discourse/connectors/search-menu-results-bottom/ai-quick-search";
|
|
|
|
module("Unit | Component | ai-quick-search", function () {
|
|
module("shouldRender", function () {
|
|
test("returns true when site setting is enabled", function (assert) {
|
|
const siteSettings = {
|
|
ai_embeddings_semantic_quick_search_enabled: true,
|
|
};
|
|
assert.true(AiQuickSearch.shouldRender({}, { siteSettings }));
|
|
});
|
|
|
|
test("returns false when site setting is disabled", function (assert) {
|
|
const siteSettings = {
|
|
ai_embeddings_semantic_quick_search_enabled: false,
|
|
};
|
|
assert.false(AiQuickSearch.shouldRender({}, { siteSettings }));
|
|
});
|
|
});
|
|
});
|