Revert "Use feature name instead of just module name"
This reverts commit 1575710940
.
This commit is contained in:
parent
1575710940
commit
7967be4dd8
|
@ -56,8 +56,6 @@ class LocalizedAiPersonaSerializer < ApplicationSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def features
|
def features
|
||||||
object.features.map do |feature|
|
object.features.map { |feature| { id: feature.module_id, name: feature.module_name } }
|
||||||
{ id: feature.module_id, module_name: feature.module_name, name: feature.name }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { concat, fn, hash } from "@ember/helper";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { LinkTo } from "@ember/routing";
|
import { LinkTo } from "@ember/routing";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
|
import { gt } from "truth-helpers";
|
||||||
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
|
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
|
||||||
import DButton from "discourse/components/d-button";
|
import DButton from "discourse/components/d-button";
|
||||||
import DPageSubheader from "discourse/components/d-page-subheader";
|
import DPageSubheader from "discourse/components/d-page-subheader";
|
||||||
|
@ -59,7 +60,7 @@ export default class AiPersonaListEditor extends Component {
|
||||||
if (this.featureFilter !== "all") {
|
if (this.featureFilter !== "all") {
|
||||||
personas = personas.filter((persona) =>
|
personas = personas.filter((persona) =>
|
||||||
(persona.features || []).some(
|
(persona.features || []).some(
|
||||||
(feature) => feature.module_name === this.featureFilter
|
(feature) => feature.name === this.featureFilter
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +77,11 @@ export default class AiPersonaListEditor extends Component {
|
||||||
feature.name?.toLowerCase().includes(term)
|
feature.name?.toLowerCase().includes(term)
|
||||||
);
|
);
|
||||||
|
|
||||||
return textMatches || featureMatches;
|
const llmMatches = persona.default_llm?.display_name
|
||||||
|
?.toLowerCase()
|
||||||
|
.includes(term);
|
||||||
|
|
||||||
|
return textMatches || featureMatches || llmMatches;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +92,8 @@ export default class AiPersonaListEditor extends Component {
|
||||||
let features = [];
|
let features = [];
|
||||||
(this.args.personas || []).forEach((persona) => {
|
(this.args.personas || []).forEach((persona) => {
|
||||||
(persona.features || []).forEach((feature) => {
|
(persona.features || []).forEach((feature) => {
|
||||||
if (feature?.module_name && !features.includes(feature.module_name)) {
|
if (feature?.name && !features.includes(feature.name)) {
|
||||||
features.push(feature.module_name);
|
features.push(feature.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -98,9 +103,9 @@ export default class AiPersonaListEditor extends Component {
|
||||||
value: "all",
|
value: "all",
|
||||||
label: i18n("discourse_ai.ai_persona.filters.all_features"),
|
label: i18n("discourse_ai.ai_persona.filters.all_features"),
|
||||||
},
|
},
|
||||||
...features.map((module_name) => ({
|
...features.map((name) => ({
|
||||||
value: module_name,
|
value: name,
|
||||||
label: i18n(`discourse_ai.features.${module_name}.name`),
|
label: i18n(`discourse_ai.features.${name}.name`),
|
||||||
})),
|
})),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -248,6 +253,7 @@ export default class AiPersonaListEditor extends Component {
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{i18n "discourse_ai.ai_persona.name"}}</th>
|
<th>{{i18n "discourse_ai.ai_persona.name"}}</th>
|
||||||
|
<th>{{i18n "discourse_ai.llms.short_title"}}</th>
|
||||||
<th>{{i18n "discourse_ai.features.short_title"}}</th>
|
<th>{{i18n "discourse_ai.features.short_title"}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -274,22 +280,43 @@ export default class AiPersonaListEditor extends Component {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="d-admin-row__llms">
|
||||||
|
{{#if persona.default_llm}}
|
||||||
|
<span class="--card-label">
|
||||||
|
{{i18n "discourse_ai.ai_persona.llms_list"}}
|
||||||
|
</span>
|
||||||
|
<DButton
|
||||||
|
class="btn-flat btn-small ai-persona-list__row-item-feature"
|
||||||
|
@translatedLabel={{persona.default_llm.display_name}}
|
||||||
|
@route="adminPlugins.show.discourse-ai-llms.edit"
|
||||||
|
@routeModels={{persona.default_llm.id}}
|
||||||
|
/>
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
<td class="d-admin-row__features">
|
<td class="d-admin-row__features">
|
||||||
{{#each persona.features as |feature|}}
|
{{#if persona.features.length}}
|
||||||
|
<span class="--card-label">
|
||||||
|
{{i18n
|
||||||
|
"discourse_ai.ai_persona.features_list"
|
||||||
|
count=persona.features.length
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
{{#each persona.features as |feature index|}}
|
||||||
|
<span class="d-admin-row__row-feature-list">
|
||||||
|
{{#if (gt index 0)}}, {{/if}}
|
||||||
<DButton
|
<DButton
|
||||||
class="btn-flat btn-small ai-persona-list__row-item-feature"
|
class="btn-flat btn-small ai-persona-list__row-item-feature"
|
||||||
@translatedLabel={{i18n
|
@translatedLabel={{i18n
|
||||||
(concat
|
(concat
|
||||||
"discourse_ai.features."
|
"discourse_ai.features." feature.name ".name"
|
||||||
feature.module_name
|
|
||||||
"."
|
|
||||||
feature.name
|
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
@route="adminPlugins.show.discourse-ai-features.edit"
|
@route="adminPlugins.show.discourse-ai-features.edit"
|
||||||
@routeModels={{feature.id}}
|
@routeModels={{feature.id}}
|
||||||
/>
|
/>
|
||||||
|
</span>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td class="d-admin-row__controls">
|
<td class="d-admin-row__controls">
|
||||||
<LinkTo
|
<LinkTo
|
||||||
|
|
|
@ -5,6 +5,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-persona-list-editor {
|
.ai-persona-list-editor {
|
||||||
|
@include viewport.until(md) {
|
||||||
|
td {
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
&.d-admin-row__llms,
|
||||||
|
&.d-admin-row__features {
|
||||||
|
padding-block: 0;
|
||||||
|
|
||||||
|
.--card-label {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: var(--font-down-1);
|
||||||
|
color: var(--primary-high);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&__header {
|
&__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
@ -57,6 +75,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.--layout-table {
|
||||||
|
.--card-label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.--layout-card {
|
&.--layout-card {
|
||||||
tbody {
|
tbody {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
@ -71,7 +95,7 @@
|
||||||
|
|
||||||
.d-admin-row__content {
|
.d-admin-row__content {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: auto auto 1fr;
|
grid-template-rows: auto 1fr auto auto;
|
||||||
grid-template-columns: 1fr auto;
|
grid-template-columns: 1fr auto;
|
||||||
border: 1px solid var(--primary-low);
|
border: 1px solid var(--primary-low);
|
||||||
padding: var(--space-2) var(--space-4) var(--space-4);
|
padding: var(--space-2) var(--space-4) var(--space-4);
|
||||||
|
@ -108,6 +132,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.d-admin-row__features {
|
.d-admin-row__features {
|
||||||
|
grid-row: 4;
|
||||||
|
grid-column: 1 / span 2;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
margin-top: var(--space-0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.d-admin-row__llms {
|
||||||
grid-row: 3;
|
grid-row: 3;
|
||||||
grid-column: 1 / span 2;
|
grid-column: 1 / span 2;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -116,13 +150,17 @@
|
||||||
margin-top: var(--space-2);
|
margin-top: var(--space-2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.--card-label {
|
||||||
|
color: var(--primary-high);
|
||||||
|
font-size: var(--font-down-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-persona-list {
|
.ai-persona-list {
|
||||||
&__row-item-feature {
|
&__row-item-feature {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin-right: 0.5em;
|
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,6 +194,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.d-admin-row__row-feature-list {
|
||||||
|
color: var(--primary-medium);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-persona-tool-option-editor {
|
.ai-persona-tool-option-editor {
|
||||||
|
|
|
@ -211,7 +211,6 @@ en:
|
||||||
custom_prompt: "Custom prompt"
|
custom_prompt: "Custom prompt"
|
||||||
image_caption: "Caption images"
|
image_caption: "Caption images"
|
||||||
|
|
||||||
|
|
||||||
modals:
|
modals:
|
||||||
select_option: "Select an option..."
|
select_option: "Select an option..."
|
||||||
|
|
||||||
|
@ -389,6 +388,12 @@ en:
|
||||||
no_results: "No personas found matching your filters."
|
no_results: "No personas found matching your filters."
|
||||||
all_features: "Any feature"
|
all_features: "Any feature"
|
||||||
|
|
||||||
|
features_list:
|
||||||
|
one: "Feature:"
|
||||||
|
other: "Features:"
|
||||||
|
|
||||||
|
llms_list: "LLM:"
|
||||||
|
|
||||||
rag:
|
rag:
|
||||||
title: "RAG"
|
title: "RAG"
|
||||||
options:
|
options:
|
||||||
|
|
Loading…
Reference in New Issue