mirror of
https://ghfast.top/https://github.com/discourse/discourse-ai.git
synced 2026-05-26 01:04:52 +08:00
Follow up to b863ddc94b
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`)
21 lines
491 B
JavaScript
21 lines
491 B
JavaScript
import RestAdapter from "discourse/adapters/rest";
|
|
|
|
export default class AiToolAdapter extends RestAdapter {
|
|
jsonMode = true;
|
|
|
|
basePath() {
|
|
return "/admin/plugins/discourse-ai/";
|
|
}
|
|
|
|
pathFor(store, type, findArgs) {
|
|
// removes underscores which are implemented in base
|
|
let path =
|
|
this.basePath(store, type, findArgs) +
|
|
store.pluralize(this.apiNameFor(type));
|
|
return this.appendQueryParams(path, findArgs);
|
|
}
|
|
|
|
apiNameFor() {
|
|
return "ai-tool";
|
|
}
|
|
}
|