UX: add features to persona list and other style updates (#1405)
This commit is contained in:
@@ -9,15 +9,16 @@ module DiscourseAi
|
||||
|
||||
def index
|
||||
ai_personas =
|
||||
AiPersona.ordered.map do |persona|
|
||||
# we use a special serializer here cause names and descriptions are
|
||||
# localized for system personas
|
||||
LocalizedAiPersonaSerializer.new(persona, root: false)
|
||||
end
|
||||
AiPersona
|
||||
.ordered
|
||||
.includes(:user, :uploads)
|
||||
.map { |persona| LocalizedAiPersonaSerializer.new(persona, root: false) }
|
||||
|
||||
tools =
|
||||
DiscourseAi::Personas::Persona.all_available_tools.map do |tool|
|
||||
AiToolSerializer.new(tool, root: false)
|
||||
end
|
||||
|
||||
AiTool
|
||||
.where(enabled: true)
|
||||
.each do |tool|
|
||||
@@ -31,10 +32,12 @@ module DiscourseAi
|
||||
),
|
||||
}
|
||||
end
|
||||
|
||||
llms =
|
||||
DiscourseAi::Configuration::LlmEnumerator.values_for_serialization(
|
||||
allowed_seeded_llm_ids: SiteSetting.ai_bot_allowed_seeded_models_map,
|
||||
)
|
||||
|
||||
render json: {
|
||||
ai_personas: ai_personas,
|
||||
meta: {
|
||||
|
||||
@@ -32,7 +32,8 @@ class LocalizedAiPersonaSerializer < ApplicationSerializer
|
||||
:allow_personal_messages,
|
||||
:force_default_llm,
|
||||
:response_format,
|
||||
:examples
|
||||
:examples,
|
||||
:features
|
||||
|
||||
has_one :user, serializer: BasicUserSerializer, embed: :object
|
||||
has_many :rag_uploads, serializer: UploadSerializer, embed: :object
|
||||
@@ -53,4 +54,10 @@ class LocalizedAiPersonaSerializer < ApplicationSerializer
|
||||
def default_llm
|
||||
LlmModel.find_by(id: object.default_llm_id)
|
||||
end
|
||||
|
||||
def features
|
||||
object.features.map do |feature|
|
||||
{ id: feature.module_id, module_name: feature.module_name, name: feature.name }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,28 @@
|
||||
@use "lib/viewport";
|
||||
|
||||
.admin-contents .ai-persona-list-editor {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.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;
|
||||
@@ -21,6 +41,163 @@
|
||||
li.disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
&__controls {
|
||||
display: flex;
|
||||
gap: var(--space-2);
|
||||
margin-bottom: var(--space-4);
|
||||
|
||||
.filter-input-container {
|
||||
flex: 4 1 auto;
|
||||
}
|
||||
|
||||
.d-select {
|
||||
flex: 1 1 auto;
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&__no-results {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
padding: var(--space-6);
|
||||
gap: var(--space-2);
|
||||
|
||||
h3 {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.btn {
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
|
||||
&.--layout-table {
|
||||
.--card-label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.--layout-card {
|
||||
tbody {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(18em, 1fr));
|
||||
gap: var(--space-4);
|
||||
border: none;
|
||||
}
|
||||
|
||||
thead {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.d-admin-row__content {
|
||||
display: grid;
|
||||
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);
|
||||
border-radius: var(--d-border-radius);
|
||||
|
||||
.d-admin-row__overview,
|
||||
.ai-persona-list__name-with-description {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.ai-persona-list__name {
|
||||
grid-row: 1;
|
||||
grid-column: 1;
|
||||
font-size: var(--font-up-1);
|
||||
display: inline;
|
||||
align-self: center;
|
||||
|
||||
.avatar {
|
||||
height: 1.25em;
|
||||
position: relative;
|
||||
bottom: 0.15em;
|
||||
}
|
||||
}
|
||||
|
||||
.ai-persona-list__description {
|
||||
grid-row: 2;
|
||||
grid-column: 1;
|
||||
margin: var(--space-2) 0;
|
||||
}
|
||||
|
||||
.d-admin-row__controls {
|
||||
grid-row: 1;
|
||||
grid-column: 2;
|
||||
}
|
||||
|
||||
.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;
|
||||
|
||||
.btn {
|
||||
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;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
&__description {
|
||||
color: var(--primary-high);
|
||||
}
|
||||
|
||||
&__name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
font-size: var(--font-up-0);
|
||||
color: var(--primary);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: var(--line-height-medium);
|
||||
|
||||
.avatar {
|
||||
width: auto;
|
||||
height: 1.25em;
|
||||
}
|
||||
}
|
||||
|
||||
&__row {
|
||||
&:hover {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
&__overview {
|
||||
padding-left: var(--space-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.d-admin-row__row-feature-list {
|
||||
color: var(--primary-medium);
|
||||
}
|
||||
}
|
||||
|
||||
.ai-persona-tool-option-editor {
|
||||
|
||||
@@ -211,10 +211,13 @@ en:
|
||||
custom_prompt: "Custom prompt"
|
||||
image_caption: "Caption images"
|
||||
|
||||
|
||||
modals:
|
||||
select_option: "Select an option..."
|
||||
|
||||
layout:
|
||||
table: "Table"
|
||||
card: "Card"
|
||||
|
||||
spam:
|
||||
short_title: "Spam"
|
||||
title: "Configure spam handling"
|
||||
@@ -379,6 +382,18 @@ en:
|
||||
title: "AI bot options"
|
||||
save_first: "More AI bot options will become available once you save the persona."
|
||||
|
||||
filters:
|
||||
text: "Find a persona"
|
||||
reset: "Reset"
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user