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