mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-02-07 12:08:13 +00:00
a5a39dd2ee
Follow up to b863ddc94bf03e1868845e10ba744bef1f68841d Ruby: * Validate `summary` (the column is `not null`) * Fix `name` validation (the column has `max_length` 100) * Fix table annotations * Accept missing `parameter` attributes (`required, `enum`, `enum_values`) JS: * Use native classes * Don't use ember's array extensions * Add explicit service injections * Correct class names * Use `||=` operator * Use `store` service to create records * Remove unused service injections * Extract consts * Group actions together * Use `async`/`await` * Use `withEventValue` * Sort html attributes * Use DButtons `@label` arg * Use `input` elements instead of Ember's `Input` component (same w/ textarea) * Remove `btn-default` class (automatically applied by DButton) * Don't mix `I18n.t` and `i18n` in the same template * Don't track props that aren't used in a template * Correct invalid `target.value` code * Remove unused/invalid `this.parameter`/`onChange` code * Whitespace * Use the new service import `inject as service` -> `service` * Use `Object.entries()` * Add missing i18n strings * Fix an error in `addEnumValue` (calling `pushObject` on `undefined`) * Use `TrackedArray`/`TrackedObject` * Transform tool `parameters` keys (`enumValues` -> `enum_values`)
16 lines
466 B
JavaScript
16 lines
466 B
JavaScript
import DiscourseRoute from "discourse/routes/discourse";
|
|
|
|
export default class DiscourseAiToolsNewRoute extends DiscourseRoute {
|
|
async model() {
|
|
return this.store.createRecord("ai-tool");
|
|
}
|
|
|
|
setupController(controller) {
|
|
super.setupController(...arguments);
|
|
const toolsModel = this.modelFor("adminPlugins.show.discourse-ai-tools");
|
|
|
|
controller.set("allTools", toolsModel);
|
|
controller.set("presets", toolsModel.resultSetMeta.presets);
|
|
}
|
|
}
|