mirror of
https://ghfast.top/https://github.com/discourse/discourse-ai.git
synced 2026-07-17 11:46:28 +08:00
This update adds the ability to disable search discoveries. This can be done through a tooltip when search discoveries are shown. It can also be done in the AI user preferences, which has also been updated to accommodate more than just the one image caption setting.
27 lines
753 B
JavaScript
27 lines
753 B
JavaScript
import { tracked } from "@glimmer/tracking";
|
|
import { action } from "@ember/object";
|
|
import Service, { service } from "@ember/service";
|
|
|
|
export default class DiscobotDiscoveries extends Service {
|
|
// We use this to retain state after search menu gets closed.
|
|
// Similar to discourse/discourse#25504
|
|
@service currentUser;
|
|
|
|
@tracked discovery = "";
|
|
@tracked lastQuery = "";
|
|
@tracked discoveryTimedOut = false;
|
|
@tracked modelUsed = "";
|
|
|
|
resetDiscovery() {
|
|
this.discovery = "";
|
|
this.discoveryTimedOut = false;
|
|
this.modelUsed = "";
|
|
}
|
|
|
|
@action
|
|
async disableDiscoveries() {
|
|
this.currentUser.user_option.ai_search_discoveries = false;
|
|
await this.currentUser.save(["ai_search_discoveries"]);
|
|
location.reload();
|
|
}
|
|
}
|