Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 2c16d21

Browse files
WIP: Applying more admin UI guidelines
1 parent 54f2d34 commit 2c16d21

File tree

4 files changed

+33
-62
lines changed

4 files changed

+33
-62
lines changed

assets/javascripts/discourse/components/ai-llms-list-editor.gjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,9 @@ export default class AiLlmsListEditor extends Component {
157157
<td class="column-edit">
158158
<LinkTo
159159
@route="adminPlugins.show.discourse-ai-llms.show"
160-
class="btn btn-default"
160+
class="btn btn-default btn-small"
161161
@model={{llm.id}}
162162
>
163-
{{icon "wrench"}}
164163
<div class="d-button-label">
165164
{{i18n "discourse_ai.llms.edit"}}
166165
</div>

assets/javascripts/discourse/components/ai-persona-list-editor.gjs

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,13 @@ import DToggleSwitch from "discourse/components/d-toggle-switch";
1010
import concatClass from "discourse/helpers/concat-class";
1111
import { popupAjaxError } from "discourse/lib/ajax-error";
1212
import { cook } from "discourse/lib/text";
13-
import icon from "discourse-common/helpers/d-icon";
1413
import i18n from "discourse-common/helpers/i18n";
1514
import I18n from "discourse-i18n";
15+
import AdminPageSubheader from "admin/components/admin-page-subheader";
1616
import AiPersonaEditor from "./ai-persona-editor";
1717

1818
export default class AiPersonaListEditor extends Component {
1919
@service adminPluginNavManager;
20-
@tracked _noPersonaText = null;
21-
22-
get noPersonaText() {
23-
if (this._noPersonaText === null) {
24-
const raw = I18n.t("discourse_ai.ai_persona.no_persona_selected");
25-
cook(raw).then((result) => {
26-
this._noPersonaText = result;
27-
});
28-
}
29-
30-
return this._noPersonaText;
31-
}
3220

3321
@action
3422
async toggleEnabled(persona) {
@@ -53,29 +41,22 @@ export default class AiPersonaListEditor extends Component {
5341
{{#if @currentPersona}}
5442
<AiPersonaEditor @model={{@currentPersona}} @personas={{@personas}} />
5543
{{else}}
56-
<div class="ai-persona-list-editor__header">
57-
<h3>{{i18n "discourse_ai.ai_persona.short_title"}}</h3>
58-
{{#unless @currentPersona.isNew}}
59-
<LinkTo
44+
<AdminPageSubheader
45+
@titleLabel="discourse_ai.ai_persona.short_title"
46+
@descriptionLabel="discourse_ai.ai_persona.persona_description"
47+
@learnMoreUrl="https://meta.discourse.org/t/ai-bot-personas/306099"
48+
>
49+
<:actions as |actions|>
50+
<actions.Primary
51+
@label="discourse_ai.ai_persona.new"
6052
@route="adminPlugins.show.discourse-ai-personas.new"
61-
class="btn btn-small btn-primary"
62-
>
63-
{{icon "plus"}}
64-
<span>{{I18n.t "discourse_ai.ai_persona.new"}}</span>
65-
</LinkTo>
66-
{{/unless}}
67-
</div>
68-
69-
<div class="ai-persona-list-editor__empty">
70-
<details class="details__boxed">
71-
<summary>{{i18n
72-
"discourse_ai.ai_persona.what_are_personas"
73-
}}</summary>
74-
{{this.noPersonaText}}
75-
</details>
76-
</div>
53+
@icon="plus"
54+
class="ai-persona-list-editor__new-button"
55+
/>
56+
</:actions>
57+
</AdminPageSubheader>
7758

78-
<table class="content-list ai-persona-list-editor">
59+
<table class="content-list ai-persona-list-editor d-admin-table">
7960
<thead>
8061
<tr>
8162
<th>{{i18n "discourse_ai.ai_persona.name"}}</th>
@@ -88,11 +69,11 @@ export default class AiPersonaListEditor extends Component {
8869
<tr
8970
data-persona-id={{persona.id}}
9071
class={{concatClass
91-
"ai-persona-list__row"
72+
"ai-persona-list__row d-admin-row__content"
9273
(if persona.priority "priority")
9374
}}
9475
>
95-
<td>
76+
<td class="d-admin-row__overview">
9677
<div class="ai-persona-list__name-with-description">
9778
<div class="ai-persona-list__name">
9879
<strong>
@@ -104,13 +85,13 @@ export default class AiPersonaListEditor extends Component {
10485
</div>
10586
</div>
10687
</td>
107-
<td>
88+
<td class="d-admin-row__detail">
10889
<DToggleSwitch
10990
@state={{persona.enabled}}
11091
{{on "click" (fn this.toggleEnabled persona)}}
11192
/>
11293
</td>
113-
<td>
94+
<td class="d-admin-row__controls">
11495
<LinkTo
11596
@route="adminPlugins.show.discourse-ai-personas.show"
11697
@model={{persona}}

assets/javascripts/discourse/components/ai-tool-list-editor.gjs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import Component from "@glimmer/component";
22
import { LinkTo } from "@ember/routing";
33
import { service } from "@ember/service";
44
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
5-
import icon from "discourse-common/helpers/d-icon";
65
import i18n from "discourse-common/helpers/i18n";
76
import I18n from "discourse-i18n";
7+
import AdminPageSubheader from "admin/components/admin-page-subheader";
88

99
export default class AiToolListEditor extends Component {
1010
@service adminPluginNavManager;
@@ -15,16 +15,17 @@ export default class AiToolListEditor extends Component {
1515
@label={{i18n "discourse_ai.tools.short_title"}}
1616
/>
1717
<section class="ai-tool-list-editor__current admin-detail pull-left">
18-
<div class="ai-tool-list-editor__header">
19-
<h3>{{I18n.t "discourse_ai.tools.short_title"}}</h3>
20-
<LinkTo
21-
@route="adminPlugins.show.discourse-ai-tools.new"
22-
class="btn btn-small btn-primary ai-tool-list-editor__new-button"
23-
>
24-
{{icon "plus"}}
25-
<span>{{I18n.t "discourse_ai.tools.new"}}</span>
26-
</LinkTo>
27-
</div>
18+
19+
<AdminPageSubheader @titleLabel="discourse_ai.tools.short_title">
20+
<:actions as |actions|>
21+
<actions.Primary
22+
@label="discourse_ai.tools.new"
23+
@route="adminPlugins.show.discourse-ai-tools.new"
24+
@icon="plus"
25+
class="ai-tool-list-editor__new-button"
26+
/>
27+
</:actions>
28+
</AdminPageSubheader>
2829

2930
<table class="content-list ai-tool-list-editor">
3031
<tbody>

config/locales/client.en.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,7 @@ en:
185185
tool_options: "Tool options"
186186
rag_conversation_chunks: "Search conversation chunks"
187187
rag_conversation_chunks_help: "The number of chunks to use for the RAG model searches. Increase to increase the amount of context the AI can use."
188-
what_are_personas: "What are Personas?"
189-
no_persona_selected: |
190-
Personas are a powerful feature that allows you to customize the behavior of the AI engine in your Discourse forum. They act as a 'system message' that guides the AI's responses and interactions, helping to create a more personalized and engaging user experience.
191-
192-
#### Why use personas?
193-
194-
With personas, you can tailor the AI's behavior to better fit the context and tone of your forum. Whether you want the AI to be more formal for a professional setting, more casual for a community forum, or even embody a specific character for a role-playing game, personas give you the flexibility to do so.
195-
196-
#### Group-specific access to personas
197-
198-
Moreover, you can set it up so that certain user groups have access to specific personas. This means you can have different AI behaviors for different sections of your forum, further enhancing the diversity and richness of your community's interactions.
188+
persona_description: "Personas are a powerful feature that allows you to customize the behavior of the AI engine in your Discourse forum. They act as a 'system message' that guides the AI's responses and interactions, helping to create a more personalized and engaging user experience."
199189

200190
rag:
201191
options:

0 commit comments

Comments
 (0)