Skip to content

A platform for community discussion. Free, open, simple.

DEV: AI persona to agent migration (#38319)

Same3fae646d4c7
diff --git a/plugins/discourse-ai/README.md b/plugins/discourse-ai/README.md
index 8a641dadc56..76f0297298a 100644
--- a/plugins/discourse-ai/README.md
+++ b/plugins/discourse-ai/README.md
@@ -21,11 +21,11 @@ Usage: evals/run [options]
-l, --list List eval ids
--list-models List configured LLMs
--list-features List feature keys available to evals
- --list-personas List persona definitions under evals/personas
+ --list-agents List agent definitions under evals/agents
-f, --feature KEY Filter evals by feature (module_name:feature_name)
-j, --judge NAME LLM config used as a judge (defaults to gpt-4o when available)
- --persona-keys KEYS Comma-separated list of persona keys (or repeat the flag) to run sequentially
- --compare MODE Run comparisons (MODE: personas or llms)
+ --agent-keys KEYS Comma-separated list of agent keys (or repeat the flag) to run sequentially
+ --compare MODE Run comparisons (MODE: agents or llms)
--dataset PATH Path to a CSV dataset file (requires --feature)
```
@@ -35,26 +35,26 @@ OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key
GEMINI_API_KEY=your_gemini_api_key
-#### Custom personas for evals
+#### Custom agents for evals
-Eval runs can swap the built-in personas with YAML definitions stored in
-`plugins/discourse-ai/evals/personas`. Use `--list-personas` to discover available entries; the
-special key `default` always refers to the built-in persona prompt. Pass `--persona-keys key1,key2`
-(or repeat `--persona-keys key`) to apply them:
+Eval runs can swap the built-in agents with YAML definitions stored in
+`plugins/discourse-ai/evals/agents`. Use `--list-agents` to discover available entries; the
+special key `default` always refers to the built-in agent prompt. Pass `--agent-keys key1,key2`
+(or repeat `--agent-keys key`) to apply them:
```
-./run --eval simple_summarization --models gpt-4o-mini --persona-keys topic_summary_eval,another_prompt
+./run --eval simple_summarization --models gpt-4o-mini --agent-keys topic_summary_eval,another_prompt
```
-Each persona file only needs a `system_prompt` (and optional description). When specified, that
-prompt replaces the default system prompt of whichever persona the eval runner would normally use.
+Each agent file only needs a `system_prompt` (and optional description). When specified, that
+prompt replaces the default system prompt of whichever agent the eval runner would normally use.
Pass multiple keys (including `default`) to rerun the same evals with different prompts without
restarting the CLI. Add new files under that directory to compare alternate prompts without touching
the database.
-When running persona comparisons (`--compare personas`) the CLI automatically prepends the built-in
-`default` persona so you can benchmark your YAML prompts against the stock behavior. Non-comparison
-runs still execute only the personas you list.
+When running agent comparisons (`--compare agents`) the CLI automatically prepends the built-in
+`default` agent so you can benchmark your YAML prompts against the stock behavior. Non-comparison
+runs still execute only the agents you list.
#### Dataset-driven evals
@@ -71,12 +71,12 @@ feature’s runner. Example:
Use the `--compare` flag to ask the CLI to judge multiple runs together:
-- `--compare personas`: require a single `--models` value and at least one persona key (the
- built-in `default` persona is implicitly added). Each eval is executed for every persona; the
+- `--compare agents`: require a single `--models` value and at least one agent key (the
+ built-in `default` agent is implicitly added). Each eval is executed for every agent; the
judge LLM scores them side-by-side and announces the winner plus individual ratings.
-- `--compare llms`: require at least two `--models` and exactly one persona (default unless you pass
- `--persona-keys custom_persona`). Every eval runs once and the judge compares the outputs from each
- LLM. Logs include the persona key (or `default`) so you can correlate recordings.
+- `--compare llms`: require at least two `--models` and exactly one agent (default unless you pass
+ `--agent-keys custom_agent`). Every eval runs once and the judge compares the outputs from each
+ LLM. Logs include the agent key (or `default`) so you can correlate recordings.
Both modes reuse the rubric declared under the eval’s `judge` block and stream the comparison summary
to STDOUT. The structured log files continue to be written for each underlying run so you can drill
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-persona-editor.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-agent-editor.gjs
similarity index 72%
rename from plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-persona-editor.gjs
rename to plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-agent-editor.gjs
index abe3a0681f9..c55fdfcc951 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-persona-editor.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-agent-editor.gjs
@@ -23,11 +23,11 @@ import Group from "discourse/models/group";
import GroupChooser from "discourse/select-kit/components/group-chooser";
import { eq, gt, or } from "discourse/truth-helpers";
import { i18n } from "discourse-i18n";
-import AiPersonaResponseFormatEditor from "../components/modal/ai-persona-response-format-editor";
+import AiAgentResponseFormatEditor from "../components/modal/ai-agent-response-format-editor";
import { toPlainObject } from "../lib/utilities";
+import AiAgentCollapsableExample from "./ai-agent-example";
+import AiAgentToolOptions from "./ai-agent-tool-options";
import AiLlmSelector from "./ai-llm-selector";
-import AiPersonaCollapsableExample from "./ai-persona-example";
-import AiPersonaToolOptions from "./ai-persona-tool-options";
import AiToolSelector from "./ai-tool-selector";
import RagOptionsFk from "./rag-options-fk";
import RagUploader from "./rag-uploader";
@@ -37,7 +37,7 @@ const TOOL_TOKEN_HIGH_THRESHOLD = 4000;
const TOOL_TOKEN_BAR_MAX = 6000;
const TOOL_COUNT_WARNING_THRESHOLD = 5;
-export default class PersonaEditor extends Component {
+export default class AgentEditor extends Component {
@service router;
@service site;
@service dialog;
@@ -73,12 +73,12 @@ export default class PersonaEditor extends Component {
}
get allTools() {
- return this.args.personas.resultSetMeta.tools;
+ return this.args.agents.resultSetMeta.tools;
}
get maxPixelValues() {
const l = (key) =>
- i18n(`discourse_ai.ai_persona.vision_max_pixel_sizes.${key}`);
+ i18n(`discourse_ai.ai_agent.vision_max_pixel_sizes.${key}`);
return [
{ name: l("low"), id: 65536 },
{ name: l("medium"), id: 262144 },
@@ -90,11 +90,11 @@ export default class PersonaEditor extends Component {
return [
{
id: "default",
- name: i18n("discourse_ai.ai_persona.execution_mode_options.default"),
+ name: i18n("discourse_ai.ai_agent.execution_mode_options.default"),
},
{
id: "agentic",
- name: i18n("discourse_ai.ai_persona.execution_mode_options.agentic"),
+ name: i18n("discourse_ai.ai_agent.execution_mode_options.agentic"),
},
];
}
@@ -103,14 +103,14 @@ export default class PersonaEditor extends Component {
const content = [
{
id: -1,
- name: i18n("discourse_ai.ai_persona.tool_strategies.all"),
+ name: i18n("discourse_ai.ai_agent.tool_strategies.all"),
},
];
[1, 2, 5].forEach((i) => {
content.push({
id: i,
- name: i18n("discourse_ai.ai_persona.tool_strategies.replies", {
+ name: i18n("discourse_ai.ai_agent.tool_strategies.replies", {
count: i,
}),
});
@@ -140,23 +140,23 @@ export default class PersonaEditor extends Component {
this.isSaving = true;
try {
- const personaToSave = Object.assign(
+ const agentToSave = Object.assign(
this.args.model,
this.args.model.fromPOJO(data)
);
- await personaToSave.save();
- this.#sortPersonas();
+ await agentToSave.save();
+ this.#sortAgents();
if (isNew && this.args.model.rag_uploads.length === 0) {
- addUniqueValueToArray(this.args.personas.content, personaToSave);
+ addUniqueValueToArray(this.args.agents.content, agentToSave);
await this.router.replaceWith(
- "adminPlugins.show.discourse-ai-personas.edit",
- personaToSave
+ "adminPlugins.show.discourse-ai-agents.edit",
+ agentToSave
);
}
this.toasts.success({
- data: { message: i18n("discourse_ai.ai_persona.saved") },
+ data: { message: i18n("discourse_ai.ai_agent.saved") },
duration: "short",
});
} catch (e) {
@@ -178,12 +178,12 @@ export default class PersonaEditor extends Component {
@action
delete() {
return this.dialog.confirm({
- message: i18n("discourse_ai.ai_persona.confirm_delete"),
+ message: i18n("discourse_ai.ai_agent.confirm_delete"),
didConfirm: () => {
return this.args.model.destroyRecord().then(() => {
- removeValueFromArray(this.args.personas.content, this.args.model);
+ removeValueFromArray(this.args.agents.content, this.args.model);
this.router.transitionTo(
- "adminPlugins.show.discourse-ai-personas.index"
+ "adminPlugins.show.discourse-ai-agents.index"
);
});
},
@@ -357,7 +357,7 @@ export default class PersonaEditor extends Component {
return updatedOptions;
}
- async persistField(dirtyData, field, newValue, sortPersonas) {
+ async persistField(dirtyData, field, newValue, sortAgents) {
if (!this.args.model.isNew) {
const updatedDirtyData = Object.assign({}, dirtyData);
updatedDirtyData[field] = newValue;
@@ -368,8 +368,8 @@ export default class PersonaEditor extends Component {
this.dirtyFormData = updatedDirtyData;
await this.args.model.update(args);
- if (sortPersonas) {
- this.#sortPersonas();
+ if (sortAgents) {
+ this.#sortAgents();
}
} catch (e) {
popupAjaxError(e);
@@ -377,9 +377,9 @@ export default class PersonaEditor extends Component {
}
}
- #sortPersonas() {
- // .sort is done in place and personas.content is a tracked array.
- this.args.personas.content.sort((a, b) => {
+ #sortAgents() {
+ // .sort is done in place and agents.content is a tracked array.
+ this.args.agents.content.sort((a, b) => {
if (a.priority && !b.priority) {
return -1;
} else if (!a.priority && b.priority) {
@@ -391,21 +391,21 @@ export default class PersonaEditor extends Component {
}
@action
- exportPersona() {
- const exportUrl = `/admin/plugins/discourse-ai/ai-personas/${this.args.model.id}/export.json`;
+ exportAgent() {
+ const exportUrl = `/admin/plugins/discourse-ai/ai-agents/${this.args.model.id}/export.json`;
window.location.href = getURL(exportUrl);
}
<template>
<BackButton
- @route="adminPlugins.show.discourse-ai-personas"
- @label="discourse_ai.ai_persona.back"
+ @route="adminPlugins.show.discourse-ai-agents"
+ @label="discourse_ai.ai_agent.back"
/>
- <div class="ai-persona-editor" {{didInsert this.updateAllGroups @model.id}}>
+ <div class="ai-agent-editor" {{didInsert this.updateAllGroups @model.id}}>
<Form @onSubmit={{this.save}} @data={{this.formData}} as |form data|>
<form.Field
@name="name"
- @title={{i18n "discourse_ai.ai_persona.name"}}
+ @title={{i18n "discourse_ai.ai_agent.name"}}
@validation="required|length:1,100"
@disabled={{data.system}}
@format="large"
@@ -416,7 +416,7 @@ export default class PersonaEditor extends Component {
<form.Field
@name="description"
- @title={{i18n "discourse_ai.ai_persona.description"}}
+ @title={{i18n "discourse_ai.ai_agent.description"}}
@validation="required|length:1,100"
@disabled={{data.system}}
@format="large"
@@ -427,7 +427,7 @@ export default class PersonaEditor extends Component {
<form.Field
@name="system_prompt"
- @title={{i18n "discourse_ai.ai_persona.system_prompt"}}
+ @title={{i18n "discourse_ai.ai_agent.system_prompt"}}
@validation="required|length:1,100000"
@disabled={{data.system}}
@format="large"
@@ -436,28 +436,28 @@ export default class PersonaEditor extends Component {
<field.Textarea />
</form.Field>
- <AiPersonaResponseFormatEditor @form={{form}} @data={{data}} />
+ <AiAgentResponseFormatEditor @form={{form}} @data={{data}} />
<form.Field
@name="default_llm_id"
- @title={{i18n "discourse_ai.ai_persona.default_llm"}}
- @tooltip={{i18n "discourse_ai.ai_persona.default_llm_help"}}
+ @title={{i18n "discourse_ai.ai_agent.default_llm"}}
+ @tooltip={{i18n "discourse_ai.ai_agent.default_llm_help"}}
@format="large"
as |field|
>
<field.Custom>
<AiLlmSelector
@value={{field.value}}
- @llms={{@personas.resultSetMeta.llms}}
+ @llms={{@agents.resultSetMeta.llms}}
@onChange={{field.set}}
- class="ai-persona-editor__llms"
+ class="ai-agent-editor__llms"
/>
</field.Custom>
</form.Field>
<form.Field
@name="allowed_group_ids"
- @title={{i18n "discourse_ai.ai_persona.allowed_groups"}}
+ @title={{i18n "discourse_ai.ai_agent.allowed_groups"}}
@format="large"
as |field|
>
@@ -472,8 +472,8 @@ export default class PersonaEditor extends Component {
<form.Field
@name="vision_enabled"
- @title={{i18n "discourse_ai.ai_persona.vision_enabled"}}
- @tooltip={{i18n "discourse_ai.ai_persona.vision_enabled_help"}}
+ @title={{i18n "discourse_ai.ai_agent.vision_enabled"}}
+ @tooltip={{i18n "discourse_ai.ai_agent.vision_enabled_help"}}
@format="large"
as |field|
>
@@ -483,7 +483,7 @@ export default class PersonaEditor extends Component {
{{#if data.vision_enabled}}
<form.Field
@name="vision_max_pixels"
- @title={{i18n "discourse_ai.ai_persona.vision_max_pixels"}}
+ @title={{i18n "discourse_ai.ai_agent.vision_max_pixels"}}
@onSet={{this.onChangeMaxPixels}}
@format="large"
as |field|
@@ -501,8 +501,8 @@ export default class PersonaEditor extends Component {
{{#unless data.system}}
<form.Field
@name="temperature"
- @title={{i18n "discourse_ai.ai_persona.temperature"}}
- @tooltip={{i18n "discourse_ai.ai_persona.temperature_help"}}
+ @title={{i18n "discourse_ai.ai_agent.temperature"}}
+ @tooltip={{i18n "discourse_ai.ai_agent.temperature_help"}}
@disabled={{data.system}}
@format="large"
as |field|
@@ -512,8 +512,8 @@ export default class PersonaEditor extends Component {
<form.Field
@name="top_p"
- @title={{i18n "discourse_ai.ai_persona.top_p"}}
- @tooltip={{i18n "discourse_ai.ai_persona.top_p_help"}}
+ @title={{i18n "discourse_ai.ai_agent.top_p"}}
+ @tooltip={{i18n "discourse_ai.ai_agent.top_p_help"}}
@disabled={{data.system}}
@format="large"
as |field|
@@ -523,22 +523,22 @@ export default class PersonaEditor extends Component {
{{/unless}}
<form.Section
- @title={{i18n "discourse_ai.ai_persona.examples.title"}}
- @subtitle={{i18n "discourse_ai.ai_persona.examples.examples_help"}}
+ @title={{i18n "discourse_ai.ai_agent.examples.title"}}
+ @subtitle={{i18n "discourse_ai.ai_agent.examples.examples_help"}}
>
{{#unless data.system}}
<form.Container>
<form.Button
@action={{fn this.addExamplesPair form data}}
- @label="discourse_ai.ai_persona.examples.new"
- class="ai-persona-editor__new_example"
+ @label="discourse_ai.ai_agent.examples.new"
+ class="ai-agent-editor__new_example"
/>
</form.Container>
{{/unless}}
{{#if (gt data.examples.length 0)}}
<form.Collection @name="examples" as |exCollection exCollectionIdx|>
- <AiPersonaCollapsableExample
+ <AiAgentCollapsableExample
@examplesCollection={{exCollection}}
@exampleNumber={{exCollectionIdx}}
@system={{data.system}}
@@ -548,10 +548,10 @@ export default class PersonaEditor extends Component {
{{/if}}
</form.Section>
- <form.Section @title={{i18n "discourse_ai.ai_persona.ai_tools"}}>
+ <form.Section @title={{i18n "discourse_ai.ai_agent.ai_tools"}}>
<form.Field
@name="tools"
- @title={{i18n "discourse_ai.ai_persona.tools"}}
+ @title={{i18n "discourse_ai.ai_agent.tools"}}
@format="large"
as |field|
>
@@ -560,14 +560,14 @@ export default class PersonaEditor extends Component {
@value={{field.value}}
@disabled={{data.system}}
@onChange={{fn this.updateToolNames form data}}
- @content={{@personas.resultSetMeta.tools}}
+ @content={{@agents.resultSetMeta.tools}}
/>
</field.Custom>
</form.Field>
{{#if (gt data.tools.length 0)}}
<div
- class="ai-persona-editor__tool-context-cost
+ class="ai-agent-editor__tool-context-cost
{{if
(eq (this.toolTokenSeverity data.tools) 'high')
'--high'
@@ -578,58 +578,58 @@ export default class PersonaEditor extends Component {
)
}}"
>
- <ul class="ai-persona-editor__tool-token-list">
+ <ul class="ai-agent-editor__tool-token-list">
{{#each (this.selectedToolsWithTokens data.tools) as |tool|}}
- <li class="ai-persona-editor__tool-token-item">
+ <li class="ai-agent-editor__tool-token-item">
<span>{{tool.name}}</span>
- <span class="ai-persona-editor__tool-token-count">
+ <span class="ai-agent-editor__tool-token-count">
{{tool.tokenCount}}
- {{i18n "discourse_ai.ai_persona.tokens"}}
+ {{i18n "discourse_ai.ai_agent.tokens"}}
</span>
</li>
{{/each}}
</ul>
- <div class="ai-persona-editor__tool-context-cost-header">
- <span class="ai-persona-editor__tool-context-cost-label">
- {{i18n "discourse_ai.ai_persona.context_cost"}}
+ <div class="ai-agent-editor__tool-context-cost-header">
+ <span class="ai-agent-editor__tool-context-cost-label">
+ {{i18n "discourse_ai.ai_agent.context_cost"}}
</span>
- <span class="ai-persona-editor__tool-context-cost-value">
+ <span class="ai-agent-editor__tool-context-cost-value">
{{i18n
- "discourse_ai.ai_persona.tool_tokens_total"
+ "discourse_ai.ai_agent.tool_tokens_total"
tokens=(this.totalToolTokens data.tools)
}}
</span>
</div>
- <div class="ai-persona-editor__tool-context-cost-bar">
+ <div class="ai-agent-editor__tool-context-cost-bar">
<div
- class="ai-persona-editor__tool-context-cost-bar-fill"
+ class="ai-agent-editor__tool-context-cost-bar-fill"
style={{this.toolTokenBarStyle data.tools}}
>
<span
- class="ai-persona-editor__tool-context-cost-bar-indicator"
+ class="ai-agent-editor__tool-context-cost-bar-indicator"
></span>
</div>
</div>
{{#if (eq (this.toolTokenSeverity data.tools) "medium")}}
- <div class="ai-persona-editor__tool-context-cost-warning">
+ <div class="ai-agent-editor__tool-context-cost-warning">
<strong>{{i18n
- "discourse_ai.ai_persona.tool_severity_medium"
+ "discourse_ai.ai_agent.tool_severity_medium"
}}:</strong>
- {{i18n "discourse_ai.ai_persona.tool_tokens_warning"}}
+ {{i18n "discourse_ai.ai_agent.tool_tokens_warning"}}
</div>
{{/if}}
{{#if (eq (this.toolTokenSeverity data.tools) "high")}}
- <div class="ai-persona-editor__tool-context-cost-warning">
+ <div class="ai-agent-editor__tool-context-cost-warning">
{{#if (this.tooManyTools data.tools)}}
<strong>{{i18n
- "discourse_ai.ai_persona.tool_severity_too_many"
+ "discourse_ai.ai_agent.tool_severity_too_many"
}}:</strong>
- {{i18n "discourse_ai.ai_persona.tool_count_warning"}}
+ {{i18n "discourse_ai.ai_agent.tool_count_warning"}}
{{else}}
<strong>{{i18n
- "discourse_ai.ai_persona.tool_severity_high"
+ "discourse_ai.ai_agent.tool_severity_high"
}}:</strong>
- {{i18n "discourse_ai.ai_persona.tool_tokens_warning"}}
+ {{i18n "discourse_ai.ai_agent.tool_tokens_warning"}}
{{/if}}
</div>
{{/if}}
@@ -639,7 +639,7 @@ export default class PersonaEditor extends Component {
{{#if (gt data.tools.length 0)}}
<form.Field
@name="forcedTools"
- @title={{i18n "discourse_ai.ai_persona.forced_tools"}}
+ @title={{i18n "discourse_ai.ai_agent.forced_tools"}}
@format="large"
as |field|
>
@@ -657,7 +657,7 @@ export default class PersonaEditor extends Component {
{{#if (gt data.forcedTools.length 0)}}
<form.Field
@name="forced_tool_count"
- @title={{i18n "discourse_ai.ai_persona.forced_tool_strategy"}}
+ @title={{i18n "discourse_ai.ai_agent.forced_tool_strategy"}}
@format="large"
as |field|
>
@@ -671,8 +671,8 @@ export default class PersonaEditor extends Component {
<form.Field
@name="execution_mode"
- @title={{i18n "discourse_ai.ai_persona.execution_mode"}}
- @tooltip={{i18n "discourse_ai.ai_persona.execution_mode_help"}}
+ @title={{i18n "discourse_ai.ai_agent.execution_mode"}}
+ @tooltip={{i18n "discourse_ai.ai_agent.execution_mode_help"}}
@format="large"
@onSet={{this.onExecutionModeChange}}
as |field|
@@ -687,8 +687,8 @@ export default class PersonaEditor extends Component {
{{#if (eq data.execution_mode "agentic")}}
<form.Field
@name="max_turn_tokens"
- @title={{i18n "discourse_ai.ai_persona.max_turn_tokens"}}
- @tooltip={{i18n "discourse_ai.ai_persona.max_turn_tokens_help"}}
+ @title={{i18n "discourse_ai.ai_agent.max_turn_tokens"}}
+ @tooltip={{i18n "discourse_ai.ai_agent.max_turn_tokens_help"}}
@format="large"
as |field|
>
@@ -697,9 +697,9 @@ export default class PersonaEditor extends Component {
<form.Field
@name="compression_threshold"
- @title={{i18n "discourse_ai.ai_persona.compression_threshold"}}
+ @title={{i18n "discourse_ai.ai_agent.compression_threshold"}}
@tooltip={{i18n
- "discourse_ai.ai_persona.compression_threshold_help"
+ "discourse_ai.ai_agent.compression_threshold_help"
}}
@format="large"
as |field|
@@ -711,8 +711,8 @@ export default class PersonaEditor extends Component {
{{#unless (eq data.execution_mode "agentic")}}
<form.Field
@name="max_context_posts"
- @title={{i18n "discourse_ai.ai_persona.max_context_posts"}}
- @tooltip={{i18n "discourse_ai.ai_persona.max_context_posts_help"}}
+ @title={{i18n "discourse_ai.ai_agent.max_context_posts"}}
+ @tooltip={{i18n "discourse_ai.ai_agent.max_context_posts_help"}}
@format="large"
as |field|
>
@@ -721,18 +721,18 @@ export default class PersonaEditor extends Component {
{{/unless}}
{{#if (gt data.tools.length 0)}}
- <AiPersonaToolOptions
+ <AiAgentToolOptions
@form={{form}}
@data={{data}}
- @llms={{@personas.resultSetMeta.llms}}
- @allTools={{@personas.resultSetMeta.tools}}
+ @llms={{@agents.resultSetMeta.llms}}
+ @allTools={{@agents.resultSetMeta.tools}}
/>
{{/if}}
<form.Field
@name="show_thinking"
- @title={{i18n "discourse_ai.ai_persona.show_thinking"}}
- @tooltip={{i18n "discourse_ai.ai_persona.show_thinking_help"}}
+ @title={{i18n "discourse_ai.ai_agent.show_thinking"}}
+ @tooltip={{i18n "discourse_ai.ai_agent.show_thinking_help"}}
@format="large"
as |field|
>
@@ -751,10 +751,10 @@ export default class PersonaEditor extends Component {
<field.Custom>
<RagUploader
@target={{data}}
- @targetName="AiPersona"
+ @targetName="AiAgent"
@updateUploads={{fn this.updateUploads form}}
@onRemove={{fn this.removeUpload form data field.value}}
- @allowImages={{@personas.resultSetMeta.settings.rag_images_enabled}}
+ @allowImages={{@agents.resultSetMeta.settings.rag_images_enabled}}
/>
</field.Custom>
</form.Field>
@@ -762,16 +762,14 @@ export default class PersonaEditor extends Component {
<RagOptionsFk
@form={{form}}
@data={{data}}
- @llms={{@personas.resultSetMeta.llms}}
- @allowImages={{@personas.resultSetMeta.settings.rag_images_enabled}}
+ @llms={{@agents.resultSetMeta.llms}}
+ @allowImages={{@agents.resultSetMeta.settings.rag_images_enabled}}
>
<form.Field
@name="rag_conversation_chunks"
- @title={{i18n
- "discourse_ai.ai_persona.rag_conversation_chunks"
- }}
+ @title={{i18n "discourse_ai.ai_agent.rag_conversation_chunks"}}
@tooltip={{i18n
- "discourse_ai.ai_persona.rag_conversation_chunks_help"
+ "discourse_ai.ai_agent.rag_conversation_chunks_help"
}}
@format="large"
as |field|
@@ -782,10 +780,10 @@ export default class PersonaEditor extends Component {
<form.Field
@name="question_consolidator_llm_id"
@title={{i18n
- "discourse_ai.ai_persona.question_consolidator_llm"
+ "discourse_ai.ai_agent.question_consolidator_llm"
}}
@tooltip={{i18n
- "discourse_ai.ai_persona.question_consolidator_llm_help"
+ "discourse_ai.ai_agent.question_consolidator_llm_help"
}}
@format="large"
as |field|
@@ -793,9 +791,9 @@ export default class PersonaEditor extends Component {
<field.Custom>
<AiLlmSelector
@value={{field.value}}
- @llms={{@personas.resultSetMeta.llms}}
+ @llms={{@agents.resultSetMeta.llms}}
@onChange={{field.set}}
- class="ai-persona-editor__llms"
+ class="ai-agent-editor__llms"
/>
</field.Custom>
</form.Field>
@@ -803,10 +801,10 @@ export default class PersonaEditor extends Component {
</form.Section>
{{/if}}
- <form.Section @title={{i18n "discourse_ai.ai_persona.ai_bot.title"}}>
+ <form.Section @title={{i18n "discourse_ai.ai_agent.ai_bot.title"}}>
<form.Field
@name="enabled"
- @title={{i18n "discourse_ai.ai_persona.enabled"}}
+ @title={{i18n "discourse_ai.ai_agent.enabled"}}
@onSet={{fn this.toggleEnabled data}}
as |field|
>
@@ -815,21 +813,21 @@ export default class PersonaEditor extends Component {
<form.Field
@name="priority"
- @title={{i18n "discourse_ai.ai_persona.priority"}}
+ @title={{i18n "discourse_ai.ai_agent.priority"}}
@onSet={{fn this.togglePriority data}}
- @tooltip={{i18n "discourse_ai.ai_persona.priority_help"}}
+ @tooltip={{i18n "discourse_ai.ai_agent.priority_help"}}
as |field|
>
<field.Toggle />
</form.Field>
{{#if @model.isNew}}
- <div>{{i18n "discourse_ai.ai_persona.ai_bot.save_first"}}</div>
+ <div>{{i18n "discourse_ai.ai_agent.ai_bot.save_first"}}</div>
{{else}}
{{#if data.default_llm_id}}
<form.Field
@name="force_default_llm"
- @title={{i18n "discourse_ai.ai_persona.force_default_llm"}}
+ @title={{i18n "discourse_ai.ai_agent.force_default_llm"}}
@format="large"
as |field|
>
@@ -838,12 +836,12 @@ export default class PersonaEditor extends Component {
{{/if}}
<form.Container
- @title={{i18n "discourse_ai.ai_persona.user"}}
+ @title={{i18n "discourse_ai.ai_agent.user"}}
@tooltip={{unless
data.user
- (i18n "discourse_ai.ai_persona.create_user_help")
+ (i18n "discourse_ai.ai_agent.create_user_help")
}}
- class="ai-persona-editor__ai_bot_user"
+ class="ai-agent-editor__ai_bot_user"
>
{{#if data.user}}
<a
@@ -859,8 +857,8 @@ export default class PersonaEditor extends Component {
{{else}}
<form.Button
@action={{fn this.createUser form}}
- @label="discourse_ai.ai_persona.create_user"
- class="ai-persona-editor__create-user"
+ @label="discourse_ai.ai_agent.create_user"
+ class="ai-agent-editor__create-user"
/>
{{/if}}
</form.Container>
@@ -868,11 +866,9 @@ export default class PersonaEditor extends Component {
{{#if data.user}}
<form.Field
@name="allow_personal_messages"
- @title={{i18n
- "discourse_ai.ai_persona.allow_personal_messages"
- }}
+ @title={{i18n "discourse_ai.ai_agent.allow_personal_messages"}}
@tooltip={{i18n
- "discourse_ai.ai_persona.allow_personal_messages_help"
+ "discourse_ai.ai_agent.allow_personal_messages_help"
}}
@format="large"
as |field|
@@ -882,9 +878,9 @@ export default class PersonaEditor extends Component {
<form.Field
@name="allow_topic_mentions"
- @title={{i18n "discourse_ai.ai_persona.allow_topic_mentions"}}
+ @title={{i18n "discourse_ai.ai_agent.allow_topic_mentions"}}
@tooltip={{i18n
- "discourse_ai.ai_persona.allow_topic_mentions_help"
+ "discourse_ai.ai_agent.allow_topic_mentions_help"
}}
@format="large"
as |field|
@@ -896,10 +892,10 @@ export default class PersonaEditor extends Component {
<form.Field
@name="allow_chat_direct_messages"
@title={{i18n
- "discourse_ai.ai_persona.allow_chat_direct_messages"
+ "discourse_ai.ai_agent.allow_chat_direct_messages"
}}
@tooltip={{i18n
- "discourse_ai.ai_persona.allow_chat_direct_messages_help"
+ "discourse_ai.ai_agent.allow_chat_direct_messages_help"
}}
@format="large"
as |field|
@@ -910,10 +906,10 @@ export default class PersonaEditor extends Component {
<form.Field
@name="allow_chat_channel_mentions"
@title={{i18n
- "discourse_ai.ai_persona.allow_chat_channel_mentions"
+ "discourse_ai.ai_agent.allow_chat_channel_mentions"
}}
@tooltip={{i18n
- "discourse_ai.ai_persona.allow_chat_channel_mentions_help"
+ "discourse_ai.ai_agent.allow_chat_channel_mentions_help"
}}
@format="large"
as |field|
@@ -930,13 +926,13 @@ export default class PersonaEditor extends Component {
{{#unless (or @model.isNew @model.system)}}
<form.Button
- @label="discourse_ai.ai_persona.export"
- @action={{this.exportPersona}}
- class="ai-persona-editor__export"
+ @label="discourse_ai.ai_agent.export"
+ @action={{this.exportAgent}}
+ class="ai-agent-editor__export"
/>
<form.Button
@action={{this.delete}}
- @label="discourse_ai.ai_persona.delete"
+ @label="discourse_ai.ai_agent.delete"
class="btn-danger"
/>
{{/unless}}
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-persona-list-editor.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-agent-list-editor.gjs
similarity index 62%
rename from plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-persona-list-editor.gjs
rename to plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-agent-list-editor.gjs
index 400651d927f..cda3918f665 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-persona-list-editor.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-agent-list-editor.gjs
@@ -19,8 +19,8 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
import { removeValueFromArray } from "discourse/lib/array-tools";
import { gt } from "discourse/truth-helpers";
import { i18n } from "discourse-i18n";
-import AiPersona from "../admin/models/ai-persona";
-import AiPersonaEditor from "./ai-persona-editor";
+import AiAgent from "../admin/models/ai-agent";
+import AiAgentEditor from "./ai-agent-editor";
const LAYOUT_BUTTONS = [
{
@@ -35,7 +35,7 @@ const LAYOUT_BUTTONS = [
},
];
-export default class AiPersonaListEditor extends Component {
+export default class AiAgentListEditor extends Component {
@service adminPluginNavManager;
@service keyValueStore;
@service capabilities;
@@ -45,7 +45,7 @@ export default class AiPersonaListEditor extends Component {
constructor() {
super(...arguments);
- const savedLayoutId = this.keyValueStore.get("ai-persona-list-layout");
+ const savedLayoutId = this.keyValueStore.get("ai-agent-list-layout");
if (savedLayoutId) {
const found = LAYOUT_BUTTONS.find((b) => b.id === savedLayoutId);
if (found) {
@@ -60,8 +60,8 @@ export default class AiPersonaListEditor extends Component {
get dropdownOptions() {
let features = [];
- (this.args.personas?.content || []).forEach((persona) => {
- (persona.features || []).forEach((feature) => {
+ (this.args.agents?.content || []).forEach((agent) => {
+ (agent.features || []).forEach((feature) => {
if (feature?.module_name && !features.includes(feature.module_name)) {
features.push(feature.module_name);
}
@@ -71,14 +71,14 @@ export default class AiPersonaListEditor extends Component {
return [
{
value: "all",
- label: i18n("discourse_ai.ai_persona.filters.all_features"),
+ label: i18n("discourse_ai.ai_agent.filters.all_features"),
filterFn: () => true,
},
...features.map((name) => ({
value: name,
label: i18n(`discourse_ai.features.${name}.name`),
- filterFn: (persona) =>
- (persona.features || []).some(
+ filterFn: (agent) =>
+ (agent.features || []).some(
(feature) => feature.module_name === name
),
})),
@@ -86,15 +86,15 @@ export default class AiPersonaListEditor extends Component {
}
@action
- async toggleEnabled(persona) {
- const oldValue = persona.enabled;
+ async toggleEnabled(agent) {
+ const oldValue = agent.enabled;
const newValue = !oldValue;
try {
- persona.set("enabled", newValue);
- await persona.save();
+ agent.set("enabled", newValue);
+ await agent.save();
} catch (err) {
- persona.set("enabled", oldValue);
+ agent.set("enabled", oldValue);
popupAjaxError(err);
}
}
@@ -110,7 +110,7 @@ export default class AiPersonaListEditor extends Component {
if (found) {
this.currentLayout = found;
this.keyValueStore.set({
- key: "ai-persona-list-layout",
+ key: "ai-agent-list-layout",
value: layoutId,
});
}
@@ -118,7 +118,7 @@ export default class AiPersonaListEditor extends Component {
}
@action
- importPersona() {
+ importAgent() {
const fileInput = document.createElement("input");
fileInput.type = "file";
fileInput.accept = ".json";
@@ -140,19 +140,17 @@ export default class AiPersonaListEditor extends Component {
reader.onload = (e) => {
try {
const json = JSON.parse(e.target.result);
- this.uploadPersona(json);
+ this.uploadAgent(json);
} catch {
- this.dialog.alert(
- i18n("discourse_ai.ai_persona.import_error_not_json")
- );
+ this.dialog.alert(i18n("discourse_ai.ai_agent.import_error_not_json"));
}
};
reader.readAsText(file);
}
- uploadPersona(personaData, force = false) {
- let url = `/admin/plugins/discourse-ai/ai-personas/import.json`;
- const payload = personaData;
+ uploadAgent(agentData, force = false) {
+ let url = `/admin/plugins/discourse-ai/ai-agents/import.json`;
+ const payload = agentData;
if (force) {
payload.force = true;
}
@@ -163,26 +161,27 @@ export default class AiPersonaListEditor extends Component {
contentType: "application/json",
})
.then((result) => {
- let persona = AiPersona.create(result);
- let existingPersona = this.args.personas.content.find(
- (item) => item.id === persona.id
+ const agentPayload = result.ai_agent || result;
+ let agent = AiAgent.create(agentPayload);
+ let existingAgent = this.args.agents.content.find(
+ (item) => item.id === agent.id
);
- if (existingPersona) {
- removeValueFromArray(this.args.personas.content, existingPersona);
+ if (existingAgent) {
+ removeValueFromArray(this.args.agents.content, existingAgent);
}
- this.args.personas.content.unshift(persona);
+ this.args.agents.content.unshift(agent);
})
.catch((error) => {
if (error.jqXHR?.status === 422) {
this.dialog.confirm({
message:
- i18n("discourse_ai.ai_persona.import_error_conflict", {
- name: personaData.persona.name,
+ i18n("discourse_ai.ai_agent.import_error_conflict", {
+ name: agentData.agent?.name ?? agentData.persona?.name,
}) +
"\n" +
error.jqXHR.responseJSON?.errors?.join("\n"),
- confirmButtonLabel: "discourse_ai.ai_persona.overwrite",
- didConfirm: () => this.uploadPersona(personaData, true),
+ confirmButtonLabel: "discourse_ai.ai_agent.overwrite",
+ didConfirm: () => this.uploadAgent(agentData, true),
});
} else {
popupAjaxError(error);
@@ -192,43 +191,41 @@ export default class AiPersonaListEditor extends Component {
<template>
<DBreadcrumbsItem
- @path="/admin/plugins/{{this.adminPluginNavManager.currentPlugin.name}}/ai-personas"
- @label={{i18n "discourse_ai.ai_persona.short_title"}}
+ @path="/admin/plugins/{{this.adminPluginNavManager.currentPlugin.name}}/ai-agents"
+ @label={{i18n "discourse_ai.ai_agent.short_title"}}
/>
- <section class="ai-persona-list-editor__current admin-detail">
- {{#if @currentPersona}}
- <AiPersonaEditor @model={{@currentPersona}} @personas={{@personas}} />
+ <section class="ai-agent-list-editor__current admin-detail">
+ {{#if @currentAgent}}
+ <AiAgentEditor @model={{@currentAgent}} @agents={{@agents}} />
{{else}}
<DPageSubheader
- @titleLabel={{i18n "discourse_ai.ai_persona.short_title"}}
- @descriptionLabel={{i18n
- "discourse_ai.ai_persona.persona_description"
- }}
- @learnMoreUrl="https://meta.discourse.org/t/ai-bot-personas/306099"
+ @titleLabel={{i18n "discourse_ai.ai_agent.short_title"}}
+ @descriptionLabel={{i18n "discourse_ai.ai_agent.agent_description"}}
+ @learnMoreUrl="https://meta.discourse.org/t/ai-bot-agents/306099"
>
<:actions as |actions|>
<actions.Default
- @label="discourse_ai.ai_persona.import"
- @action={{this.importPersona}}
+ @label="discourse_ai.ai_agent.import"
+ @action={{this.importAgent}}
@icon="upload"
- class="ai-persona-list-editor__import-button"
+ class="ai-agent-list-editor__import-button"
/>
<actions.Primary
- @label="discourse_ai.ai_persona.new"
- @route="adminPlugins.show.discourse-ai-personas.new"
+ @label="discourse_ai.ai_agent.new"
+ @route="adminPlugins.show.discourse-ai-agents.new"
@icon="plus"
- class="ai-persona-list-editor__new-button"
+ class="ai-agent-list-editor__new-button"
/>
</:actions>
</DPageSubheader>
- {{#if @personas.content}}
+ {{#if @agents.content}}
<AdminFilterControls
- @array={{@personas.content}}
+ @array={{@agents.content}}
@searchableProps={{this.searchableProps}}
@dropdownOptions={{this.dropdownOptions}}
- @inputPlaceholder={{i18n "discourse_ai.ai_persona.filters.text"}}
+ @inputPlaceholder={{i18n "discourse_ai.ai_agent.filters.text"}}
@noResultsMessage={{i18n
- "discourse_ai.ai_persona.filters.no_results"
+ "discourse_ai.ai_agent.filters.no_results"
}}
>
<:actions>
@@ -236,7 +233,7 @@ export default class AiPersonaListEditor extends Component {
<DMenu
@modalForMobile={{true}}
@autofocus={{true}}
- @identifier="persona-list-layout"
+ @identifier="agent-list-layout"
@onRegisterApi={{this.onRegisterApi}}
@triggerClass="btn-default btn-icon"
>
@@ -260,69 +257,69 @@ export default class AiPersonaListEditor extends Component {
</DMenu>
{{/if}}
</:actions>
- <:content as |filteredPersonas|>
+ <:content as |filteredAgents|>
<table
class={{concatClass
- "content-list ai-persona-list-editor d-table"
+ "content-list ai-agent-list-editor d-table"
(concat "--layout-" this.currentLayout.id)
}}
>
<thead class="d-table__header">
<tr>
- <th>{{i18n "discourse_ai.ai_persona.name"}}</th>
+ <th>{{i18n "discourse_ai.ai_agent.name"}}</th>
<th>{{i18n "discourse_ai.llms.short_title"}}</th>
<th>{{i18n "discourse_ai.features.short_title"}}</th>
</tr>
</thead>
<tbody>
- {{#each filteredPersonas as |persona|}}
+ {{#each filteredAgents as |agent|}}
<tr
- data-persona-id={{persona.id}}
+ data-agent-id={{agent.id}}
class={{concatClass
- "ai-persona-list__row d-table__row"
- (if persona.priority "--priority")
- (if persona.enabled "--enabled")
+ "ai-agent-list__row d-table__row"
+ (if agent.priority "--priority")
+ (if agent.enabled "--enabled")
}}
>
<td class="d-table__cell --overview">
- <div class="ai-persona-list__name-with-description">
- <h3 class="ai-persona-list__name">
- {{#if persona.user}}
- {{avatar persona.user imageSize="tiny"}}
+ <div class="ai-agent-list__name-with-description">
+ <h3 class="ai-agent-list__name">
+ {{#if agent.user}}
+ {{avatar agent.user imageSize="tiny"}}
{{/if}}
- {{persona.name}}
+ {{agent.name}}
</h3>
- <div class="ai-persona-list__description">
- {{persona.description}}
+ <div class="ai-agent-list__description">
+ {{agent.description}}
</div>
</div>
</td>
- <td class="ai-persona-list__llms">
- {{#if persona.default_llm}}
+ <td class="ai-agent-list__llms">
+ {{#if agent.default_llm}}
<span class="--card-label">
- {{i18n "discourse_ai.ai_persona.llms_list"}}
+ {{i18n "discourse_ai.ai_agent.llms_list"}}
</span>
<DButton
- class="btn-flat btn-small ai-persona-list__row-item-feature"
- @translatedLabel={{persona.default_llm.display_name}}
+ class="btn-flat btn-small ai-agent-list__row-item-feature"
+ @translatedLabel={{agent.default_llm.display_name}}
@route="adminPlugins.show.discourse-ai-llms.edit"
- @routeModels={{persona.default_llm.id}}
+ @routeModels={{agent.default_llm.id}}
/>
{{/if}}
</td>
- <td class="ai-persona-list__features">
- {{#if persona.features.length}}
+ <td class="ai-agent-list__features">
+ {{#if agent.features.length}}
<span class="--card-label">
{{i18n
- "discourse_ai.ai_persona.features_list"
- count=persona.features.length
+ "discourse_ai.ai_agent.features_list"
+ count=agent.features.length
}}
</span>
- {{#each persona.features as |feature index|}}
- <span class="ai-persona-list__feature-list">
+ {{#each agent.features as |feature index|}}
+ <span class="ai-agent-list__feature-list">
{{#if (gt index 0)}}, {{/if}}
<DButton
- class="btn-flat btn-small ai-persona-list__row-item-feature"
+ class="btn-flat btn-small ai-agent-list__row-item-feature"
@translatedLabel={{i18n
(concat
"discourse_ai.features."
@@ -339,10 +336,10 @@ export default class AiPersonaListEditor extends Component {
</td>
<td class="d-table__cell --controls">
<LinkTo
- @route="adminPlugins.show.discourse-ai-personas.edit"
- @model={{persona}}
+ @route="adminPlugins.show.discourse-ai-agents.edit"
+ @model={{agent}}
class="btn btn-default btn-text btn-small"
- >{{i18n "discourse_ai.ai_persona.edit"}} </LinkTo>
+ >{{i18n "discourse_ai.ai_agent.edit"}} </LinkTo>
</td>
</tr>
{{/each}}
@@ -352,10 +349,10 @@ export default class AiPersonaListEditor extends Component {
</AdminFilterControls>
{{else}}
<AdminConfigAreaEmptyList
- @ctaLabel="discourse_ai.ai_persona.new"
- @ctaRoute="adminPlugins.show.discourse-ai-personas.new"
- @ctaClass="ai-persona-list-editor__empty-new-button"
- @emptyLabel="discourse_ai.ai_persona.no_personas"
+ @ctaLabel="discourse_ai.ai_agent.new"
+ @ctaRoute="adminPlugins.show.discourse-ai-agents.new"
+ @ctaClass="ai-agent-list-editor__empty-new-button"
+ @emptyLabel="discourse_ai.ai_agent.no_agents"
/>
{{/if}}
{{/if}}
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-features.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-features.gjs
index 8c762fc0d5c..21ef0b70891 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-features.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-features.gjs
@@ -75,21 +75,21 @@ export default class AiFeatures extends Component {
return true;
}
- const personaMatches = feature.personas?.some((persona) =>
- persona.name?.toLowerCase().includes(term)
+ const agentMatches = feature.agents?.some((agent) =>
+ agent.name?.toLowerCase().includes(term)
);
const llmMatches = feature.llm_models?.some((llm) =>
llm.name?.toLowerCase().includes(term)
);
- const groupMatches = feature.personas?.some((persona) =>
- persona.allowed_groups?.some((group) =>
+ const groupMatches = feature.agents?.some((agent) =>
+ agent.allowed_groups?.some((group) =>
group.name?.toLowerCase().includes(term)
)
);
- return personaMatches || llmMatches || groupMatches;
+ return agentMatches || llmMatches || groupMatches;
} catch (error) {
// eslint-disable-next-line no-console
console.error(`Error filtering features`, error);
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llm-editor-form.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llm-editor-form.gjs
index 3f3fbcf0493..27a69afc3b0 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llm-editor-form.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llm-editor-form.gjs
@@ -144,7 +144,7 @@ export default class AiLlmEditorForm extends Component {
const localized = usedBy.map((m) => {
return i18n(`discourse_ai.llms.usage.${m.type}`, {
- persona: m.name,
+ agent: m.name,
});
});
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llms-list-editor.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llms-list-editor.gjs
index 90c8d412a9b..cb757f63691 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llms-list-editor.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llms-list-editor.gjs
@@ -128,7 +128,7 @@ export default class AiLlmsListEditor extends Component {
localizeUsage(usage) {
return i18n(`discourse_ai.llms.usage.${usage.type}`, {
- persona: usage.name,
+ agent: usage.name,
});
}
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-spam.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-spam.gjs
index b5677abb0a2..6cc378f0ddc 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-spam.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-spam.gjs
@@ -35,7 +35,7 @@ export default class AiSpam extends Component {
};
@tracked isEnabled = false;
@tracked selectedLLM = null;
- @tracked selectedPersonaId = null;
+ @tracked selectedAgentId = null;
@tracked customInstructions = "";
@autoTrackedArray errors;
@@ -99,13 +99,17 @@ export default class AiSpam extends Component {
}
this.customInstructions = model.custom_instructions;
this.stats = model.stats;
- this.selectedPersonaId = model.ai_persona_id;
+ this.selectedAgentId = model.ai_agent_id;
}
get availableLLMs() {
return this.args.model?.available_llms || [];
}
+ get availableAgents() {
+ return this.args.model?.available_agents || [];
+ }
+
@action
async toggleEnabled() {
this.isEnabled = !this.isEnabled;
@@ -136,8 +140,8 @@ export default class AiSpam extends Component {
}
@action
- async updatePersona(value) {
- this.selectedPersonaId = value;
+ async updateAgent(value) {
+ this.selectedAgentId = value;
}
@action
@@ -148,7 +152,7 @@ export default class AiSpam extends Component {
data: {
llm_model_id: this.llmId,
custom_instructions: this.customInstructions,
- ai_persona_id: this.selectedPersonaId,
+ ai_agent_id: this.selectedAgentId,
},
});
this.toasts.success({
@@ -264,15 +268,15 @@ export default class AiSpam extends Component {
{{/if}}
</div>
- <div class="ai-spam__persona">
- <label class="ai-spam__persona-label">{{i18n
- "discourse_ai.spam.select_persona"
+ <div class="ai-spam__agent">
+ <label class="ai-spam__agent-label">{{i18n
+ "discourse_ai.spam.select_agent"
}}</label>
<ComboBox
- @value={{this.selectedPersonaId}}
- @content={{@model.available_personas}}
- @onChange={{this.updatePersona}}
- class="ai-spam__persona-selector"
+ @value={{this.selectedAgentId}}
+ @content={{this.availableAgents}}
+ @onChange={{this.updateAgent}}
+ class="ai-spam__agent-selector"
/>
</div>
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents-legacy.js b/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents-legacy.js
new file mode 100644
index 00000000000..b6000b18916
--- /dev/null
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents-legacy.js
@@ -0,0 +1,12 @@
+import DiscourseRoute from "discourse/routes/discourse";
+
+export default class AdminPluginsShowDiscourseAiAgentsLegacy extends DiscourseRoute {
+ beforeModel(transition) {
+ const url = transition.intent?.url?.replace("ai-personas", "ai-agents");
+ if (url) {
+ this.replaceWith(url);
+ } else {
+ this.replaceWith("adminPlugins.show.discourse-ai-agents");
+ }
+ }
+}
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents.js b/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents.js
new file mode 100644
index 00000000000..5e19108ffa8
--- /dev/null
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents.js
@@ -0,0 +1,7 @@
+import DiscourseRoute from "discourse/routes/discourse";
+
+export default class DiscourseAiAiAgentsRoute extends DiscourseRoute {
+ model() {
+ return this.store.findAll("ai-agent");
+ }
+}
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents/edit.js b/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents/edit.js
new file mode 100644
index 00000000000..a47cc306ca7
--- /dev/null
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents/edit.js
@@ -0,0 +1,17 @@
+import DiscourseRoute from "discourse/routes/discourse";
+
+export default class AdminPluginsShowDiscourseAiAgentsEdit extends DiscourseRoute {
+ async model(params) {
+ const allAgents = this.modelFor("adminPlugins.show.discourse-ai-agents");
+ const id = parseInt(params.id, 10);
+ return allAgents.content.find((item) => item.id === id);
+ }
+
+ setupController(controller, model) {
+ super.setupController(controller, model);
+ controller.set(
+ "allAgents",
+ this.modelFor("adminPlugins.show.discourse-ai-agents")
+ );
+ }
+}
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-personas/new.js b/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents/new.js
similarity index 74%
rename from plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-personas/new.js
rename to plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents/new.js
index fed786d621d..f3b1d22309a 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-personas/new.js
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-agents/new.js
@@ -1,9 +1,9 @@
import { AUTO_GROUPS } from "discourse/lib/constants";
import DiscourseRoute from "discourse/routes/discourse";
-export default class AdminPluginsShowDiscourseAiPersonasNew extends DiscourseRoute {
+export default class AdminPluginsShowDiscourseAiAgentsNew extends DiscourseRoute {
async model() {
- const record = this.store.createRecord("ai-persona");
+ const record = this.store.createRecord("ai-agent");
record.set("allowed_group_ids", [AUTO_GROUPS.trust_level_0.id]);
record.set("rag_uploads", []);
// these match the defaults on the table
@@ -18,8 +18,8 @@ export default class AdminPluginsShowDiscourseAiPersonasNew extends DiscourseRou
setupController(controller, model) {
super.setupController(controller, model);
controller.set(
- "allPersonas",
- this.modelFor("adminPlugins.show.discourse-ai-personas")
+ "allAgents",
+ this.modelFor("adminPlugins.show.discourse-ai-agents")
);
}
}
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-personas.js b/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-personas.js
deleted file mode 100644
index 7455e4d5abd..00000000000
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-personas.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import DiscourseRoute from "discourse/routes/discourse";
-
-export default class DiscourseAiAiPersonasRoute extends DiscourseRoute {
- model() {
- return this.store.findAll("ai-persona");
- }
-}
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-personas/edit.js b/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-personas/edit.js
deleted file mode 100644
index 5edbf97aee1..00000000000
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/routes/admin-plugins/show/discourse-ai-personas/edit.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import DiscourseRoute from "discourse/routes/discourse";
-
-export default class AdminPluginsShowDiscourseAiPersonasEdit extends DiscourseRoute {
- async model(params) {
- const allPersonas = this.modelFor(
- "adminPlugins.show.discourse-ai-personas"
- );
- const id = parseInt(params.id, 10);
- return allPersonas.content.find((item) => item.id === id);
- }
-
- setupController(controller, model) {
- super.setupController(controller, model);
- controller.set(
- "allPersonas",
- this.modelFor("adminPlugins.show.discourse-ai-personas")
- );
- }
-}
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-agents/edit.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-agents/edit.gjs
new file mode 100644
index 00000000000..8f5d9b51bfb
--- /dev/null
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-agents/edit.gjs
@@ -0,0 +1,8 @@
+import AiAgentListEditor from "../../../../components/ai-agent-list-editor";
+
+export default <template>
+ <AiAgentListEditor
+ @agents={{@controller.allAgents}}
+ @currentAgent={{@controller.model}}
+ />
+</template>
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-agents/index.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-agents/index.gjs
new file mode 100644
index 00000000000..d84d576b97c
--- /dev/null
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-agents/index.gjs
@@ -0,0 +1,5 @@
+import AiAgentListEditor from "../../../../components/ai-agent-list-editor";
+
+export default <template>
+ <AiAgentListEditor @agents={{@controller.model}} />
+</template>
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-agents/new.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-agents/new.gjs
new file mode 100644
index 00000000000..8f5d9b51bfb
--- /dev/null
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-agents/new.gjs
@@ -0,0 +1,8 @@
+import AiAgentListEditor from "../../../../components/ai-agent-list-editor";
+
+export default <template>
+ <AiAgentListEditor
+ @agents={{@controller.allAgents}}
+ @currentAgent={{@controller.model}}
+ />
+</template>
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-personas/edit.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-personas/edit.gjs
deleted file mode 100644
index 5795d6efd89..00000000000
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-personas/edit.gjs
+++ /dev/null
@@ -1,8 +0,0 @@
-import AiPersonaListEditor from "../../../../components/ai-persona-list-editor";
-
-export default <template>
- <AiPersonaListEditor
- @personas={{@controller.allPersonas}}
- @currentPersona={{@controller.model}}
- />
-</template>
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-personas/index.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-personas/index.gjs
deleted file mode 100644
index 8d15fe72424..00000000000
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-personas/index.gjs
+++ /dev/null
@@ -1,5 +0,0 @@
-import AiPersonaListEditor from "../../../../components/ai-persona-list-editor";
-
-export default <template>
- <AiPersonaListEditor @personas={{@controller.model}} />
-</template>
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-personas/new.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-personas/new.gjs
deleted file mode 100644
index 5795d6efd89..00000000000
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-personas/new.gjs
+++ /dev/null
@@ -1,8 +0,0 @@
-import AiPersonaListEditor from "../../../../components/ai-persona-list-editor";
-
-export default <template>
- <AiPersonaListEditor
- @personas={{@controller.allPersonas}}
- @currentPersona={{@controller.model}}
- />
-</template>
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-tools/edit.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-tools/edit.gjs
index 152c21d72db..57e9c8311bf 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-tools/edit.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-tools/edit.gjs
@@ -1,7 +1,7 @@
import AiToolEditor from "../../../../../discourse/components/ai-tool-editor";
export default <template>
- <section class="ai-persona-tool-editor__current admin-detail pull-left">
+ <section class="ai-agent-tool-editor__current admin-detail pull-left">
<AiToolEditor
@tools={{@controller.allTools}}
@model={{@controller.model}}
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-tools/new.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-tools/new.gjs
index 7c4cf2c761d..ad8bfff5c03 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-tools/new.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-ai-tools/new.gjs
@@ -1,7 +1,7 @@
import AiToolEditor from "../../../../../discourse/components/ai-tool-editor";
export default <template>
- <section class="ai-persona-tool-editor__current admin-detail pull-left">
+ <section class="ai-agent-tool-editor__current admin-detail pull-left">
<AiToolEditor
@tools={{@controller.allTools}}
@model={{@controller.model}}
diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_personas_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_agents_controller.rb
similarity index 75%
rename from plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_personas_controller.rb
rename to plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_agents_controller.rb
index 54ca30a1a7c..86ee6ef8e52 100644
--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_personas_controller.rb
+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_agents_controller.rb
@@ -2,20 +2,20 @@
module DiscourseAi
module Admin
- class AiPersonasController < ::Admin::AdminController
+ class AiAgentsController < ::Admin::AdminController
requires_plugin PLUGIN_NAME
- before_action :find_ai_persona, only: %i[edit update destroy create_user export]
+ before_action :find_ai_agent, only: %i[edit update destroy create_user export]
def index
- ai_personas =
- AiPersona
+ ai_agents =
+ AiAgent
.ordered
.includes(:user, :uploads)
- .map { |persona| LocalizedAiPersonaSerializer.new(persona, root: false) }
+ .map { |agent| LocalizedAiAgentSerializer.new(agent, root: false) }
tools =
- DiscourseAi::Personas::Persona.all_available_tools.map do |tool|
+ DiscourseAi::Agents::Agent.all_available_tools.map do |tool|
AiToolSerializer.new(tool, root: false)
end
@@ -37,10 +37,12 @@ module DiscourseAi
llms = DiscourseAi::Configuration::LlmEnumerator.values_for_serialization
+ sorted_tools = tools.sort_by { |t| t.try(:name) || t[:name] || "" }
+
render json: {
- ai_personas: ai_personas,
+ ai_agents: ai_agents,
meta: {
- tools: tools.sort_by { |t| t.try(:name) || t[:name] || "" },
+ tools: sorted_tools,
llms: llms,
settings: {
rag_images_enabled: SiteSetting.ai_rag_images_enabled,
@@ -53,90 +55,88 @@ module DiscourseAi
end
def edit
- render json: LocalizedAiPersonaSerializer.new(@ai_persona)
+ render_ai_agent_resource(@ai_agent)
end
def create
- ai_persona = AiPersona.new(ai_persona_params.except(:rag_uploads))
- if ai_persona.save
- RagDocumentFragment.link_target_and_uploads(ai_persona, attached_upload_ids)
- log_ai_persona_creation(ai_persona)
+ ai_agent = AiAgent.new(ai_agent_params.except(:rag_uploads))
+ if ai_agent.save
+ RagDocumentFragment.link_target_and_uploads(ai_agent, attached_upload_ids)
+ log_ai_agent_creation(ai_agent)
- render json: {
- ai_persona: LocalizedAiPersonaSerializer.new(ai_persona, root: false),
- },
- status: :created
+ render_ai_agent_resource(ai_agent, status: :created)
else
- render_json_error ai_persona
+ render_json_error ai_agent
end
end
def create_user
- user = @ai_persona.create_user!
+ user = @ai_agent.create_user!
render json: BasicUserSerializer.new(user, root: "user")
end
def update
- initial_attributes = @ai_persona.attributes.dup
+ initial_attributes = @ai_agent.attributes.dup
- if @ai_persona.update(ai_persona_params.except(:rag_uploads))
- RagDocumentFragment.update_target_uploads(@ai_persona, attached_upload_ids)
- log_ai_persona_update(@ai_persona, initial_attributes)
+ if @ai_agent.update(ai_agent_params.except(:rag_uploads))
+ RagDocumentFragment.update_target_uploads(@ai_agent, attached_upload_ids)
+ log_ai_agent_update(@ai_agent, initial_attributes)
- render json: LocalizedAiPersonaSerializer.new(@ai_persona, root: false)
+ render_ai_agent_resource(@ai_agent)
else
- render_json_error @ai_persona
+ render_json_error @ai_agent
end
end
def destroy
- persona_details = {
- persona_id: @ai_persona.id,
- name: @ai_persona.name,
- description: @ai_persona.description,
+ agent_details = {
+ agent_id: @ai_agent.id,
+ name: @ai_agent.name,
+ description: @ai_agent.description,
}
- if @ai_persona.destroy
- log_ai_persona_deletion(persona_details)
+ if @ai_agent.destroy
+ log_ai_agent_deletion(agent_details)
head :no_content
else
- render_json_error @ai_persona
+ render_json_error @ai_agent
end
end
def export
- persona = AiPersona.find(params[:id])
- exporter = DiscourseAi::PersonaExporter.new(persona: persona)
+ agent = AiAgent.find(params[:id])
+ exporter = DiscourseAi::AgentExporter.new(agent: agent)
response.headers[
"Content-Disposition"
- ] = "attachment; filename=\"#{persona.name.parameterize}.json\""
+ ] = "attachment; filename=\"#{agent.name.parameterize}.json\""
render json: exporter.export
end
def import
- name = params.dig(:persona, :name)
- existing_persona = AiPersona.find_by(name: name)
- force_update = params[:force].present? && params[:force].to_s.downcase == "true"
+ name = params.dig(:agent, :name) || params.dig(:persona, :name)
+ existing_agent = AiAgent.find_by(name: name) if name.present?
+ force_update = ActiveModel::Type::Boolean.new.cast(params[:force])
+ import_payload = params.to_unsafe_h.except("controller", "action", "format", "force")
begin
- importer = DiscourseAi::PersonaImporter.new(json: params.to_unsafe_h)
+ importer = DiscourseAi::AgentImporter.new(json: import_payload)
- if existing_persona && force_update
- initial_attributes = existing_persona.attributes.dup
- persona = importer.import!(overwrite: true)
- log_ai_persona_update(persona, initial_attributes)
- render json: LocalizedAiPersonaSerializer.new(persona, root: false)
+ if existing_agent && force_update
+ initial_attributes = existing_agent.attributes.dup
+ agent = importer.import!(overwrite: true)
+ log_ai_agent_update(agent, initial_attributes)
+ render_ai_agent_resource(agent)
else
- persona = importer.import!
- log_ai_persona_creation(persona)
- render json: LocalizedAiPersonaSerializer.new(persona, root: false), status: :created
+ agent = importer.import!
+ log_ai_agent_creation(agent)
+ render_ai_agent_resource(agent, status: :created)
end
- rescue DiscourseAi::PersonaImporter::ImportError => e
+ rescue DiscourseAi::AgentImporter::ImportError => e
render_json_error e.message, status: :unprocessable_entity
rescue StandardError => e
- Rails.logger.error("AI Persona import failed: #{e.message}")
+ Rails.logger.error("AI Agent import failed: #{e.message}")
render_json_error "Import failed: #{e.message}", status: :unprocessable_entity
end
end
@@ -169,7 +169,7 @@ module DiscourseAi
DiscourseAi::AiBot::ResponseHttpStreamer.queue_streamed_reply(
io: io,
- persona: nil,
+ agent: nil,
user: nil,
topic: nil,
query: "",
@@ -181,14 +181,15 @@ module DiscourseAi
return
end
- persona =
- AiPersona.find_by(name: params[:persona_name]) ||
- AiPersona.find_by(id: params[:persona_id])
- return render_json_error(I18n.t("discourse_ai.errors.persona_not_found")) if persona.nil?
+ agent_name = params[:agent_name].presence
+ agent_id = params[:agent_id].presence
+
+ agent = AiAgent.find_by(name: agent_name) || AiAgent.find_by(id: agent_id)
+ return render_json_error(I18n.t("discourse_ai.errors.agent_not_found")) if agent.nil?
- return render_json_error(I18n.t("discourse_ai.errors.persona_disabled")) if !persona.enabled
+ return render_json_error(I18n.t("discourse_ai.errors.agent_disabled")) if !agent.enabled
- if persona.default_llm.blank?
+ if agent.default_llm.blank?
return render_json_error(I18n.t("discourse_ai.errors.no_default_llm"))
end
@@ -196,9 +197,7 @@ module DiscourseAi
return render_json_error(I18n.t("discourse_ai.errors.no_query_specified"))
end
- if !persona.user_id
- return render_json_error(I18n.t("discourse_ai.errors.no_user_for_persona"))
- end
+ return render_json_error(I18n.t("discourse_ai.errors.no_user_for_agent")) if !agent.user_id
if !params[:username] && !params[:user_unique_id]
return render_json_error(I18n.t("discourse_ai.errors.no_user_specified"))
@@ -231,7 +230,7 @@ module DiscourseAi
DiscourseAi::AiBot::ResponseHttpStreamer.queue_streamed_reply(
io: io,
- persona: persona,
+ agent: agent,
user: user,
topic: topic,
query: params[:query].to_s,
@@ -400,17 +399,18 @@ module DiscourseAi
hash.stringify_keys
end
- def find_ai_persona
- @ai_persona = AiPersona.find(params[:id])
+ def find_ai_agent
+ @ai_agent = AiAgent.find(params[:id])
end
def attached_upload_ids
- ai_persona_params[:rag_uploads].to_a.map { |h| h[:id] }
+ ai_agent_params[:rag_uploads].to_a.map { |h| h[:id] }
end
- def ai_persona_params
+ def ai_agent_params
+ payload = ai_agent_payload
permitted =
- params.require(:ai_persona).permit(
+ payload.permit(
:name,
:description,
:enabled,
@@ -442,21 +442,37 @@ module DiscourseAi
rag_uploads: [:id],
)
- if tools = params.dig(:ai_persona, :tools)
+ if tools = payload[:tools]
permitted[:tools] = permit_tools(tools)
end
- if response_format = params.dig(:ai_persona, :response_format)
+ if response_format = payload[:response_format]
permitted[:response_format] = permit_response_format(response_format)
end
- if examples = params.dig(:ai_persona, :examples)
+ if examples = payload[:examples]
permitted[:examples] = permit_examples(examples)
end
permitted
end
+ def ai_agent_payload
+ payload = params[:ai_agent]
+ raise ActionController::ParameterMissing.new(:ai_agent) if payload.blank?
+
+ if payload.is_a?(ActionController::Parameters)
+ payload
+ else
+ ActionController::Parameters.new(payload)
+ end
+ end
+
+ def render_ai_agent_resource(agent, status: :ok)
+ serialized = LocalizedAiAgentSerializer.new(agent, root: false)
+ render json: { ai_agent: serialized }, status: status
+ end
+
def permit_tools(tools)
return [] if !tools.is_a?(Array)
@@ -487,7 +503,7 @@ module DiscourseAi
examples.map { |example_arr| example_arr.take(2).map(&:to_s) }
end
- def ai_persona_logger_fields
+ def ai_agent_logger_fields
{
name: {
},
@@ -550,33 +566,33 @@ module DiscourseAi
}
end
- def log_ai_persona_creation(ai_persona)
+ def log_ai_agent_creation(ai_agent)
logger = DiscourseAi::Utils::AiStaffActionLogger.new(current_user)
- entity_details = { persona_id: ai_persona.id, subject: ai_persona.name }
- entity_details[:tools_count] = (ai_persona.tools || []).size
+ entity_details = { agent_id: ai_agent.id, subject: ai_agent.name }
+ entity_details[:tools_count] = (ai_agent.tools || []).size
- logger.log_creation("persona", ai_persona, ai_persona_logger_fields, entity_details)
+ logger.log_creation("agent", ai_agent, ai_agent_logger_fields, entity_details)
end
- def log_ai_persona_update(ai_persona, initial_attributes)
+ def log_ai_agent_update(ai_agent, initial_attributes)
logger = DiscourseAi::Utils::AiStaffActionLogger.new(current_user)
- entity_details = { persona_id: ai_persona.id, subject: ai_persona.name }
- entity_details[:tools_count] = ai_persona.tools.size if ai_persona.tools.present?
+ entity_details = { agent_id: ai_agent.id, subject: ai_agent.name }
+ entity_details[:tools_count] = ai_agent.tools.size if ai_agent.tools.present?
logger.log_update(
- "persona",
- ai_persona,
+ "agent",
+ ai_agent,
initial_attributes,
- ai_persona_logger_fields,
+ ai_agent_logger_fields,
entity_details,
)
end
- def log_ai_persona_deletion(persona_details)
+ def log_ai_agent_deletion(agent_details)
logger = DiscourseAi::Utils::AiStaffActionLogger.new(current_user)
- persona_details[:subject] = persona_details[:name]
+ agent_details[:subject] = agent_details[:name]
- logger.log_deletion("persona", persona_details)
+ logger.log_deletion("agent", agent_details)
end
end
end
diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_features_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_features_controller.rb
index c6f75f906b3..5419ab4614d 100644
--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_features_controller.rb
+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_features_controller.rb
@@ -37,8 +37,7 @@ module DiscourseAi
def serialize_feature(feature)
{
name: feature.name,
- personas:
- feature.persona_ids.map { |id| serialize_persona(persona_id_obj_hash[id]) }.compact,
+ agents: feature.agent_ids.map { |id| serialize_agent(agent_id_obj_hash[id]) }.compact,
llm_models:
feature.llm_models.map do |llm_model|
{ id: llm_model.id, name: llm_model.display_name }
@@ -47,19 +46,19 @@ module DiscourseAi
}
end
- def serialize_persona(persona)
- return nil if persona.blank?
+ def serialize_agent(agent)
+ return nil if agent.blank?
- serialize_data(persona, AiFeaturesPersonaSerializer, root: false)
+ serialize_data(agent, AiFeaturesAgentSerializer, root: false)
end
private
- def persona_id_obj_hash
- @persona_id_obj_hash ||=
+ def agent_id_obj_hash
+ @agent_id_obj_hash ||=
begin
- ids = DiscourseAi::Configuration::Feature.all.map(&:persona_ids).flatten.uniq
- AiPersona.where(id: ids).index_by(&:id)
+ ids = DiscourseAi::Configuration::Feature.all.map(&:agent_ids).flatten.uniq
+ AiAgent.where(id: ids).index_by(&:id)
end
end
end
diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_spam_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_spam_controller.rb
index 089e47b4291..86cad4449f4 100644
--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_spam_controller.rb
+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_spam_controller.rb
@@ -15,27 +15,25 @@ module DiscourseAi
initial_data = {
custom_instructions: initial_settings&.data&.dig("custom_instructions"),
llm_model_id: initial_settings&.llm_model_id,
- ai_persona_id: initial_settings&.ai_persona_id,
+ ai_agent_id: initial_settings&.ai_agent_id,
}
- initial_custom_instructions = initial_settings&.data&.dig("custom_instructions")
- initial_llm_model_id = initial_settings&.llm_model_id
-
updated_params = {}
if allowed_params.key?(:llm_model_id)
- llm_model_id = updated_params[:llm_model_id] = allowed_params[:llm_model_id]
+ updated_params[:llm_model_id] = allowed_params[:llm_model_id]
end
- if allowed_params.key?(:ai_persona_id)
- updated_params[:ai_persona_id] = allowed_params[:ai_persona_id]
- persona = AiPersona.find_by(id: allowed_params[:ai_persona_id])
- if persona.nil? ||
- persona.response_format.to_a.none? { |rf|
+ ai_agent_id = allowed_params[:ai_agent_id]
+ if ai_agent_id.present?
+ updated_params[:ai_agent_id] = ai_agent_id
+ agent = AiAgent.find_by(id: ai_agent_id)
+ if agent.nil? ||
+ agent.response_format.to_a.none? { |rf|
rf["key"] == "spam" && rf["type"] == "boolean"
}
return(
render_json_error(
- I18n.t("discourse_ai.llm.configuration.invalid_persona_response_format"),
+ I18n.t("discourse_ai.llm.configuration.invalid_agent_response_format"),
status: 422,
)
)
@@ -156,14 +154,14 @@ module DiscourseAi
changes_to_log[:custom_instructions] = params[:custom_instructions]
end
- initial_ai_persona_id = initial_data[:ai_persona_id]
- if params.key?(:ai_persona_id) && initial_ai_persona_id.to_s != params[:ai_persona_id].to_s
- old_persona_name =
- AiPersona.find_by(id: initial_ai_persona_id)&.name || initial_ai_persona_id
- new_persona_name =
- AiPersona.find_by(id: params[:ai_persona_id])&.name || params[:ai_persona_id]
+ initial_ai_agent_id = initial_data[:ai_agent_id]
+ updated_ai_agent_id = params[:ai_agent_id]
+ if updated_ai_agent_id.present? && initial_ai_agent_id.to_s != updated_ai_agent_id.to_s
+ old_agent_name = AiAgent.find_by(id: initial_ai_agent_id)&.name || initial_ai_agent_id
+ new_agent_name = AiAgent.find_by(id: updated_ai_agent_id)&.name || updated_ai_agent_id
- changes_to_log[:ai_persona_id] = "#{old_persona_name} → #{new_persona_name}"
+ change_value = "#{old_agent_name} → #{new_agent_name}"
+ changes_to_log[:ai_agent_id] = change_value
end
if changes_to_log.present?
@@ -174,7 +172,7 @@ module DiscourseAi
end
def allowed_params
- params.permit(:is_enabled, :llm_model_id, :custom_instructions, :ai_persona_id)
+ params.permit(:is_enabled, :llm_model_id, :custom_instructions, :ai_agent_id)
end
def spam_config
diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/rag_document_fragments_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/rag_document_fragments_controller.rb
index cf5b744ba3b..8af731f8b75 100644
--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/rag_document_fragments_controller.rb
+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/rag_document_fragments_controller.rb
@@ -6,8 +6,8 @@ module DiscourseAi
requires_plugin PLUGIN_NAME
def indexing_status_check
- if params[:target_type] == "AiPersona"
- @target = AiPersona.find(params[:target_id])
+ if params[:target_type] == "AiAgent"
+ @target = AiAgent.find(params[:target_id])
elsif params[:target_type] == "AiTool"
@target = AiTool.find(params[:target_id])
else
diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/bot_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/bot_controller.rb
index 89a4be94884..c458252b11b 100644
--- a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/bot_controller.rb
+++ b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/bot_controller.rb
@@ -63,13 +63,13 @@ module DiscourseAi
guardian.ensure_can_see!(prompt_post)
- persona_id = retry_persona_id(post, prompt_post)
+ agent_id = retry_agent_id(post, prompt_post)
llm_model_id = post.custom_fields[DiscourseAi::AiBot::POST_AI_LLM_MODEL_ID_FIELD]
args = {
post_id: prompt_post.id,
bot_user_id: post.user_id,
- persona_id: persona_id,
+ agent_id: agent_id,
reply_post_id: post.id,
}
@@ -101,19 +101,18 @@ module DiscourseAi
.first
end
- def retry_persona_id(bot_reply_post, prompt_post)
- persona_id =
- bot_reply_post.custom_fields[DiscourseAi::AiBot::POST_AI_PERSONA_ID_FIELD].presence
+ def retry_agent_id(bot_reply_post, prompt_post)
+ agent_id = bot_reply_post.custom_fields[DiscourseAi::AiBot::POST_AI_AGENT_ID_FIELD].presence
- persona_id ||= prompt_post.topic.custom_fields["ai_persona_id"].presence
+ agent_id ||= prompt_post.topic.custom_fields["ai_agent_id"].presence
- if persona_id.blank?
- persona_name = prompt_post.topic.custom_fields["ai_persona"].presence
- persona_id = AiPersona.find_by(name: persona_name)&.id if persona_name.present?
+ if agent_id.blank?
+ agent_name = prompt_post.topic.custom_fields["ai_agent"].presence
+ agent_id = AiAgent.find_by(name: agent_name)&.id if agent_name.present?
end
- persona_id ||= DiscourseAi::Personas::General.id
- persona_id.to_i
+ agent_id ||= DiscourseAi::Agents::General.id
+ agent_id.to_i
end
end
end
diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/ai_credits_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/ai_credits_controller.rb
index 12e3c7f7cc8..930008e0290 100644
--- a/plugins/discourse-ai/app/controllers/discourse_ai/ai_credits_controller.rb
+++ b/plugins/discourse-ai/app/controllers/discourse_ai/ai_credits_controller.rb
@@ -12,7 +12,7 @@ module DiscourseAi
on_success do
expires_in CREDIT_STATUS_CACHE_TTL, public: false
render json: {
- personas: result[:personas],
+ agents: result[:agents],
features: result[:features],
llm_models: result[:llm_models],
}.compact
@@ -26,7 +26,7 @@ module DiscourseAi
private
def status_params
- params.permit(persona_ids: [], features: [], llm_model_ids: [])
+ params.permit(agent_ids: [], features: [], llm_model_ids: [])
end
end
end
diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/ai_helper/assistant_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/ai_helper/assistant_controller.rb
index b8fdd105280..04cc5dbccc9 100644
--- a/plugins/discourse-ai/app/controllers/discourse_ai/ai_helper/assistant_controller.rb
+++ b/plugins/discourse-ai/app/controllers/discourse_ai/ai_helper/assistant_controller.rb
@@ -120,7 +120,7 @@ module DiscourseAi
if result.failure?
failing_step = nil
failing_step = "contract.default" if result[:"result.contract.default"]&.failure?
- failing_step = "model.persona" if result[:"result.model.persona"]&.failure?
+ failing_step = "model.agent" if result[:"result.model.agent"]&.failure?
failing_step = "policy.has_image_generation_tool" if result[
:"result.policy.has_image_generation_tool"
]&.failure?
@@ -130,7 +130,7 @@ module DiscourseAi
case failing_step
when "contract.default"
422
- when "model.persona"
+ when "model.agent"
404
when "policy.has_image_generation_tool"
422
@@ -144,8 +144,8 @@ module DiscourseAi
case failing_step
when "contract.default"
"discourse_ai.ai_helper.errors.completion_request_failed"
- when "model.persona"
- "discourse_ai.ai_helper.errors.no_illustrator_persona"
+ when "model.agent"
+ "discourse_ai.ai_helper.errors.no_illustrator_agent"
when "policy.has_image_generation_tool"
"discourse_ai.ai_helper.errors.no_image_generation_tool"
when "model.llm_model"
diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/discover/discoveries_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/discover/discoveries_controller.rb
index c71a8d04510..2142663a60a 100644
--- a/plugins/discourse-ai/app/controllers/discourse_ai/discover/discoveries_controller.rb
+++ b/plugins/discourse-ai/app/controllers/discourse_ai/discover/discoveries_controller.rb
@@ -10,8 +10,8 @@ module DiscourseAi
before_action :check_permissions
def reply
- if ai_discover_persona.default_llm_id.blank? && SiteSetting.ai_default_llm_model.blank?
- render_json_error "Discover persona is missing a default LLM model.", status: 503
+ if ai_discover_agent.default_llm_id.blank? && SiteSetting.ai_default_llm_model.blank?
+ render_json_error "Discover agent is missing a default LLM model.", status: 503
return
end
@@ -29,7 +29,7 @@ module DiscourseAi
raise Discourse::InvalidParameters.new("query") if !params[:query]
raise Discourse::InvalidParameters.new("context") if !params[:context]
- bot_user_id = ai_discover_persona.user_id
+ bot_user_id = ai_discover_agent.user_id
bot_username = User.find_by(id: bot_user_id).username
RateLimiter.new(
@@ -65,13 +65,13 @@ module DiscourseAi
private
- def ai_discover_persona
- @discover_persona ||= AiPersona.find_by_id_from_cache(SiteSetting.ai_discover_persona)
+ def ai_discover_agent
+ @discover_agent ||= AiAgent.find_by_id_from_cache(SiteSetting.ai_discover_agent)
end
def check_permissions
- if ai_discover_persona.nil? || current_user.nil? ||
- !current_user.in_any_groups?(ai_discover_persona.allowed_group_ids.to_a)
+ if ai_discover_agent.nil? || current_user.nil? ||
+ !current_user.in_any_groups?(ai_discover_agent.allowed_group_ids.to_a)
raise Discourse::InvalidAccess.new
end
diff --git a/plugins/discourse-ai/app/jobs/regular/create_ai_chat_reply.rb b/plugins/discourse-ai/app/jobs/regular/create_ai_chat_reply.rb
index 05c2d84f747..67178e75c9e 100644
--- a/plugins/discourse-ai/app/jobs/regular/create_ai_chat_reply.rb
+++ b/plugins/discourse-ai/app/jobs/regular/create_ai_chat_reply.rb
@@ -11,12 +11,11 @@ module Jobs
message = ::Chat::Message.find_by(id: args[:message_id])
return if message.blank?
- personaClass =
- DiscourseAi::Personas::Persona.find_by(id: args[:persona_id], user: message.user)
- return if personaClass.blank?
+ agentClass = DiscourseAi::Agents::Agent.find_by(id: args[:agent_id], user: message.user)
+ return if agentClass.blank?
- user = User.find_by(id: personaClass.user_id)
- bot = DiscourseAi::Personas::Bot.as(user, persona: personaClass.new)
+ user = User.find_by(id: agentClass.user_id)
+ bot = DiscourseAi::Agents::Bot.as(user, agent: agentClass.new)
DiscourseAi::AiBot::Playground.new(bot).reply_to_chat_message(
message,
diff --git a/plugins/discourse-ai/app/jobs/regular/create_ai_reply.rb b/plugins/discourse-ai/app/jobs/regular/create_ai_reply.rb
index 98924363d9d..9e317ac5984 100644
--- a/plugins/discourse-ai/app/jobs/regular/create_ai_reply.rb
+++ b/plugins/discourse-ai/app/jobs/regular/create_ai_reply.rb
@@ -10,24 +10,24 @@ module Jobs
reply_post = Post.find_by(id: args[:reply_post_id]) if args[:reply_post_id].present?
return if args[:reply_post_id].present? && reply_post.nil?
return if reply_post && reply_post.topic_id != post.topic_id
- persona_id = args[:persona_id]
+ agent_id = args[:agent_id]
llm_model_id = args[:llm_model_id]
begin
- persona = DiscourseAi::Personas::Persona.find_by(user: post.user, id: persona_id)
- raise DiscourseAi::Personas::Bot::BOT_NOT_FOUND if persona.nil?
+ agent = DiscourseAi::Agents::Agent.find_by(user: post.user, id: agent_id)
+ raise DiscourseAi::Agents::Bot::BOT_NOT_FOUND if agent.nil?
llm_model = LlmModel.find_by(id: llm_model_id.to_i) if !llm_model_id.to_i.zero?
- bot = DiscourseAi::Personas::Bot.as(bot_user, persona: persona.new, model: llm_model)
+ bot = DiscourseAi::Agents::Bot.as(bot_user, agent: agent.new, model: llm_model)
DiscourseAi::AiBot::Playground.new(bot).reply_to(
post,
feature_name: "bot",
existing_reply_post: reply_post,
)
- rescue DiscourseAi::Personas::Bot::BOT_NOT_FOUND
+ rescue DiscourseAi::Agents::Bot::BOT_NOT_FOUND
Rails.logger.warn(
- "Bot not found for post #{post.id} - perhaps persona was deleted or bot was disabled",
+ "Bot not found for post #{post.id} - perhaps agent was deleted or bot was disabled",
)
end
end
diff --git a/plugins/discourse-ai/app/jobs/regular/localize_categories.rb b/plugins/discourse-ai/app/jobs/regular/localize_categories.rb
index ada3f3cd7f2..d411cd45b26 100644
--- a/plugins/discourse-ai/app/jobs/regular/localize_categories.rb
+++ b/plugins/discourse-ai/app/jobs/regular/localize_categories.rb
@@ -20,9 +20,9 @@ module Jobs
return if limit <= 0
short_text_llm_model =
- find_llm_model_for_persona(SiteSetting.ai_translation_short_text_translator_persona)
+ find_llm_model_for_agent(SiteSetting.ai_translation_short_text_translator_agent)
post_raw_llm_model =
- find_llm_model_for_persona(SiteSetting.ai_translation_post_raw_translator_persona)
+ find_llm_model_for_agent(SiteSetting.ai_translation_post_raw_translator_agent)
return if short_text_llm_model.blank? && post_raw_llm_model.blank?
categories =
@@ -70,13 +70,13 @@ module Jobs
private
- def find_llm_model_for_persona(persona_id)
- return nil if persona_id.blank?
+ def find_llm_model_for_agent(agent_id)
+ return nil if agent_id.blank?
- persona_klass = AiPersona.find_by_id_from_cache(persona_id)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(agent_id)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/regular/localize_posts.rb b/plugins/discourse-ai/app/jobs/regular/localize_posts.rb
index 08f31c0cf73..36d98355920 100644
--- a/plugins/discourse-ai/app/jobs/regular/localize_posts.rb
+++ b/plugins/discourse-ai/app/jobs/regular/localize_posts.rb
@@ -18,7 +18,7 @@ module Jobs
return
end
- llm_model = find_llm_model_for_persona(SiteSetting.ai_translation_post_raw_translator_persona)
+ llm_model = find_llm_model_for_agent(SiteSetting.ai_translation_post_raw_translator_agent)
return if llm_model.blank?
locales = DiscourseAi::Translation.locales
@@ -61,13 +61,13 @@ module Jobs
private
- def find_llm_model_for_persona(persona_id)
- return nil if persona_id.blank?
+ def find_llm_model_for_agent(agent_id)
+ return nil if agent_id.blank?
- persona_klass = AiPersona.find_by_id_from_cache(persona_id)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(agent_id)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/regular/localize_tags.rb b/plugins/discourse-ai/app/jobs/regular/localize_tags.rb
index 4d6b7651c6b..32e6c341779 100644
--- a/plugins/discourse-ai/app/jobs/regular/localize_tags.rb
+++ b/plugins/discourse-ai/app/jobs/regular/localize_tags.rb
@@ -20,7 +20,7 @@ module Jobs
return if limit <= 0
short_text_llm_model =
- find_llm_model_for_persona(SiteSetting.ai_translation_short_text_translator_persona)
+ find_llm_model_for_agent(SiteSetting.ai_translation_short_text_translator_agent)
return if short_text_llm_model.blank?
tags =
@@ -62,13 +62,13 @@ module Jobs
private
- def find_llm_model_for_persona(persona_id)
- return nil if persona_id.blank?
+ def find_llm_model_for_agent(agent_id)
+ return nil if agent_id.blank?
- persona_klass = AiPersona.find_by_id_from_cache(persona_id)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(agent_id)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/regular/localize_topics.rb b/plugins/discourse-ai/app/jobs/regular/localize_topics.rb
index 1c271dd61b1..bec97e8fdfa 100644
--- a/plugins/discourse-ai/app/jobs/regular/localize_topics.rb
+++ b/plugins/discourse-ai/app/jobs/regular/localize_topics.rb
@@ -19,9 +19,9 @@ module Jobs
end
topic_title_llm_model =
- find_llm_model_for_persona(SiteSetting.ai_translation_topic_title_translator_persona)
+ find_llm_model_for_agent(SiteSetting.ai_translation_topic_title_translator_agent)
post_raw_llm_model =
- find_llm_model_for_persona(SiteSetting.ai_translation_post_raw_translator_persona)
+ find_llm_model_for_agent(SiteSetting.ai_translation_post_raw_translator_agent)
return if topic_title_llm_model.blank? && post_raw_llm_model.blank?
locales = DiscourseAi::Translation.locales
@@ -66,13 +66,13 @@ module Jobs
private
- def find_llm_model_for_persona(persona_id)
- return nil if persona_id.blank?
+ def find_llm_model_for_agent(agent_id)
+ return nil if agent_id.blank?
- persona_klass = AiPersona.find_by_id_from_cache(persona_id)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(agent_id)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/regular/stream_discord_reply.rb b/plugins/discourse-ai/app/jobs/regular/stream_discord_reply.rb
index 7029a08083e..948ab31b85d 100644
--- a/plugins/discourse-ai/app/jobs/regular/stream_discord_reply.rb
+++ b/plugins/discourse-ai/app/jobs/regular/stream_discord_reply.rb
@@ -9,8 +9,8 @@ module Jobs
return unless SiteSetting.ai_discord_search_enabled
- if SiteSetting.ai_discord_search_mode == "persona"
- DiscourseAi::Discord::Bot::PersonaReplier.new(interaction).handle_interaction!
+ if SiteSetting.ai_discord_search_mode == "agent"
+ DiscourseAi::Discord::Bot::AgentReplier.new(interaction).handle_interaction!
else
DiscourseAi::Discord::Bot::Search.new(interaction).handle_interaction!
end
diff --git a/plugins/discourse-ai/app/jobs/regular/stream_discover_reply.rb b/plugins/discourse-ai/app/jobs/regular/stream_discover_reply.rb
index 63e4f1c151a..df160db4b37 100644
--- a/plugins/discourse-ai/app/jobs/regular/stream_discover_reply.rb
+++ b/plugins/discourse-ai/app/jobs/regular/stream_discover_reply.rb
@@ -9,22 +9,20 @@ module Jobs
return if (user = User.find_by(id: args[:user_id])).nil?
return if (query = args[:query]).blank?
- ai_persona_klass =
- AiPersona
- .all_personas(enabled_only: false)
- .find { |persona| persona.id == SiteSetting.ai_discover_persona.to_i }
+ ai_agent_klass =
+ AiAgent
+ .all_agents(enabled_only: false)
+ .find { |agent| agent.id == SiteSetting.ai_discover_agent.to_i }
- if ai_persona_klass.nil? || !user.in_any_groups?(ai_persona_klass.allowed_group_ids.to_a)
- return
- end
+ return if ai_agent_klass.nil? || !user.in_any_groups?(ai_agent_klass.allowed_group_ids.to_a)
- llm_model_id = ai_persona_klass.default_llm_id || SiteSetting.ai_default_llm_model
+ llm_model_id = ai_agent_klass.default_llm_id || SiteSetting.ai_default_llm_model
return if (llm_model = LlmModel.find_by(id: llm_model_id)).nil?
bot =
- DiscourseAi::Personas::Bot.as(
+ DiscourseAi::Agents::Bot.as(
Discourse.system_user,
- persona: ai_persona_klass.new,
+ agent: ai_agent_klass.new,
model: llm_model,
)
@@ -34,7 +32,7 @@ module Jobs
base = { query: query, model_used: llm_model.display_name }
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: user,
messages: [{ type: :user, content: query }],
skip_show_thinking: true,
diff --git a/plugins/discourse-ai/app/jobs/scheduled/categories_locale_detection_backfill.rb b/plugins/discourse-ai/app/jobs/scheduled/categories_locale_detection_backfill.rb
index 196ab2dc1d7..ae271b06a79 100644
--- a/plugins/discourse-ai/app/jobs/scheduled/categories_locale_detection_backfill.rb
+++ b/plugins/discourse-ai/app/jobs/scheduled/categories_locale_detection_backfill.rb
@@ -46,11 +46,10 @@ module Jobs
private
def find_llm_model
- persona_klass =
- AiPersona.find_by_id_from_cache(SiteSetting.ai_translation_locale_detector_persona)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(SiteSetting.ai_translation_locale_detector_agent)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/scheduled/category_localization_backfill.rb b/plugins/discourse-ai/app/jobs/scheduled/category_localization_backfill.rb
index 0b6ca0c9e8c..4962f6fafe4 100644
--- a/plugins/discourse-ai/app/jobs/scheduled/category_localization_backfill.rb
+++ b/plugins/discourse-ai/app/jobs/scheduled/category_localization_backfill.rb
@@ -9,9 +9,8 @@ module Jobs
return if !DiscourseAi::Translation.backfill_enabled?
short_text_llm =
- find_llm_model_for_persona(SiteSetting.ai_translation_short_text_translator_persona)
- post_raw_llm =
- find_llm_model_for_persona(SiteSetting.ai_translation_post_raw_translator_persona)
+ find_llm_model_for_agent(SiteSetting.ai_translation_short_text_translator_agent)
+ post_raw_llm = find_llm_model_for_agent(SiteSetting.ai_translation_post_raw_translator_agent)
if (short_text_llm && !LlmCreditAllocation.credits_available?(short_text_llm)) ||
(post_raw_llm && !LlmCreditAllocation.credits_available?(post_raw_llm))
@@ -28,13 +27,13 @@ module Jobs
private
- def find_llm_model_for_persona(persona_id)
- return nil if persona_id.blank?
+ def find_llm_model_for_agent(agent_id)
+ return nil if agent_id.blank?
- persona_klass = AiPersona.find_by_id_from_cache(persona_id)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(agent_id)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/scheduled/post_localization_backfill.rb b/plugins/discourse-ai/app/jobs/scheduled/post_localization_backfill.rb
index 37cdf4652b8..83c75cb960d 100644
--- a/plugins/discourse-ai/app/jobs/scheduled/post_localization_backfill.rb
+++ b/plugins/discourse-ai/app/jobs/scheduled/post_localization_backfill.rb
@@ -8,8 +8,7 @@ module Jobs
def execute(args)
return if !DiscourseAi::Translation.backfill_enabled?
- post_raw_llm =
- find_llm_model_for_persona(SiteSetting.ai_translation_post_raw_translator_persona)
+ post_raw_llm = find_llm_model_for_agent(SiteSetting.ai_translation_post_raw_translator_agent)
if post_raw_llm && !LlmCreditAllocation.credits_available?(post_raw_llm)
Rails.logger.info(
@@ -26,13 +25,13 @@ module Jobs
private
- def find_llm_model_for_persona(persona_id)
- return nil if persona_id.blank?
+ def find_llm_model_for_agent(agent_id)
+ return nil if agent_id.blank?
- persona_klass = AiPersona.find_by_id_from_cache(persona_id)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(agent_id)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/scheduled/posts_locale_detection_backfill.rb b/plugins/discourse-ai/app/jobs/scheduled/posts_locale_detection_backfill.rb
index b7db5a0a2fb..f36e50167ca 100644
--- a/plugins/discourse-ai/app/jobs/scheduled/posts_locale_detection_backfill.rb
+++ b/plugins/discourse-ai/app/jobs/scheduled/posts_locale_detection_backfill.rb
@@ -50,11 +50,10 @@ module Jobs
private
def find_llm_model
- persona_klass =
- AiPersona.find_by_id_from_cache(SiteSetting.ai_translation_locale_detector_persona)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(SiteSetting.ai_translation_locale_detector_agent)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/scheduled/summaries_backfill.rb b/plugins/discourse-ai/app/jobs/scheduled/summaries_backfill.rb
index b5b2f67b794..226082e4426 100644
--- a/plugins/discourse-ai/app/jobs/scheduled/summaries_backfill.rb
+++ b/plugins/discourse-ai/app/jobs/scheduled/summaries_backfill.rb
@@ -99,10 +99,10 @@ module Jobs
end
def find_llm_model
- persona_klass = AiPersona.find_by_id_from_cache(SiteSetting.ai_summarization_persona)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(SiteSetting.ai_summarization_agent)
+ return nil if agent_klass.blank?
- DiscourseAi::Summarization.find_summarization_model(persona_klass)
+ DiscourseAi::Summarization.find_summarization_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/scheduled/tag_localization_backfill.rb b/plugins/discourse-ai/app/jobs/scheduled/tag_localization_backfill.rb
index d5c734f4a14..f47ef6c4ddd 100644
--- a/plugins/discourse-ai/app/jobs/scheduled/tag_localization_backfill.rb
+++ b/plugins/discourse-ai/app/jobs/scheduled/tag_localization_backfill.rb
@@ -9,7 +9,7 @@ module Jobs
return if !DiscourseAi::Translation.backfill_enabled?
short_text_llm =
- find_llm_model_for_persona(SiteSetting.ai_translation_short_text_translator_persona)
+ find_llm_model_for_agent(SiteSetting.ai_translation_short_text_translator_agent)
if short_text_llm && !LlmCreditAllocation.credits_available?(short_text_llm)
Rails.logger.info(
@@ -25,13 +25,13 @@ module Jobs
private
- def find_llm_model_for_persona(persona_id)
- return nil if persona_id.blank?
+ def find_llm_model_for_agent(agent_id)
+ return nil if agent_id.blank?
- persona_klass = AiPersona.find_by_id_from_cache(persona_id)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(agent_id)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/scheduled/tags_locale_detection_backfill.rb b/plugins/discourse-ai/app/jobs/scheduled/tags_locale_detection_backfill.rb
index 6b568ea1689..47a6955d223 100644
--- a/plugins/discourse-ai/app/jobs/scheduled/tags_locale_detection_backfill.rb
+++ b/plugins/discourse-ai/app/jobs/scheduled/tags_locale_detection_backfill.rb
@@ -43,11 +43,10 @@ module Jobs
private
def find_llm_model
- persona_klass =
- AiPersona.find_by_id_from_cache(SiteSetting.ai_translation_locale_detector_persona)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(SiteSetting.ai_translation_locale_detector_agent)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/scheduled/topic_localization_backfill.rb b/plugins/discourse-ai/app/jobs/scheduled/topic_localization_backfill.rb
index 2b21b753abf..7b1501837a2 100644
--- a/plugins/discourse-ai/app/jobs/scheduled/topic_localization_backfill.rb
+++ b/plugins/discourse-ai/app/jobs/scheduled/topic_localization_backfill.rb
@@ -9,9 +9,8 @@ module Jobs
return if !DiscourseAi::Translation.backfill_enabled?
topic_title_llm =
- find_llm_model_for_persona(SiteSetting.ai_translation_topic_title_translator_persona)
- post_raw_llm =
- find_llm_model_for_persona(SiteSetting.ai_translation_post_raw_translator_persona)
+ find_llm_model_for_agent(SiteSetting.ai_translation_topic_title_translator_agent)
+ post_raw_llm = find_llm_model_for_agent(SiteSetting.ai_translation_post_raw_translator_agent)
if (topic_title_llm && !LlmCreditAllocation.credits_available?(topic_title_llm)) ||
(post_raw_llm && !LlmCreditAllocation.credits_available?(post_raw_llm))
@@ -27,13 +26,13 @@ module Jobs
private
- def find_llm_model_for_persona(persona_id)
- return nil if persona_id.blank?
+ def find_llm_model_for_agent(agent_id)
+ return nil if agent_id.blank?
- persona_klass = AiPersona.find_by_id_from_cache(persona_id)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(agent_id)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/jobs/scheduled/topics_locale_detection_backfill.rb b/plugins/discourse-ai/app/jobs/scheduled/topics_locale_detection_backfill.rb
index 4ecf3f10d72..c1a28b39a7d 100644
--- a/plugins/discourse-ai/app/jobs/scheduled/topics_locale_detection_backfill.rb
+++ b/plugins/discourse-ai/app/jobs/scheduled/topics_locale_detection_backfill.rb
@@ -48,11 +48,10 @@ module Jobs
private
def find_llm_model
- persona_klass =
- AiPersona.find_by_id_from_cache(SiteSetting.ai_translation_locale_detector_persona)
- return nil if persona_klass.blank?
+ agent_klass = AiAgent.find_by_id_from_cache(SiteSetting.ai_translation_locale_detector_agent)
+ return nil if agent_klass.blank?
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
end
end
end
diff --git a/plugins/discourse-ai/app/models/ai_persona.rb b/plugins/discourse-ai/app/models/ai_agent.rb
similarity index 72%
rename from plugins/discourse-ai/app/models/ai_persona.rb
rename to plugins/discourse-ai/app/models/ai_agent.rb
index 3cb10f034c2..e7a2a8df285 100644
--- a/plugins/discourse-ai/app/models/ai_persona.rb
+++ b/plugins/discourse-ai/app/models/ai_agent.rb
@@ -1,16 +1,16 @@
# frozen_string_literal: true
-class AiPersona < ActiveRecord::Base
+class AiAgent < ActiveRecord::Base
# TODO remove tool_details from ignored_columns 01-02-2027
self.ignored_columns = %i[tool_details]
# places a hard limit, so per site we cache a maximum of 500 classes
- MAX_PERSONAS_PER_SITE = 500
+ MAX_AGENTS_PER_SITE = 500
validates :name, presence: true, uniqueness: true, length: { maximum: 100 }
validates :description, presence: true, length: { maximum: 2000 }
validates :system_prompt, presence: true, length: { maximum: 10_000_000 }
- validate :system_persona_unchangeable, on: :update, if: :system
+ validate :system_agent_unchangeable, on: :update, if: :system
validate :chat_preconditions
validate :well_formated_examples
validates :max_context_posts, numericality: { greater_than: 0 }, allow_nil: true
@@ -54,76 +54,67 @@ class AiPersona < ActiveRecord::Base
before_update :regenerate_rag_fragments
before_destroy :ensure_not_system
- def self.persona_cache
- @persona_cache ||= DiscourseAi::MultisiteHash.new("persona_cache")
+ def self.agent_cache
+ @agent_cache ||= DiscourseAi::MultisiteHash.new("agent_cache")
end
scope :ordered, -> { order("priority DESC, lower(name) ASC") }
- def self.all_personas(enabled_only: true)
- persona_cache[:value] ||= AiPersona
- .ordered
- .all
- .limit(MAX_PERSONAS_PER_SITE)
- .map(&:class_instance)
+ def self.all_agents(enabled_only: true)
+ agent_cache[:value] ||= AiAgent.ordered.all.limit(MAX_AGENTS_PER_SITE).map(&:class_instance)
if enabled_only
- persona_cache[:value].select { |p| p.enabled }
+ agent_cache[:value].select { |p| p.enabled }
else
- persona_cache[:value]
+ agent_cache[:value]
end
end
- def self.all_persona_records(enabled_only: true)
- persona_cache[:records] ||= AiPersona
- .ordered
- .includes(:user)
- .all
- .limit(MAX_PERSONAS_PER_SITE)
- .to_a
+ def self.all_agent_records(enabled_only: true)
+ agent_cache[:records] ||= AiAgent.ordered.includes(:user).all.limit(MAX_AGENTS_PER_SITE).to_a
if enabled_only
- persona_cache[:records].select(&:enabled)
+ agent_cache[:records].select(&:enabled)
else
- persona_cache[:records]
+ agent_cache[:records]
end
end
- def self.find_by_id_from_cache(persona_id)
- return nil if persona_id.nil?
+ def self.find_by_id_from_cache(agent_id)
+ return nil if agent_id.nil?
# Try to find in record cache first
- cached_persona = all_persona_records(enabled_only: false).find { |p| p.id == persona_id.to_i }
- return cached_persona if cached_persona
+ cached_agent = all_agent_records(enabled_only: false).find { |p| p.id == agent_id.to_i }
+ return cached_agent if cached_agent
# Fallback to database if not found in cache (e.g., in tests or if cache is stale)
- find_by(id: persona_id.to_i)
+ find_by(id: agent_id.to_i)
end
- def self.persona_users(user: nil)
- persona_users =
- persona_cache[:persona_users] ||= AiPersona
+ def self.agent_users(user: nil)
+ agent_users =
+ agent_cache[:agent_users] ||= AiAgent
.where(enabled: true)
.joins(:user)
- .map do |persona|
+ .map do |agent|
{
- id: persona.id,
- user_id: persona.user_id,
- username: persona.user.username_lower,
- allowed_group_ids: persona.allowed_group_ids,
- default_llm_id: persona.default_llm_id,
- force_default_llm: persona.force_default_llm,
- allow_chat_channel_mentions: persona.allow_chat_channel_mentions,
- allow_chat_direct_messages: persona.allow_chat_direct_messages,
- allow_topic_mentions: persona.allow_topic_mentions,
- allow_personal_messages: persona.allow_personal_messages,
+ id: agent.id,
+ user_id: agent.user_id,
+ username: agent.user.username_lower,
+ allowed_group_ids: agent.allowed_group_ids,
+ default_llm_id: agent.default_llm_id,
+ force_default_llm: agent.force_default_llm,
+ allow_chat_channel_mentions: agent.allow_chat_channel_mentions,
+ allow_chat_direct_messages: agent.allow_chat_direct_messages,
+ allow_topic_mentions: agent.allow_topic_mentions,
+ allow_personal_messages: agent.allow_personal_messages,
}
end
if user
- persona_users.select { |persona_user| user.in_any_groups?(persona_user[:allowed_group_ids]) }
+ agent_users.select { |agent_user| user.in_any_groups?(agent_user[:allowed_group_ids]) }
else
- persona_users
+ agent_users
end
end
@@ -137,26 +128,26 @@ class AiPersona < ActiveRecord::Base
index =
"modality-#{allow_chat_channel_mentions}-#{allow_chat_direct_messages}-#{allow_topic_mentions}-#{allow_personal_messages}"
- personas =
- persona_cache[index.to_sym] ||= persona_users.select do |persona|
- next true if allow_chat_channel_mentions && persona[:allow_chat_channel_mentions]
- next true if allow_chat_direct_messages && persona[:allow_chat_direct_messages]
- next true if allow_topic_mentions && persona[:allow_topic_mentions]
- next true if allow_personal_messages && persona[:allow_personal_messages]
+ agents =
+ agent_cache[index.to_sym] ||= agent_users.select do |agent|
+ next true if allow_chat_channel_mentions && agent[:allow_chat_channel_mentions]
+ next true if allow_chat_direct_messages && agent[:allow_chat_direct_messages]
+ next true if allow_topic_mentions && agent[:allow_topic_mentions]
+ next true if allow_personal_messages && agent[:allow_personal_messages]
false
end
if user
- personas.select { |u| user.in_any_groups?(u[:allowed_group_ids]) }
+ agents.select { |u| user.in_any_groups?(u[:allowed_group_ids]) }
else
- personas
+ agents
end
end
after_commit :bump_cache
def bump_cache
- self.class.persona_cache.flush!
+ self.class.agent_cache.flush!
end
def tools_can_not_be_duplicated
@@ -177,7 +168,7 @@ class AiPersona < ActiveRecord::Base
end
if seen_tools.include?(inner_name)
- errors.add(:tools, I18n.t("discourse_ai.ai_bot.personas.cannot_have_duplicate_tools"))
+ errors.add(:tools, I18n.t("discourse_ai.ai_bot.agents.cannot_have_duplicate_tools"))
break
else
seen_tools.add(inner_name)
@@ -193,7 +184,7 @@ class AiPersona < ActiveRecord::Base
.pluck(:tool_name)
.each do |tool_name|
if builtin_tool_names.include?(tool_name.downcase)
- errors.add(:tools, I18n.t("discourse_ai.ai_bot.personas.cannot_have_duplicate_tools"))
+ errors.add(:tools, I18n.t("discourse_ai.ai_bot.agents.cannot_have_duplicate_tools"))
break
end
end
@@ -250,14 +241,14 @@ class AiPersona < ActiveRecord::Base
if inner_name.start_with?("custom-")
custom_tool_id = inner_name.split("-", 2).last.to_i
if AiTool.exists?(id: custom_tool_id, enabled: true)
- klass = DiscourseAi::Personas::Tools::Custom.class_instance(custom_tool_id)
+ klass = DiscourseAi::Agents::Tools::Custom.class_instance(custom_tool_id)
end
else
inner_name = inner_name.gsub("Tool", "")
inner_name = "List#{inner_name}" if %w[Categories Tags].include?(inner_name)
begin
- klass = "DiscourseAi::Personas::Tools::#{inner_name}".constantize
+ klass = "DiscourseAi::Agents::Tools::#{inner_name}".constantize
options[klass] = current_options if current_options
rescue StandardError
end
@@ -267,14 +258,14 @@ class AiPersona < ActiveRecord::Base
klass
end
- persona_class = DiscourseAi::Personas::Persona.system_personas_by_id[self.id]
- if persona_class
+ agent_class = DiscourseAi::Agents::Agent.system_agents_by_id[self.id]
+ if agent_class
return(
# we need a new copy so we don't leak information
# across sites
- Class.new(persona_class) do
+ Class.new(agent_class) do
# required for localization
- define_singleton_method(:to_s) { persona_class.to_s }
+ define_singleton_method(:to_s) { agent_class.to_s }
instance_attributes.each do |key, value|
# description/name are localized
define_singleton_method(key) { value } if key != :description && key != :name
@@ -284,9 +275,9 @@ class AiPersona < ActiveRecord::Base
)
end
- ai_persona_id = self.id
+ ai_agent_id = self.id
- Class.new(DiscourseAi::Personas::Persona) do
+ Class.new(DiscourseAi::Agents::Agent) do
instance_attributes.each { |key, value| define_singleton_method(key) { value } }
define_singleton_method(:to_s) do
@@ -296,24 +287,24 @@ class AiPersona < ActiveRecord::Base
define_singleton_method(:inspect) { to_s }
define_method(:initialize) do |*args, **kwargs|
- @ai_persona = AiPersona.find_by(id: ai_persona_id)
+ @ai_agent = AiAgent.find_by(id: ai_agent_id)
super(*args, **kwargs)
end
define_method(:tools) { tools }
define_method(:force_tool_use) { force_tool_use }
- define_method(:forced_tool_count) { @ai_persona&.forced_tool_count }
+ define_method(:forced_tool_count) { @ai_agent&.forced_tool_count }
define_method(:options) { options }
- define_method(:temperature) { @ai_persona&.temperature }
- define_method(:top_p) { @ai_persona&.top_p }
- define_method(:system_prompt) { @ai_persona&.system_prompt || "You are a helpful bot." }
- define_method(:uploads) { @ai_persona&.uploads }
- define_method(:response_format) { @ai_persona&.response_format }
- define_method(:examples) { @ai_persona&.examples }
+ define_method(:temperature) { @ai_agent&.temperature }
+ define_method(:top_p) { @ai_agent&.top_p }
+ define_method(:system_prompt) { @ai_agent&.system_prompt || "You are a helpful bot." }
+ define_method(:uploads) { @ai_agent&.uploads }
+ define_method(:response_format) { @ai_agent&.response_format }
+ define_method(:examples) { @ai_agent&.examples }
end
end
- FIRST_PERSONA_USER_ID = -1200
+ FIRST_AGENT_USER_ID = -1200
def create_user!
raise "User already exists" if user_id && User.exists?(user_id)
@@ -321,7 +312,7 @@ class AiPersona < ActiveRecord::Base
# find the first id smaller than FIRST_USER_ID that is not taken
id = nil
- id = DB.query_single(<<~SQL, FIRST_PERSONA_USER_ID, FIRST_PERSONA_USER_ID - 200).first
+ id = DB.query_single(<<~SQL, FIRST_AGENT_USER_ID, FIRST_AGENT_USER_ID - 200).first
WITH seq AS (
SELECT generate_series(?, ?, -1) AS id
)
@@ -359,8 +350,8 @@ class AiPersona < ActiveRecord::Base
end
def has_image_generation_tool?
- persona_klass = class_instance.new
- persona_klass.tools.any? do |tool_klass|
+ agent_klass = class_instance.new
+ agent_klass.tools.any? do |tool_klass|
if tool_klass.respond_to?(:custom?) && tool_klass.custom?
ai_tool = AiTool.find_by(id: tool_klass.tool_id)
ai_tool&.image_generation_tool?
@@ -371,7 +362,7 @@ class AiPersona < ActiveRecord::Base
end
def features
- DiscourseAi::Configuration::Feature.find_features_using(persona_id: id)
+ DiscourseAi::Configuration::Feature.find_features_using(agent_id: id)
end
private
@@ -381,12 +372,12 @@ class AiPersona < ActiveRecord::Base
allow_chat_channel_mentions || allow_chat_direct_messages || allow_topic_mentions ||
force_default_llm
) && !default_llm_id
- errors.add(:default_llm, I18n.t("discourse_ai.ai_bot.personas.default_llm_required"))
+ errors.add(:default_llm, I18n.t("discourse_ai.ai_bot.agents.default_llm_required"))
end
end
- def system_persona_unchangeable
- error_msg = I18n.t("discourse_ai.ai_bot.personas.cannot_edit_system_persona")
+ def system_agent_unchangeable
+ error_msg = I18n.t("discourse_ai.ai_bot.agents.cannot_edit_system_agent")
if top_p_changed? || temperature_changed? || system_prompt_changed? || name_changed? ||
description_changed?
@@ -414,7 +405,7 @@ class AiPersona < ActiveRecord::Base
def ensure_not_system
if system
- errors.add(:base, I18n.t("discourse_ai.ai_bot.personas.cannot_delete_system_persona"))
+ errors.add(:base, I18n.t("discourse_ai.ai_bot.agents.cannot_delete_system_agent"))
throw :abort
end
end
@@ -427,13 +418,13 @@ class AiPersona < ActiveRecord::Base
return
end
- errors.add(:examples, I18n.t("discourse_ai.personas.malformed_examples"))
+ errors.add(:examples, I18n.t("discourse_ai.agents.malformed_examples"))
end
end
# == Schema Information
#
-# Table name: ai_personas
+# Table name: ai_agents
#
# id :bigint not null, primary key
# allow_chat_channel_mentions :boolean default(FALSE), not null
@@ -474,5 +465,5 @@ end
#
# Indexes
#
-# index_ai_personas_on_name (name) UNIQUE
+# index_ai_agents_on_name (name) UNIQUE
#
diff --git a/plugins/discourse-ai/app/models/ai_moderation_setting.rb b/plugins/discourse-ai/app/models/ai_moderation_setting.rb
index 596ba131e69..ffc04bf6a28 100644
--- a/plugins/discourse-ai/app/models/ai_moderation_setting.rb
+++ b/plugins/discourse-ai/app/models/ai_moderation_setting.rb
@@ -1,7 +1,8 @@
# frozen_string_literal: true
+
class AiModerationSetting < ActiveRecord::Base
belongs_to :llm_model
- belongs_to :ai_persona
+ belongs_to :ai_agent, class_name: "AiAgent", optional: true
validates :llm_model_id, presence: true
validates :setting_type, presence: true
@@ -12,7 +13,7 @@ class AiModerationSetting < ActiveRecord::Base
end
def custom_instructions
- data["custom_instructions"]
+ data&.[]("custom_instructions")
end
end
@@ -20,13 +21,13 @@ end
#
# Table name: ai_moderation_settings
#
-# id :bigint not null, primary key
-# setting_type :enum not null
-# data :jsonb
-# llm_model_id :bigint not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# ai_persona_id :bigint default(-31), not null
+# id :bigint not null, primary key
+# data :jsonb
+# setting_type :enum not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# ai_agent_id :bigint default(-31), not null
+# llm_model_id :bigint not null
#
# Indexes
#
diff --git a/plugins/discourse-ai/app/models/ai_tool.rb b/plugins/discourse-ai/app/models/ai_tool.rb
index 7ab83463c58..436ed95cf7e 100644
--- a/plugins/discourse-ai/app/models/ai_tool.rb
+++ b/plugins/discourse-ai/app/models/ai_tool.rb
@@ -46,7 +46,7 @@ class AiTool < ActiveRecord::Base
end
def runner(parameters, llm:, bot_user:, context: nil, secret_bindings: nil)
- DiscourseAi::Personas::ToolRunner.new(
+ DiscourseAi::Agents::ToolRunner.new(
parameters: parameters,
llm: llm,
bot_user: bot_user,
@@ -56,10 +56,10 @@ class AiTool < ActiveRecord::Base
)
end
- after_commit :bump_persona_cache
+ after_commit :bump_agent_cache
- def bump_persona_cache
- AiPersona.persona_cache.flush!
+ def bump_agent_cache
+ AiAgent.agent_cache.flush!
end
def regenerate_rag_fragments
diff --git a/plugins/discourse-ai/app/models/rag_document_fragment.rb b/plugins/discourse-ai/app/models/rag_document_fragment.rb
index 4b10dff2294..747a6ee2882 100644
--- a/plugins/discourse-ai/app/models/rag_document_fragment.rb
+++ b/plugins/discourse-ai/app/models/rag_document_fragment.rb
@@ -35,7 +35,7 @@ class RagDocumentFragment < ActiveRecord::Base
end
end
- def indexing_status(persona, uploads)
+ def indexing_status(agent, uploads)
embeddings_table = DiscourseAi::Embeddings::Schema.for(self).table
results =
@@ -53,8 +53,8 @@ class RagDocumentFragment < ActiveRecord::Base
WHERE uploads.id IN (:upload_ids)
GROUP BY uploads.id
SQL
- target_id: persona.id,
- target_type: persona.class.to_s,
+ target_id: agent.id,
+ target_type: agent.class.to_s,
upload_ids: uploads.map(&:id),
)
diff --git a/plugins/discourse-ai/app/models/shared_ai_conversation.rb b/plugins/discourse-ai/app/models/shared_ai_conversation.rb
index 9ebe4a5ca9f..59b15d67597 100644
--- a/plugins/discourse-ai/app/models/shared_ai_conversation.rb
+++ b/plugins/discourse-ai/app/models/shared_ai_conversation.rb
@@ -53,13 +53,13 @@ class SharedAiConversation < ActiveRecord::Base
# but this name works
class SharedPost
attr_accessor :user
- attr_reader :id, :user_id, :created_at, :cooked, :persona
+ attr_reader :id, :user_id, :created_at, :cooked, :agent
def initialize(post)
@id = post[:id]
@user_id = post[:user_id]
@created_at = DateTime.parse(post[:created_at])
@cooked = post[:cooked]
- @persona = post[:persona]
+ @agent = post[:agent]
end
end
@@ -142,9 +142,9 @@ class SharedAiConversation < ActiveRecord::Base
llm_name = ActiveSupport::Inflector.humanize(llm_name) if llm_name
llm_name ||= I18n.t("discourse_ai.unknown_model")
- persona = nil
- if persona_id = topic.custom_fields["ai_persona_id"]
- persona = AiPersona.find_by(id: persona_id.to_i)&.name
+ agent = nil
+ if agent_id = topic.custom_fields["ai_agent_id"]
+ agent = AiAgent.find_by(id: agent_id.to_i)&.name
end
posts =
@@ -169,7 +169,7 @@ class SharedAiConversation < ActiveRecord::Base
cooked: cook_artifacts(post),
}
- mapped[:persona] = persona if ai_bot_participant&.id == post.user_id
+ mapped[:agent] = agent if ai_bot_participant&.id == post.user_id
mapped[:username] = post.user&.username if include_usernames
mapped
end,
diff --git a/plugins/discourse-ai/app/serializers/ai_features_persona_serializer.rb b/plugins/discourse-ai/app/serializers/ai_features_agent_serializer.rb
similarity index 79%
rename from plugins/discourse-ai/app/serializers/ai_features_persona_serializer.rb
rename to plugins/discourse-ai/app/serializers/ai_features_agent_serializer.rb
index 34cd4dd8a82..28999e7cc49 100644
--- a/plugins/discourse-ai/app/serializers/ai_features_persona_serializer.rb
+++ b/plugins/discourse-ai/app/serializers/ai_features_agent_serializer.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AiFeaturesPersonaSerializer < ApplicationSerializer
+class AiFeaturesAgentSerializer < ApplicationSerializer
attributes :id, :name, :allowed_groups
def allowed_groups
diff --git a/plugins/discourse-ai/app/serializers/ai_spam_serializer.rb b/plugins/discourse-ai/app/serializers/ai_spam_serializer.rb
index 12e5e3dc606..fbf36b92b6a 100644
--- a/plugins/discourse-ai/app/serializers/ai_spam_serializer.rb
+++ b/plugins/discourse-ai/app/serializers/ai_spam_serializer.rb
@@ -9,8 +9,8 @@ class AiSpamSerializer < ApplicationSerializer
:flagging_username,
:spam_score_type,
:spam_scanning_user,
- :ai_persona_id,
- :available_personas
+ :ai_agent_id,
+ :available_agents
def is_enabled
object[:enabled]
@@ -20,9 +20,9 @@ class AiSpamSerializer < ApplicationSerializer
settings&.llm_model&.id
end
- def ai_persona_id
- settings&.ai_persona&.id ||
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::SpamDetector]
+ def ai_agent_id
+ settings&.ai_agent_id || settings&.ai_agent&.id ||
+ DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::SpamDetector]
end
def custom_instructions
@@ -35,10 +35,8 @@ class AiSpamSerializer < ApplicationSerializer
end
end
- def available_personas
- DiscourseAi::Configuration::PersonaEnumerator.values.map do |h|
- { id: h[:value], name: h[:name] }
- end
+ def available_agents
+ DiscourseAi::Configuration::AgentEnumerator.values.map { |h| { id: h[:value], name: h[:name] } }
end
def flagging_username
diff --git a/plugins/discourse-ai/app/serializers/llm_model_serializer.rb b/plugins/discourse-ai/app/serializers/llm_model_serializer.rb
index eefad91ea0d..8d7f8e4b1b7 100644
--- a/plugins/discourse-ai/app/serializers/llm_model_serializer.rb
+++ b/plugins/discourse-ai/app/serializers/llm_model_serializer.rb
@@ -2,7 +2,7 @@
class LlmModelSerializer < ApplicationSerializer
# TODO: we probably should rename the table LlmModel to AiLlm
- # it is consistent with AiPersona and AiTool
+ # it is consistent with AiAgent and AiTool
# LLM model is a bit confusing given that large language model model is a confusing
# name
root "ai_llm"
diff --git a/plugins/discourse-ai/app/serializers/localized_ai_persona_serializer.rb b/plugins/discourse-ai/app/serializers/localized_ai_agent_serializer.rb
similarity index 95%
rename from plugins/discourse-ai/app/serializers/localized_ai_persona_serializer.rb
rename to plugins/discourse-ai/app/serializers/localized_ai_agent_serializer.rb
index d0999021dce..84c81698e8c 100644
--- a/plugins/discourse-ai/app/serializers/localized_ai_persona_serializer.rb
+++ b/plugins/discourse-ai/app/serializers/localized_ai_agent_serializer.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-class LocalizedAiPersonaSerializer < ApplicationSerializer
- root "ai_persona"
+class LocalizedAiAgentSerializer < ApplicationSerializer
+ root "ai_agent"
attributes :id,
:name,
diff --git a/plugins/discourse-ai/app/services/discourse_ai/persona_exporter.rb b/plugins/discourse-ai/app/services/discourse_ai/agent_exporter.rb
similarity index 65%
rename from plugins/discourse-ai/app/services/discourse_ai/persona_exporter.rb
rename to plugins/discourse-ai/app/services/discourse_ai/agent_exporter.rb
index adeb5c6c3e2..439ab4d9661 100644
--- a/plugins/discourse-ai/app/services/discourse_ai/persona_exporter.rb
+++ b/plugins/discourse-ai/app/services/discourse_ai/agent_exporter.rb
@@ -1,22 +1,22 @@
# frozen_string_literal: true
module DiscourseAi
- class PersonaExporter
- def initialize(persona:)
- raise ArgumentError, "Invalid persona provided" if !persona.is_a?(AiPersona)
- @persona = persona
+ class AgentExporter
+ def initialize(agent:)
+ raise ArgumentError, "Invalid agent provided" if !agent.is_a?(AiAgent)
+ @agent = agent
end
def export
- serialized_custom_tools = serialize_tools(@persona)
- serialize_persona(@persona, serialized_custom_tools)
+ serialized_custom_tools = serialize_tools(@agent)
+ serialize_agent(@agent, serialized_custom_tools)
end
private
- def serialize_tools(ai_persona)
+ def serialize_tools(ai_agent)
custom_tool_ids =
- (ai_persona.tools || []).filter_map do |tool_config|
+ (ai_agent.tools || []).filter_map do |tool_config|
# A tool config is an array like: ["custom-ID", {options}, force_flag]
if tool_config.is_a?(Array) && tool_config[0].to_s.start_with?("custom-")
tool_config[0].split("-", 2).last.to_i
@@ -40,21 +40,21 @@ module DiscourseAi
end
end
- def serialize_persona(ai_persona, serialized_custom_tools)
+ def serialize_agent(ai_agent, serialized_custom_tools)
export_data = {
meta: {
version: "1.0",
exported_at: Time.zone.now.iso8601,
},
- persona: {
- name: ai_persona.name,
- description: ai_persona.description,
- system_prompt: ai_persona.system_prompt,
- examples: ai_persona.examples,
- temperature: ai_persona.temperature,
- top_p: ai_persona.top_p,
- response_format: ai_persona.response_format,
- tools: transform_tools_for_export(ai_persona.tools, serialized_custom_tools),
+ agent: {
+ name: ai_agent.name,
+ description: ai_agent.description,
+ system_prompt: ai_agent.system_prompt,
+ examples: ai_agent.examples,
+ temperature: ai_agent.temperature,
+ top_p: ai_agent.top_p,
+ response_format: ai_agent.response_format,
+ tools: transform_tools_for_export(ai_agent.tools, serialized_custom_tools),
},
custom_tools: serialized_custom_tools,
}
diff --git a/plugins/discourse-ai/app/services/discourse_ai/persona_importer.rb b/plugins/discourse-ai/app/services/discourse_ai/agent_importer.rb
similarity index 72%
rename from plugins/discourse-ai/app/services/discourse_ai/persona_importer.rb
rename to plugins/discourse-ai/app/services/discourse_ai/agent_importer.rb
index 4925df33d50..0a35e65788e 100644
--- a/plugins/discourse-ai/app/services/discourse_ai/persona_importer.rb
+++ b/plugins/discourse-ai/app/services/discourse_ai/agent_importer.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- class PersonaImporter
+ class AgentImporter
class ImportError < StandardError
attr_reader :conflicts
@@ -22,6 +22,7 @@ module DiscourseAi
raise ArgumentError, "Invalid JSON payload"
end
+ normalize_legacy_format!
validate_payload!
end
@@ -30,43 +31,49 @@ module DiscourseAi
check_conflicts! unless overwrite
tool_name_to_id = import_custom_tools(@data["custom_tools"] || [], overwrite: overwrite)
- persona_data = @data["persona"]
+ agent_data = @data["agent"]
- existing_persona = AiPersona.find_by(name: persona_data["name"])
+ existing_agent = AiAgent.find_by(name: agent_data["name"])
attrs = {
- description: persona_data["description"],
- system_prompt: persona_data["system_prompt"],
- examples: persona_data["examples"],
- temperature: persona_data["temperature"],
- top_p: persona_data["top_p"],
- response_format: persona_data["response_format"],
- tools: transform_tools_for_import(persona_data["tools"], tool_name_to_id),
+ description: agent_data["description"],
+ system_prompt: agent_data["system_prompt"],
+ examples: agent_data["examples"],
+ temperature: agent_data["temperature"],
+ top_p: agent_data["top_p"],
+ response_format: agent_data["response_format"],
+ tools: transform_tools_for_import(agent_data["tools"], tool_name_to_id),
}
- if existing_persona && overwrite
- existing_persona.update!(**attrs)
- existing_persona
+ if existing_agent && overwrite
+ existing_agent.update!(**attrs)
+ existing_agent
else
- attrs[:name] = persona_data["name"]
- AiPersona.create!(**attrs)
+ attrs[:name] = agent_data["name"]
+ AiAgent.create!(**attrs)
end
end
end
private
+ def normalize_legacy_format!
+ if @data.is_a?(Hash) && @data.key?("persona") && [email protected]?("agent")
+ @data["agent"] = @data.delete("persona")
+ end
+ end
+
def validate_payload!
- unless @data.is_a?(Hash) && @data["persona"].is_a?(Hash)
- raise ArgumentError, "Invalid persona export data"
+ unless @data.is_a?(Hash) && @data["agent"].is_a?(Hash)
+ raise ArgumentError, "Invalid agent export data"
end
end
def check_conflicts!
conflicts = {}
- persona_name = @data["persona"]["name"]
- conflicts[:persona] = persona_name if AiPersona.exists?(name: persona_name)
+ agent_name = @data["agent"]["name"]
+ conflicts[:agent] = agent_name if AiAgent.exists?(name: agent_name)
if @data["custom_tools"].present?
existing_tools = []
@@ -86,8 +93,8 @@ module DiscourseAi
def build_conflict_message(conflicts)
messages = []
- if conflicts[:persona]
- messages << I18n.t("discourse_ai.errors.persona_already_exists", name: conflicts[:persona])
+ if conflicts[:agent]
+ messages << I18n.t("discourse_ai.errors.agent_already_exists", name: conflicts[:agent])
end
if conflicts[:custom_tools] && conflicts[:custom_tools].any?
diff --git a/plugins/discourse-ai/app/services/discourse_ai/ai_helper/generate_thumbnails.rb b/plugins/discourse-ai/app/services/discourse_ai/ai_helper/generate_thumbnails.rb
index 18816548c03..870fbf25a74 100644
--- a/plugins/discourse-ai/app/services/discourse_ai/ai_helper/generate_thumbnails.rb
+++ b/plugins/discourse-ai/app/services/discourse_ai/ai_helper/generate_thumbnails.rb
@@ -12,7 +12,7 @@ module DiscourseAi
validates :text, length: { maximum: 10_000 }
end
- model :persona
+ model :agent
policy :has_image_generation_tool
model :llm_model
step :generate_images
@@ -21,33 +21,33 @@ module DiscourseAi
private
- def fetch_persona
- persona_id = SiteSetting.ai_helper_post_illustrator_persona
- AiPersona.find_by(id: persona_id)
+ def fetch_agent
+ agent_id = SiteSetting.ai_helper_post_illustrator_agent
+ AiAgent.find_by(id: agent_id)
end
- def has_image_generation_tool(persona:)
- persona.has_image_generation_tool?
+ def has_image_generation_tool(agent:)
+ agent.has_image_generation_tool?
end
- def fetch_llm_model(persona:)
+ def fetch_llm_model(agent:)
model =
- LlmModel.find_by(id: persona.default_llm_id) ||
+ LlmModel.find_by(id: agent.default_llm_id) ||
LlmModel.find_by(id: SiteSetting.ai_default_llm_model)
fail!("llm_model_not_configured") if model.nil?
model
end
- def generate_images(persona:, llm_model:, params:, guardian:)
+ def generate_images(agent:, llm_model:, params:, guardian:)
bot =
- DiscourseAi::Personas::Bot.as(
+ DiscourseAi::Agents::Bot.as(
guardian.user,
- persona: persona.class_instance.new,
+ agent: agent.class_instance.new,
model: llm_model,
)
bot_context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: guardian.user,
feature_name: "illustrate_post",
messages: [{ type: :user, content: params.text }],
diff --git a/plugins/discourse-ai/app/services/discourse_ai/credit_status_checker.rb b/plugins/discourse-ai/app/services/discourse_ai/credit_status_checker.rb
index 71ec37bcc07..b686fa98936 100644
--- a/plugins/discourse-ai/app/services/discourse_ai/credit_status_checker.rb
+++ b/plugins/discourse-ai/app/services/discourse_ai/credit_status_checker.rb
@@ -7,37 +7,37 @@ module DiscourseAi
CACHE_TTL = 5.seconds
params do
- attribute :persona_ids, :array, default: []
+ attribute :agent_ids, :array, default: []
attribute :features, :array, default: []
attribute :llm_model_ids, :array, default: []
- validates :persona_ids, length: { maximum: 100 }
+ validates :agent_ids, length: { maximum: 100 }
validates :features, length: { maximum: 100 }
validates :llm_model_ids, length: { maximum: 100 }
before_validation do
- self.persona_ids = Array(persona_ids).compact.map(&:to_i).uniq
+ self.agent_ids = Array(agent_ids).compact.map(&:to_i).uniq
self.features = Array(features).compact.map(&:to_s).uniq
self.llm_model_ids = Array(llm_model_ids).compact.map(&:to_i).uniq
end
end
- step :check_personas
+ step :check_agents
step :check_features
step :check_llm_models
private
- def check_personas(params:)
- context[:personas] = {}
- return true if params.persona_ids.blank?
+ def check_agents(params:)
+ context[:agents] = {}
+ return true if params.agent_ids.blank?
- # Batch load personas
- personas = AiPersona.where(id: params.persona_ids).to_a
+ # Batch load agents
+ agents = AiAgent.where(id: params.agent_ids).to_a
# Collect all LLM model IDs needed
llm_model_ids =
- personas.map { |p| p.default_llm_id || SiteSetting.ai_default_llm_model }.compact.uniq
+ agents.map { |p| p.default_llm_id || SiteSetting.ai_default_llm_model }.compact.uniq
# Batch load LLM models with their credit allocations and daily usage
llm_models =
@@ -46,12 +46,12 @@ module DiscourseAi
.includes(llm_credit_allocation: :daily_usages)
.index_by(&:id)
- personas.each do |persona|
- llm_model_id = persona.default_llm_id || SiteSetting.ai_default_llm_model
+ agents.each do |agent|
+ llm_model_id = agent.default_llm_id || SiteSetting.ai_default_llm_model
llm_model = llm_models[llm_model_id]
next unless llm_model&.credit_system_enabled?
- context[:personas][persona.id] = {
+ context[:agents][agent.id] = {
llm_model_id: llm_model.id,
credit_status: cached_credit_status(llm_model),
}
diff --git a/plugins/discourse-ai/app/views/discourse_ai/ai_bot/shared_ai_conversations/show.html.erb b/plugins/discourse-ai/app/views/discourse_ai/ai_bot/shared_ai_conversations/show.html.erb
index 224e4c64a34..8af351e7852 100644
--- a/plugins/discourse-ai/app/views/discourse_ai/ai_bot/shared_ai_conversations/show.html.erb
+++ b/plugins/discourse-ai/app/views/discourse_ai/ai_bot/shared_ai_conversations/show.html.erb
@@ -43,8 +43,8 @@
<article class="post">
<header class="post__header">
<span class="post__user"><%= post.user.username %></span>
- <%if post.persona.present? %>
- <span class="post__persona"><%= post.persona %></span>
+ <%if post.agent.present? %>
+ <span class="post__agent"><%= post.agent %></span>
<% end %>
<time class="post__date" datetime="<%= post.created_at.iso8601 %>"><%= post.created_at.strftime('%Y-%m-%d') %></time>
</header>
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/admin-discourse-ai-plugin-route-map.js b/plugins/discourse-ai/assets/javascripts/discourse/admin-discourse-ai-plugin-route-map.js
index f5b2528929d..41ffbd4d3a8 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/admin-discourse-ai-plugin-route-map.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/admin-discourse-ai-plugin-route-map.js
@@ -4,10 +4,11 @@ export default {
path: "/plugins",
map() {
- this.route("discourse-ai-personas", { path: "ai-personas" }, function () {
+ this.route("discourse-ai-agents", { path: "ai-agents" }, function () {
this.route("new");
this.route("edit", { path: "/:id/edit" });
});
+ this.route("discourse-ai-agents-legacy", { path: "ai-personas/*path" });
this.route("discourse-ai-llms", { path: "ai-llms" }, function () {
this.route("new");
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/admin/adapters/ai-persona.js b/plugins/discourse-ai/assets/javascripts/discourse/admin/adapters/ai-agent.js
similarity index 94%
rename from plugins/discourse-ai/assets/javascripts/discourse/admin/adapters/ai-persona.js
rename to plugins/discourse-ai/assets/javascripts/discourse/admin/adapters/ai-agent.js
index 6a837690e86..d6c73c5fa58 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/admin/adapters/ai-persona.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/admin/adapters/ai-agent.js
@@ -16,6 +16,6 @@ export default class Adapter extends RestAdapter {
}
apiNameFor() {
- return "ai-persona";
+ return "ai-agent";
}
}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/admin/models/ai-persona.js b/plugins/discourse-ai/assets/javascripts/discourse/admin/models/ai-agent.js
similarity index 93%
rename from plugins/discourse-ai/assets/javascripts/discourse/admin/models/ai-persona.js
rename to plugins/discourse-ai/assets/javascripts/discourse/admin/models/ai-agent.js
index 79cd0dd232a..e057b26920c 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/admin/models/ai-persona.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/admin/models/ai-agent.js
@@ -27,7 +27,6 @@ const CREATE_ATTRIBUTES = [
"rag_conversation_chunks",
"rag_llm_model_id",
"question_consolidator_llm_id",
- "allow_chat",
"show_thinking",
"forced_tool_count",
"allow_personal_messages",
@@ -73,10 +72,10 @@ const SYSTEM_ATTRIBUTES = [
"compression_threshold",
];
-export default class AiPersona extends RestModel {
+export default class AiAgent extends RestModel {
async createUser() {
const result = await ajax(
- `/admin/plugins/discourse-ai/ai-personas/${this.id}/create-user.json`,
+ `/admin/plugins/discourse-ai/ai-agents/${this.id}/create-user.json`,
{
type: "POST",
}
@@ -152,10 +151,10 @@ export default class AiPersona extends RestModel {
fromPOJO(data) {
const dataClone = toPlainObject(data);
- const persona = AiPersona.create(dataClone);
- persona.tools = this.flattenedToolStructure(dataClone);
+ const agent = AiAgent.create(dataClone);
+ agent.tools = this.flattenedToolStructure(dataClone);
- return persona;
+ return agent;
}
toPOJO() {
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-persona-example.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-example.gjs
similarity index 82%
rename from plugins/discourse-ai/assets/javascripts/discourse/components/ai-persona-example.gjs
rename to plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-example.gjs
index 0f23341270a..1584207eb94 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-persona-example.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-example.gjs
@@ -7,7 +7,7 @@ import icon from "discourse/helpers/d-icon";
import { eq } from "discourse/truth-helpers";
import { i18n } from "discourse-i18n";
-export default class AiPersonaCollapsableExample extends Component {
+export default class AiAgentCollapsableExample extends Component {
@tracked collapsed = true;
get caretIcon() {
@@ -26,7 +26,7 @@ export default class AiPersonaCollapsableExample extends Component {
}
get exampleTitle() {
- return i18n("discourse_ai.ai_persona.examples.collapsable_title", {
+ return i18n("discourse_ai.ai_agent.examples.collapsable_title", {
number: this.args.exampleNumber + 1,
});
}
@@ -41,7 +41,7 @@ export default class AiPersonaCollapsableExample extends Component {
<exPair.Field
@title={{i18n
(concat
- "discourse_ai.ai_persona.examples."
+ "discourse_ai.ai_agent.examples."
(if (eq pairIdx 0) "user" "model")
)
}}
@@ -57,8 +57,8 @@ export default class AiPersonaCollapsableExample extends Component {
<@form.Container>
<@form.Button
@action={{this.deletePair}}
- @label="discourse_ai.ai_persona.examples.remove"
- class="ai-persona-editor__delete_example btn-danger"
+ @label="discourse_ai.ai_agent.examples.remove"
+ class="ai-agent-editor__delete_example btn-danger"
/>
</@form.Container>
{{/unless}}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-persona-llm-selector.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-llm-selector.gjs
similarity index 64%
rename from plugins/discourse-ai/assets/javascripts/discourse/components/ai-persona-llm-selector.gjs
rename to plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-llm-selector.gjs
index 65d10b5f935..e61656ab607 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-persona-llm-selector.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-llm-selector.gjs
@@ -6,10 +6,10 @@ import { service } from "@ember/service";
import DropdownSelectBox from "discourse/select-kit/components/dropdown-select-box";
import { i18n } from "discourse-i18n";
-const PERSONA_SELECTOR_KEY = "ai_persona_selector_id";
+const AGENT_SELECTOR_KEY = "ai_agent_selector_id";
const LLM_SELECTOR_KEY = "ai_llm_selector_id";
-export default class AiPersonaLlmSelector extends Component {
+export default class AiAgentLlmSelector extends Component {
@service currentUser;
@service keyValueStore;
@@ -20,7 +20,7 @@ export default class AiPersonaLlmSelector extends Component {
super(...arguments);
if (this.botOptions?.length) {
- this.#loadStoredPersona();
+ this.#loadStoredAgent();
this.#loadStoredLlm();
next(() => {
@@ -34,28 +34,35 @@ export default class AiPersonaLlmSelector extends Component {
}
get hasLlmSelector() {
- return this.currentUser.ai_enabled_chat_bots.some((bot) => !bot.is_persona);
+ return (
+ this.currentUser.ai_enabled_chat_bots?.some((bot) => !bot.is_agent) ||
+ false
+ );
+ }
+
+ get enabledAgents() {
+ return this.currentUser.ai_enabled_agents || [];
}
get botOptions() {
- if (!this.currentUser.ai_enabled_personas) {
+ if (!this.enabledAgents) {
return;
}
- let enabledPersonas = this.currentUser.ai_enabled_personas;
- enabledPersonas = enabledPersonas.filter(
- (persona) => persona.allow_personal_messages
+ let enabledAgents = this.enabledAgents;
+ enabledAgents = enabledAgents.filter(
+ (agent) => agent.allow_personal_messages
);
if (!this.hasLlmSelector) {
- enabledPersonas = enabledPersonas.filter((persona) => persona.username);
+ enabledAgents = enabledAgents.filter((agent) => agent.username);
}
- return enabledPersonas.map((persona) => {
+ return enabledAgents.map((agent) => {
return {
- id: persona.id,
- name: persona.name,
- description: persona.description,
+ id: agent.id,
+ name: agent.name,
+ description: agent.description,
};
});
}
@@ -70,8 +77,8 @@ export default class AiPersonaLlmSelector extends Component {
set value(newValue) {
this._value = newValue;
- this.keyValueStore.setItem(PERSONA_SELECTOR_KEY, newValue);
- this.args.setPersonaId(newValue);
+ this.keyValueStore.setItem(AGENT_SELECTOR_KEY, newValue);
+ this.args.setAgentId(newValue);
this.setAllowLLMSelector();
this.resetTargetRecipients();
}
@@ -82,11 +89,11 @@ export default class AiPersonaLlmSelector extends Component {
return;
}
- const persona = this.currentUser.ai_enabled_personas.find(
- (innerPersona) => innerPersona.id === this._value
+ const agent = this.enabledAgents.find(
+ (innerAgent) => innerAgent.id === this._value
);
- this.allowLLMSelector = !persona?.force_default_llm;
+ this.allowLLMSelector = !agent?.force_default_llm;
}
get currentLlm() {
@@ -112,16 +119,16 @@ export default class AiPersonaLlmSelector extends Component {
).username;
this.args.setTargetRecipient(botUsername);
} else {
- const persona = this.currentUser.ai_enabled_personas.find(
- (innerPersona) => innerPersona.id === this._value
+ const agent = this.enabledAgents.find(
+ (innerAgent) => innerAgent.id === this._value
);
- this.args.setTargetRecipient(persona.username || "");
+ this.args.setTargetRecipient(agent.username || "");
}
}
get llmOptions() {
const availableBots = this.currentUser.ai_enabled_chat_bots
- .filter((bot) => !bot.is_persona)
+ .filter((bot) => !bot.is_agent)
.filter(Boolean);
return availableBots
@@ -134,7 +141,7 @@ export default class AiPersonaLlmSelector extends Component {
.sort((a, b) => a.name.localeCompare(b.name));
}
- get showPersonaSelector() {
+ get showAgentSelector() {
return this.botOptions?.length > 1;
}
@@ -142,12 +149,12 @@ export default class AiPersonaLlmSelector extends Component {
return this.allowLLMSelector && this.llmOptions.length > 1;
}
- #getPersonaIdFromAttrs() {
- const personaName = this.args?.personaName;
- if (personaName) {
- const persona = this.botOptions.find((p) => p.name === personaName);
- if (persona) {
- return persona.id;
+ #getAgentIdFromAttrs() {
+ const agentName = this.args?.agentName;
+ if (agentName) {
+ const agent = this.botOptions.find((p) => p.name === agentName);
+ if (agent) {
+ return agent.id;
}
}
}
@@ -162,20 +169,20 @@ export default class AiPersonaLlmSelector extends Component {
}
}
- #loadStoredPersona() {
- let personaId =
- this.#getPersonaIdFromAttrs() ||
- this.keyValueStore.getItem(PERSONA_SELECTOR_KEY);
+ #loadStoredAgent() {
+ let agentId =
+ this.#getAgentIdFromAttrs() ||
+ this.keyValueStore.getItem(AGENT_SELECTOR_KEY);
this._value = this.botOptions[0].id;
- if (personaId) {
- personaId = parseInt(personaId, 10);
- if (this.botOptions.some((bot) => bot.id === personaId)) {
- this._value = personaId;
+ if (agentId) {
+ agentId = parseInt(agentId, 10);
+ if (this.botOptions.some((bot) => bot.id === agentId)) {
+ this._value = agentId;
}
}
- this.args.setPersonaId(this._value);
+ this.args.setAgentId(this._value);
}
#loadStoredLlm() {
@@ -208,14 +215,14 @@ export default class AiPersonaLlmSelector extends Component {
}
<template>
- <div class="persona-llm-selector">
- {{#if this.showPersonaSelector}}
- <div class="persona-llm-selector__selection-wrapper gpt-persona">
+ <div class="agent-llm-selector">
+ {{#if this.showAgentSelector}}
+ <div class="agent-llm-selector__selection-wrapper gpt-agent">
{{#if @showLabels}}
- <label>{{i18n "discourse_ai.ai_bot.persona"}}</label>
+ <label>{{i18n "discourse_ai.ai_bot.agent"}}</label>
{{/if}}
<DropdownSelectBox
- class="persona-llm-selector__persona-dropdown"
+ class="agent-llm-selector__agent-dropdown"
@value={{this.value}}
@content={{this.botOptions}}
@options={{hash
@@ -226,12 +233,12 @@ export default class AiPersonaLlmSelector extends Component {
</div>
{{/if}}
{{#if this.showLLMSelector}}
- <div class="persona-llm-selector__selection-wrapper llm-selector">
+ <div class="agent-llm-selector__selection-wrapper llm-selector">
{{#if @showLabels}}
<label>{{i18n "discourse_ai.ai_bot.llm"}}</label>
{{/if}}
<DropdownSelectBox
- class="persona-llm-selector__llm-dropdown"
+ class="agent-llm-selector__llm-dropdown"
@value={{this.currentLlm}}
@content={{this.llmOptions}}
@options={{hash icon=(if @showLabels "angle-down" "globe")}}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-persona-tool-options.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-tool-options.gjs
similarity index 89%
rename from plugins/discourse-ai/assets/javascripts/discourse/components/ai-persona-tool-options.gjs
rename to plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-tool-options.gjs
index 389de0af3e3..1cce3d7036f 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-persona-tool-options.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-tool-options.gjs
@@ -4,7 +4,7 @@ import { eq } from "discourse/truth-helpers";
import { i18n } from "discourse-i18n";
import AiLlmSelector from "./ai-llm-selector";
-export default class AiPersonaToolOptions extends Component {
+export default class AiAgentToolOptions extends Component {
get showToolOptions() {
const allTools = this.args.allTools;
if (!allTools || !this.args.data.tools) {
@@ -49,19 +49,19 @@ export default class AiPersonaToolOptions extends Component {
<template>
{{#if this.showToolOptions}}
<@form.Container
- @title={{i18n "discourse_ai.ai_persona.tool_options"}}
+ @title={{i18n "discourse_ai.ai_agent.tool_options"}}
@direction="column"
@format="full"
>
<@form.Object
@name="toolOptions"
- @title={{i18n "discourse_ai.ai_persona.tool_options"}}
+ @title={{i18n "discourse_ai.ai_agent.tool_options"}}
as |toolObj optsPerTool|
>
{{#each (this.formObjectKeys optsPerTool) as |toolId|}}
- <div class="ai-persona-editor__tool-options">
+ <div class="ai-agent-editor__tool-options">
{{#let (get this.toolsMetadata toolId) as |toolMeta|}}
- <div class="ai-persona-editor__tool-options-name">
+ <div class="ai-agent-editor__tool-options-name">
{{toolMeta.name}}
</div>
<toolObj.Object @name={{toolId}} as |optionsObj|>
@@ -86,7 +86,7 @@ export default class AiPersonaToolOptions extends Component {
@value={{field.value}}
@llms={{@llms}}
@onChange={{field.set}}
- class="ai-persona-tool-option-editor__llms"
+ class="ai-agent-tool-option-editor__llms"
/>
</field.Custom>
{{else if (eq optionMeta.type "boolean")}}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
index 2cb472877d0..6cd6276e534 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
@@ -32,7 +32,7 @@ import {
import { clipboardHelpers } from "discourse/lib/utilities";
import DAutocompleteModifier from "discourse/modifiers/d-autocomplete";
import { i18n } from "discourse-i18n";
-import AiPersonaLlmSelector from "discourse/plugins/discourse-ai/discourse/components/ai-persona-llm-selector";
+import AiAgentLlmSelector from "discourse/plugins/discourse-ai/discourse/components/ai-agent-llm-selector";
@tagName("")
export default class AiBotConversations extends Component {
@@ -172,12 +172,12 @@ export default class AiBotConversations extends Component {
}
@action
- async setPersonaId(id) {
- this.aiBotConversationsHiddenSubmit.personaId = id;
- // Only check persona credits if no LLM is explicitly selected
- // (e.g., when persona has force_default_llm)
+ async setAgentId(id) {
+ this.aiBotConversationsHiddenSubmit.agentId = id;
+ // Only check agent credits if no LLM is explicitly selected
+ // (e.g., when agent has force_default_llm)
if (!this.selectedLlmId) {
- await this.#checkCreditStatus(id, "persona");
+ await this.#checkCreditStatus(id, "agent");
}
}
@@ -197,8 +197,8 @@ export default class AiBotConversations extends Component {
try {
this.creditStatus =
- type === "persona"
- ? await this.aiCredits.getPersonaCreditStatus(id)
+ type === "agent"
+ ? await this.aiCredits.getAgentCreditStatus(id)
: await this.aiCredits.getLlmModelCreditStatus(id);
} catch {
// Fail open - allow usage if credit check fails
@@ -371,12 +371,12 @@ export default class AiBotConversations extends Component {
<template>
<div class="ai-bot-conversations" ...attributes>
{{bodyClass "ai-bot-conversations-page"}}
- <AiPersonaLlmSelector
+ <AiAgentLlmSelector
@showLabels={{true}}
- @setPersonaId={{this.setPersonaId}}
+ @setAgentId={{this.setAgentId}}
@setLlmId={{this.setLlmId}}
@setTargetRecipient={{this.setTargetRecipient}}
- @personaName={{@controller.persona}}
+ @agentName={{@controller.agent}}
@llmName={{@controller.llm}}
/>
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-header-icon.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-header-icon.gjs
index eccae7c0ad4..fd7f8388679 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-header-icon.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-header-icon.gjs
@@ -18,7 +18,7 @@ export default class AiBotHeaderIcon extends Component {
get bots() {
const availableBots = this.currentUser.ai_enabled_chat_bots
- .filter((bot) => !bot.is_persona || bot.has_default_llm)
+ .filter((bot) => !bot.is_agent || bot.has_default_llm)
.filter(Boolean);
return availableBots ? availableBots.map((bot) => bot.model_name) : [];
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-feature-card.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-feature-card.gjs
index 67e83c5d103..4eea816bc22 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-feature-card.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-feature-card.gjs
@@ -75,10 +75,10 @@ export default class AiFeatureCard extends Component {
groupList(feature) {
const groups = [];
const groupIds = new Set();
- if (feature.personas) {
- feature.personas.forEach((persona) => {
- if (persona.allowed_groups) {
- persona.allowed_groups.forEach((group) => {
+ if (feature.agents) {
+ feature.agents.forEach((agent) => {
+ if (agent.allowed_groups) {
+ agent.allowed_groups.forEach((group) => {
if (!groupIds.has(group.id)) {
groupIds.add(group.id);
groups.push(group);
@@ -102,30 +102,27 @@ export default class AiFeatureCard extends Component {
<span>{{i18n "discourse_ai.features.disabled"}}</span>
{{/unless}}
</div>
- <div class="ai-feature-card__persona">
+ <div class="ai-feature-card__agent">
<span class="ai-feature-card__label">
- {{i18n
- "discourse_ai.features.persona"
- }}
+ {{i18n "discourse_ai.features.agent" [email protected]}}
</span>
- {{#if @feature.personas}}
+ {{#if @feature.agents}}
<ExpandableList
- @items={{@feature.personas}}
+ @items={{@feature.agents}}
@maxItemsToShow={{5}}
- as |persona index isLastItem|
+ as |agent index isLastItem|
>
<LinkTo
- @route="adminPlugins.show.discourse-ai-personas.edit"
- @model={{persona.id}}
- class="ai-feature-card__persona-link"
+ @route="adminPlugins.show.discourse-ai-agents.edit"
+ @model={{agent.id}}
+ class="ai-feature-card__agent-link"
>
- {{concat persona.name (unless (isLastItem index) ", ")}}
+ {{concat agent.name (unless (isLastItem index) ", ")}}
</LinkTo>
</ExpandableList>
{{else}}
<span class="ai-feature-card__label">
- {{i18n "discourse_ai.features.no_persona"}}
+ {{i18n "discourse_ai.features.no_agent"}}
</span>
{{/if}}
</div>
@@ -157,7 +154,7 @@ export default class AiFeatureCard extends Component {
{{/if}}
</div>
{{#if @showGroups}}
- {{#if @feature.personas}}
+ {{#if @feature.agents}}
<div class="ai-feature-card__groups">
<span class="ai-feature-card__label">
{{i18n "discourse_ai.features.groups"}}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-llm-selector.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-llm-selector.gjs
index e642ee27dfc..613ee94dbb9 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-llm-selector.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-llm-selector.gjs
@@ -8,7 +8,7 @@ const AiLlmSelector = <template>
@onChange={{@onChange}}
@options={{hash
filterable=true
- none="discourse_ai.ai_persona.no_llm_selected"
+ none="discourse_ai.ai_agent.no_llm_selected"
}}
...attributes
/>
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries.gjs
index 31a6fc06e75..af4f0ff132e 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-search-discoveries.gjs
@@ -108,8 +108,8 @@ export default class AiSearchDiscoveries extends Component {
}
get canContinueConversation() {
- const personas = this.currentUser?.ai_enabled_personas;
- if (!personas) {
+ const agents = this.currentUser?.ai_enabled_agents;
+ if (!agents) {
return false;
}
@@ -117,16 +117,15 @@ export default class AiSearchDiscoveries extends Component {
return false;
}
- const discoverPersona = personas.find(
- (persona) =>
- persona.id === parseInt(this.siteSettings?.ai_discover_persona, 10)
+ const discoverAgent = agents.find(
+ (agent) => agent.id === parseInt(this.siteSettings?.ai_discover_agent, 10)
);
- const discoverPersonaHasBot = discoverPersona?.username;
+ const discoverAgentHasBot = discoverAgent?.username;
return (
this.discobotDiscoveries.discovery?.length > 0 &&
!this.discobotDiscoveries.isStreaming &&
- discoverPersonaHasBot
+ discoverAgentHasBot
);
}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/modal/ai-persona-response-format-editor.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/modal/ai-agent-response-format-editor.gjs
similarity index 79%
rename from plugins/discourse-ai/assets/javascripts/discourse/components/modal/ai-persona-response-format-editor.gjs
rename to plugins/discourse-ai/assets/javascripts/discourse/components/modal/ai-agent-response-format-editor.gjs
index ad0d8b50df8..71a02de2df2 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/modal/ai-persona-response-format-editor.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/modal/ai-agent-response-format-editor.gjs
@@ -7,16 +7,16 @@ import { prettyJSON } from "discourse/lib/formatter";
import { gt } from "discourse/truth-helpers";
import { i18n } from "discourse-i18n";
-export default class AiPersonaResponseFormatEditor extends Component {
+export default class AiAgentResponseFormatEditor extends Component {
@tracked showJsonEditorModal = false;
jsonSchema = {
type: "array",
uniqueItems: true,
- title: i18n("discourse_ai.ai_persona.response_format.modal.root_title"),
+ title: i18n("discourse_ai.ai_agent.response_format.modal.root_title"),
items: {
type: "object",
- title: i18n("discourse_ai.ai_persona.response_format.modal.key_title"),
+ title: i18n("discourse_ai.ai_agent.response_format.modal.key_title"),
properties: {
key: {
type: "string",
@@ -40,7 +40,7 @@ export default class AiPersonaResponseFormatEditor extends Component {
};
get editorTitle() {
- return i18n("discourse_ai.ai_persona.response_format.title");
+ return i18n("discourse_ai.ai_agent.response_format.title");
}
get responseFormatAsJSON() {
@@ -78,20 +78,20 @@ export default class AiPersonaResponseFormatEditor extends Component {
<template>
<@form.Container @title={{this.editorTitle}} @format="large">
- <div class="ai-persona-editor__response-format">
+ <div class="ai-agent-editor__response-format">
{{#if (gt @data.response_format.length 0)}}
- <pre class="ai-persona-editor__response-format-pre">
+ <pre class="ai-agent-editor__response-format-pre">
<code>{{this.displayJSON}}</code>
</pre>
{{else}}
- <div class="ai-persona-editor__response-format-none">
- {{i18n "discourse_ai.ai_persona.response_format.no_format"}}
+ <div class="ai-agent-editor__response-format-none">
+ {{i18n "discourse_ai.ai_agent.response_format.no_format"}}
</div>
{{/if}}
<@form.Button
@action={{this.openModal}}
- @label="discourse_ai.ai_persona.response_format.open_modal"
+ @label="discourse_ai.ai_agent.response_format.open_modal"
@disabled={{@data.system}}
/>
</div>
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/post/ai-persona-flair.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/post/ai-agent-flair.gjs
similarity index 50%
rename from plugins/discourse-ai/assets/javascripts/discourse/components/post/ai-persona-flair.gjs
rename to plugins/discourse-ai/assets/javascripts/discourse/components/post/ai-agent-flair.gjs
index af637159011..9cfeda5f6db 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/post/ai-persona-flair.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/post/ai-agent-flair.gjs
@@ -1,14 +1,16 @@
import Component from "@glimmer/component";
import { isGPTBot } from "../../lib/ai-bot-helper";
-export default class AiPersonaFlair extends Component {
+export default class AiAgentFlair extends Component {
static shouldRender(args) {
return isGPTBot(args.post.user);
}
+ get agentName() {
+ return this.args.outletArgs.post.topic.ai_agent_name;
+ }
+
<template>
- <span class="persona-flair">
- {{@outletArgs.post.topic.ai_persona_name}}
- </span>
+ <span class="agent-flair">{{this.agentName}}</span>
</template>
}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/rag-options-fk.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/rag-options-fk.gjs
index a819909ce44..f2bdfe9cdc1 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/rag-options-fk.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/rag-options-fk.gjs
@@ -70,7 +70,7 @@ export default class RagOptionsFk extends Component {
@value={{field.value}}
@llms={{this.visionLlms}}
@onChange={{field.set}}
- class="ai-persona-editor__llms"
+ class="ai-agent-editor__llms"
/>
</field.Custom>
</@form.Field>
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/connectors/composer-fields/persona-llm-selector.gjs b/plugins/discourse-ai/assets/javascripts/discourse/connectors/composer-fields/agent-llm-selector.gjs
similarity index 69%
rename from plugins/discourse-ai/assets/javascripts/discourse/connectors/composer-fields/persona-llm-selector.gjs
rename to plugins/discourse-ai/assets/javascripts/discourse/connectors/composer-fields/agent-llm-selector.gjs
index 2f420a85c74..821c834b39b 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/connectors/composer-fields/persona-llm-selector.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/connectors/composer-fields/agent-llm-selector.gjs
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
-import AiPersonaLlmSelector from "discourse/plugins/discourse-ai/discourse/components/ai-persona-llm-selector";
+import AiAgentLlmSelector from "discourse/plugins/discourse-ai/discourse/components/ai-agent-llm-selector";
function isBotMessage(composer, currentUser) {
if (
@@ -20,13 +20,15 @@ function isBotMessage(composer, currentUser) {
export default class BotSelector extends Component {
static shouldRender(args, { currentUser }) {
return (
- currentUser?.ai_enabled_personas && isBotMessage(args.model, currentUser)
+ currentUser?.ai_enabled_agents && isBotMessage(args.model, currentUser)
);
}
@action
- setPersonaIdOnComposer(id) {
- this.args.outletArgs.model.metaData = { ai_persona_id: id };
+ setAgentIdOnComposer(id) {
+ this.args.outletArgs.model.metaData = {
+ ai_agent_id: id,
+ };
}
@action
@@ -35,8 +37,8 @@ export default class BotSelector extends Component {
}
<template>
- <AiPersonaLlmSelector
- @setPersonaId={{this.setPersonaIdOnComposer}}
+ <AiAgentLlmSelector
+ @setAgentId={{this.setAgentIdOnComposer}}
@setTargetRecipient={{this.setTargetRecipientsOnComposer}}
/>
</template>
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-below-search-header/ai-full-page-discobot-discoveries.gjs b/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-below-search-header/ai-full-page-discobot-discoveries.gjs
index ef487bbdd5e..1c6635fdecb 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-below-search-header/ai-full-page-discobot-discoveries.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-below-search-header/ai-full-page-discobot-discoveries.gjs
@@ -12,8 +12,8 @@ export default class AiFullPageDiscobotDiscoveries extends Component {
static shouldRender(args, { siteSettings, currentUser }) {
return (
siteSettings.ai_discover_enabled &&
- siteSettings.ai_discover_persona &&
- currentUser?.can_use_ai_discover_persona &&
+ siteSettings.ai_discover_agent &&
+ currentUser?.can_use_ai_discover_agent &&
currentUser?.user_option?.ai_search_discoveries
);
}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/connectors/search-menu-results-top/ai-discobot-discoveries.gjs b/plugins/discourse-ai/assets/javascripts/discourse/connectors/search-menu-results-top/ai-discobot-discoveries.gjs
index 16be0c527ae..e3e966ddf06 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/connectors/search-menu-results-top/ai-discobot-discoveries.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/connectors/search-menu-results-top/ai-discobot-discoveries.gjs
@@ -10,8 +10,8 @@ export default class AiDiscobotDiscoveries extends Component {
static shouldRender(args, { siteSettings, currentUser }) {
return (
siteSettings.ai_discover_enabled &&
- siteSettings.ai_discover_persona &&
- currentUser?.can_use_ai_discover_persona &&
+ siteSettings.ai_discover_agent &&
+ currentUser?.can_use_ai_discover_agent &&
currentUser?.user_option?.ai_search_discoveries
);
}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/connectors/user-preferences-interface/ai-search-discoveries.gjs b/plugins/discourse-ai/assets/javascripts/discourse/connectors/user-preferences-interface/ai-search-discoveries.gjs
index e60183331f2..878fd0584ba 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/connectors/user-preferences-interface/ai-search-discoveries.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/connectors/user-preferences-interface/ai-search-discoveries.gjs
@@ -7,8 +7,8 @@ export default class AiSearchDiscoveries extends Component {
return (
siteSettings.discourse_ai_enabled &&
siteSettings.ai_discover_enabled &&
- siteSettings.ai_discover_persona &&
- currentUser?.can_use_ai_discover_persona
+ siteSettings.ai_discover_agent &&
+ currentUser?.can_use_ai_discover_agent
);
}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/controllers/discourse-ai-bot-conversations.gjs b/plugins/discourse-ai/assets/javascripts/discourse/controllers/discourse-ai-bot-conversations.gjs
index d6a0b2343ce..cab807b7de3 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/controllers/discourse-ai-bot-conversations.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/controllers/discourse-ai-bot-conversations.gjs
@@ -3,6 +3,6 @@ import Controller from "@ember/controller";
export default class DiscourseAiBotConversations extends Controller {
@tracked llm = null;
- @tracked persona = null;
- queryParams = ["llm", "persona"];
+ @tracked agent = null;
+ queryParams = ["llm", "agent"];
}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/initializers/add-ai-bot-to-community-section.gjs b/plugins/discourse-ai/assets/javascripts/discourse/initializers/add-ai-bot-to-community-section.gjs
index e5f6a68bd2c..192356fef56 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/initializers/add-ai-bot-to-community-section.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/initializers/add-ai-bot-to-community-section.gjs
@@ -17,7 +17,7 @@ export default {
}
const availableBots = currentUser.ai_enabled_chat_bots.filter(
- (bot) => !bot.is_persona || bot.has_default_llm
+ (bot) => !bot.is_agent || bot.has_default_llm
);
if (availableBots.length === 0) {
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/initializers/admin-plugin-configuration-nav.js b/plugins/discourse-ai/assets/javascripts/discourse/initializers/admin-plugin-configuration-nav.js
index df7e1d49c63..6c8d5d5b818 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/initializers/admin-plugin-configuration-nav.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/initializers/admin-plugin-configuration-nav.js
@@ -35,9 +35,9 @@ export default {
description: "discourse_ai.secrets.description",
},
{
- label: "discourse_ai.ai_persona.short_title",
- route: "adminPlugins.show.discourse-ai-personas",
- description: "discourse_ai.ai_persona.persona_description",
+ label: "discourse_ai.ai_agent.short_title",
+ route: "adminPlugins.show.discourse-ai-agents",
+ description: "discourse_ai.ai_agent.agent_description",
},
{
label: "discourse_ai.embeddings.short_title",
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-bot-replies.js b/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-bot-replies.js
index 53c589704ef..ba67e639806 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-bot-replies.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-bot-replies.js
@@ -1,6 +1,6 @@
import { withPluginApi } from "discourse/lib/plugin-api";
import AiBotHeaderIcon from "../components/ai-bot-header-icon";
-import AiPersonaFlair from "../components/post/ai-persona-flair";
+import AiAgentFlair from "../components/post/ai-agent-flair";
import AiCancelStreaming from "../components/post/meta-data/ai-cancel-streaming";
import AiCancelStreamingButton from "../components/post-menu/ai-cancel-streaming-button";
import AiDebugButton from "../components/post-menu/ai-debug-button";
@@ -53,8 +53,8 @@ function initializeAIBotReplies(api) {
});
}
-function initializePersonaDecorator(api) {
- api.renderAfterWrapperOutlet("post-meta-data-poster-name", AiPersonaFlair);
+function initializeAgentDecorator(api) {
+ api.renderAfterWrapperOutlet("post-meta-data-poster-name", AiAgentFlair);
}
function initializePauseButton(api) {
@@ -148,11 +148,10 @@ function initializeShareTopicButton(api) {
showShareConversationModal(modal, this.topic.id);
},
classNames: ["share-ai-conversation-button"],
- dependentKeys: ["topic.ai_persona_name"],
+ dependentKeys: ["topic.ai_agent_name"],
displayed() {
return (
- currentUser?.can_share_ai_bot_conversations &&
- this.topic.ai_persona_name
+ currentUser?.can_share_ai_bot_conversations && this.topic.ai_agent_name
);
},
});
@@ -170,7 +169,7 @@ export default {
withPluginApi((api) => {
attachHeaderIcon(api);
initializeAIBotReplies(api);
- initializePersonaDecorator(api);
+ initializeAgentDecorator(api);
initializeDebugButton(api, container);
initializeShareButton(api, container);
initializeShareTopicButton(api, container);
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-search-discoveries.js b/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-search-discoveries.js
index ad22297bb34..429455ea0ca 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-search-discoveries.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/initializers/ai-search-discoveries.js
@@ -6,7 +6,8 @@ export default apiInitializer((api) => {
if (
!settings.ai_discover_enabled ||
- !currentUser?.can_use_ai_discover_persona
+ (!currentUser?.can_use_ai_discover_agent &&
+ !currentUser?.can_use_ai_discover_agent)
) {
return;
}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-bot-helper.js b/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-bot-helper.js
index 34f0ab85744..f85cad1fb92 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-bot-helper.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-bot-helper.js
@@ -3,7 +3,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
import { getOwnerWithFallback } from "discourse/lib/get-owner";
import ShareFullTopicModal from "../components/modal/share-full-topic-modal";
-const MAX_PERSONA_USER_ID = -1200;
+const MAX_AGENT_USER_ID = -1200;
let enabledChatBotMap = null;
@@ -38,12 +38,12 @@ export function getBotType(user) {
if (!bot) {
return;
}
- return bot.is_persona ? "persona" : "llm";
+ return bot.is_agent ? "agent" : "llm";
}
export function isPostFromAiBot(post, currentUser) {
return (
- post.user_id <= MAX_PERSONA_USER_ID ||
+ post.user_id <= MAX_AGENT_USER_ID ||
!!currentUser?.ai_enabled_chat_bots?.some(
(bot) => post.username === bot.username
)
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-feature-setting-groups.js b/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-feature-setting-groups.js
index e1fa4073a5b..e63418920a3 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-feature-setting-groups.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/lib/ai-feature-setting-groups.js
@@ -26,19 +26,19 @@ export const AI_FEATURE_SETTING_GROUPS = {
],
},
{
- key: "personas",
- titleKey: "discourse_ai.features.ai_helper.setting_groups.personas",
+ key: "agents",
+ titleKey: "discourse_ai.features.ai_helper.setting_groups.agents",
settings: [
- "ai_helper_proofreader_persona",
- "ai_helper_title_suggestions_persona",
- "ai_helper_explain_persona",
- "ai_helper_post_illustrator_persona",
- "ai_helper_smart_dates_persona",
- "ai_helper_translator_persona",
- "ai_helper_markdown_tables_persona",
- "ai_helper_custom_prompt_persona",
- "ai_helper_image_caption_persona",
- "ai_helper_chat_thread_title_persona",
+ "ai_helper_proofreader_agent",
+ "ai_helper_title_suggestions_agent",
+ "ai_helper_explain_agent",
+ "ai_helper_post_illustrator_agent",
+ "ai_helper_smart_dates_agent",
+ "ai_helper_translator_agent",
+ "ai_helper_markdown_tables_agent",
+ "ai_helper_custom_prompt_agent",
+ "ai_helper_image_caption_agent",
+ "ai_helper_chat_thread_title_agent",
],
},
],
@@ -74,7 +74,7 @@ export const AI_FEATURE_SETTING_GROUPS = {
"ai_embeddings_semantic_search_enabled",
"ai_embeddings_semantic_search_use_hyde",
"ai_embeddings_semantic_quick_search_enabled",
- "ai_embeddings_semantic_search_hyde_persona",
+ "ai_embeddings_semantic_search_hyde_agent",
],
},
],
@@ -116,14 +116,14 @@ export const AI_FEATURE_SETTING_GROUPS = {
titleKey: "discourse_ai.features.summarization.setting_groups.settings",
settings: [
"ai_summarization_enabled",
- "ai_summarization_persona",
+ "ai_summarization_agent",
"ai_pm_summarization_allowed_groups",
],
},
{
key: "gists",
titleKey: "discourse_ai.features.summarization.setting_groups.gists",
- settings: ["ai_summary_gists_enabled", "ai_summary_gists_persona"],
+ settings: ["ai_summary_gists_enabled", "ai_summary_gists_agent"],
},
{
key: "backfill",
@@ -140,7 +140,7 @@ export const AI_FEATURE_SETTING_GROUPS = {
{
key: "settings",
titleKey: "discourse_ai.features.search.setting_groups.settings",
- settings: ["ai_discover_enabled", "ai_discover_persona"],
+ settings: ["ai_discover_enabled", "ai_discover_agent"],
},
],
@@ -151,13 +151,13 @@ export const AI_FEATURE_SETTING_GROUPS = {
settings: ["ai_translation_enabled"],
},
{
- key: "personas",
- titleKey: "discourse_ai.features.translation.setting_groups.personas",
+ key: "agents",
+ titleKey: "discourse_ai.features.translation.setting_groups.agents",
settings: [
- "ai_translation_locale_detector_persona",
- "ai_translation_post_raw_translator_persona",
- "ai_translation_topic_title_translator_persona",
- "ai_translation_short_text_translator_persona",
+ "ai_translation_locale_detector_agent",
+ "ai_translation_post_raw_translator_agent",
+ "ai_translation_topic_title_translator_agent",
+ "ai_translation_short_text_translator_agent",
],
},
{
@@ -183,7 +183,7 @@ export const AI_FEATURE_SETTING_GROUPS = {
settings: [
"ai_discord_search_enabled",
"ai_discord_search_mode",
- "ai_discord_search_persona",
+ "ai_discord_search_agent",
],
},
{
@@ -225,12 +225,12 @@ export const AI_FEATURE_SETTING_GROUPS = {
],
},
{
- key: "personas",
- titleKey: "discourse_ai.features.inference.setting_groups.personas",
+ key: "agents",
+ titleKey: "discourse_ai.features.inference.setting_groups.agents",
settings: [
- "inferred_concepts_generate_persona",
- "inferred_concepts_match_persona",
- "inferred_concepts_deduplicate_persona",
+ "inferred_concepts_generate_agent",
+ "inferred_concepts_match_agent",
+ "inferred_concepts_deduplicate_agent",
],
},
],
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/services/ai-bot-conversations-hidden-submit.js b/plugins/discourse-ai/assets/javascripts/discourse/services/ai-bot-conversations-hidden-submit.js
index e818c9c8a06..188f9dc167c 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/services/ai-bot-conversations-hidden-submit.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/services/ai-bot-conversations-hidden-submit.js
@@ -15,7 +15,7 @@ export default class AiBotConversationsHiddenSubmit extends Service {
@tracked loading = false;
- personaId;
+ agentId;
targetUsername;
inputValue = "";
@@ -76,7 +76,9 @@ export default class AiBotConversationsHiddenSubmit extends Service {
title,
archetype: "private_message",
target_recipients: this.targetUsername,
- meta_data: { ai_persona_id: this.personaId },
+ meta_data: {
+ ai_agent_id: this.agentId,
+ },
},
});
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/services/ai-credits.js b/plugins/discourse-ai/assets/javascripts/discourse/services/ai-credits.js
index 4b2f73b4d57..e3136fb3a2b 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/services/ai-credits.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/services/ai-credits.js
@@ -15,14 +15,14 @@ export default class AiCredits extends Service {
#pendingRequests = new Map();
/**
- * Check credit status for specific persona IDs.
+ * Check credit status for specific agent IDs.
*
- * @param {number[]} personaIds - Array of persona IDs to check
- * @returns {Promise<Object>} - Credit status keyed by persona_id
+ * @param {number[]} agentIds - Array of agent IDs to check
+ * @returns {Promise<Object>} - Credit status keyed by agent_id
*/
- async checkPersonaCredits(personaIds) {
- const result = await this.#fetchStatus({ persona_ids: personaIds });
- return result.personas || {};
+ async checkAgentCredits(agentIds) {
+ const result = await this.#fetchStatus({ agent_ids: agentIds });
+ return result.agents || {};
}
/**
@@ -37,14 +37,14 @@ export default class AiCredits extends Service {
}
/**
- * Check if a specific persona has credits available.
+ * Check if a specific agent has credits available.
*
- * @param {number} personaId - The persona ID to check
+ * @param {number} agentId - The agent ID to check
* @returns {Promise<boolean>} - True if credits are available
*/
- async isPersonaCreditAvailable(personaId) {
- const result = await this.checkPersonaCredits([personaId]);
- const status = result[personaId];
+ async isAgentCreditAvailable(agentId) {
+ const result = await this.checkAgentCredits([agentId]);
+ const status = result[agentId];
return status?.credit_status?.available ?? true;
}
@@ -61,14 +61,14 @@ export default class AiCredits extends Service {
}
/**
- * Get detailed credit status for a persona.
+ * Get detailed credit status for a agent.
*
- * @param {number} personaId - The persona ID
+ * @param {number} agentId - The agent ID
* @returns {Promise<Object|null>} - Full credit status object or null
*/
- async getPersonaCreditStatus(personaId) {
- const result = await this.checkPersonaCredits([personaId]);
- return result[personaId]?.credit_status || null;
+ async getAgentCreditStatus(agentId) {
+ const result = await this.checkAgentCredits([agentId]);
+ return result[agentId]?.credit_status || null;
}
/**
@@ -128,7 +128,7 @@ export default class AiCredits extends Service {
*
* @private
* @param {Object} params - Request parameters
- * @param {number[]} [params.persona_ids] - Array of persona IDs to check
+ * @param {number[]} [params.agent_ids] - Array of agent IDs to check
* @param {string[]} [params.features] - Array of feature names to check
* @param {number[]} [params.llm_model_ids] - Array of LLM model IDs to check
* @returns {Promise<Object>} Promise resolving to credit status object
diff --git a/plugins/discourse-ai/assets/stylesheets/common/ai-features.scss b/plugins/discourse-ai/assets/stylesheets/common/ai-features.scss
index 8ed48879b7d..0a987a2a838 100644
--- a/plugins/discourse-ai/assets/stylesheets/common/ai-features.scss
+++ b/plugins/discourse-ai/assets/stylesheets/common/ai-features.scss
@@ -43,7 +43,7 @@
}
&__llm,
- &__persona,
+ &__agent,
&__groups {
font-size: var(--font-down-1-rem);
display: flex;
@@ -52,11 +52,11 @@
color: var(--primary-high);
}
- &__persona {
+ &__agent {
@include ellipsis;
}
- &__persona-link,
+ &__agent-link,
&__llm-link {
padding: 0;
margin-right: var(--space-1);
diff --git a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/common.scss b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/common.scss
index 3420a04af91..af2ece13445 100644
--- a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/common.scss
+++ b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/common.scss
@@ -139,7 +139,7 @@ body.has-ai-conversations-sidebar {
flex-direction: column;
height: calc(100dvh - var(--header-offset) - 5em);
- .persona-llm-selector {
+ .agent-llm-selector {
display: flex;
gap: 0.5em;
justify-content: flex-start;
diff --git a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/ai-persona.scss b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/ai-agent.scss
similarity index 94%
rename from plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/ai-persona.scss
rename to plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/ai-agent.scss
index b8842554c72..07f50bd5496 100644
--- a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/ai-persona.scss
+++ b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/ai-agent.scss
@@ -1,17 +1,17 @@
@use "lib/viewport";
-.admin-contents .ai-persona-list-editor {
+.admin-contents .ai-agent-list-editor {
margin-top: 0;
}
-.ai-persona-list-editor {
+.ai-agent-list-editor {
@include viewport.until(md) {
td {
border: none;
padding: 0;
- &.ai-persona-list__llms,
- &.ai-persona-list__features {
+ &.ai-agent-list__llms,
+ &.ai-agent-list__features {
padding-block: 0;
.--card-label {
@@ -102,11 +102,11 @@
border-radius: var(--d-border-radius);
.d-table__cell.--overview,
- .ai-persona-list__name-with-description {
+ .ai-agent-list__name-with-description {
display: contents;
}
- .ai-persona-list__name {
+ .ai-agent-list__name {
grid-row: 1;
grid-column: 1;
font-size: var(--font-up-1);
@@ -120,7 +120,7 @@
}
}
- .ai-persona-list__description {
+ .ai-agent-list__description {
grid-row: 2;
grid-column: 1;
margin: var(--space-2) 0;
@@ -131,7 +131,7 @@
grid-column: 2;
}
- .ai-persona-list__features {
+ .ai-agent-list__features {
grid-row: 4;
grid-column: 1 / span 2;
padding: 0;
@@ -141,7 +141,7 @@
}
}
- .ai-persona-list__llms {
+ .ai-agent-list__llms {
grid-row: 3;
grid-column: 1 / span 2;
padding: 0;
@@ -158,7 +158,7 @@
}
}
- .ai-persona-list {
+ .ai-agent-list {
&__row-item-feature {
padding: 0;
text-align: left;
@@ -191,12 +191,12 @@
}
}
- .ai-persona-list__feature-list {
+ .ai-agent-list__feature-list {
color: var(--primary-medium);
}
}
-.ai-persona-tool-option-editor {
+.ai-agent-tool-option-editor {
&__instructions {
color: var(--primary-medium);
font-size: var(--font-down-1);
@@ -204,7 +204,7 @@
}
}
-.ai-personas__container {
+.ai-agents__container {
display: flex;
flex-direction: row;
align-items: center;
@@ -212,7 +212,7 @@
width: 100%;
}
-.ai-persona-editor {
+.ai-agent-editor {
padding-left: 0.5em;
.select-kit.multi-select.is-disabled {
diff --git a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/bot-replies.scss b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/bot-replies.scss
index f45d603a1eb..c6280cd6105 100644
--- a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/bot-replies.scss
+++ b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/bot-replies.scss
@@ -32,14 +32,14 @@ article.streaming {
}
@include viewport.until(sm) {
- .persona-flair {
+ .agent-flair {
display: none;
}
}
}
.ai-bot-pm {
- .gpt-persona {
+ .gpt-agent {
margin-bottom: 5px;
}
@@ -86,7 +86,7 @@ article.streaming {
}
}
-.topic-body .persona-flair {
+.topic-body .agent-flair {
order: 2;
font-size: var(--font-down-1);
transform: translateY(0.04em);
diff --git a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/mobile/ai-persona.scss b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/mobile/ai-agent.scss
similarity index 81%
rename from plugins/discourse-ai/assets/stylesheets/modules/ai-bot/mobile/ai-persona.scss
rename to plugins/discourse-ai/assets/stylesheets/modules/ai-bot/mobile/ai-agent.scss
index 6353f5267b6..94e322d12ce 100644
--- a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/mobile/ai-persona.scss
+++ b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/mobile/ai-agent.scss
@@ -1,4 +1,4 @@
-.ai-persona-editor {
+.ai-agent-editor {
&__system_prompt,
&__description,
.select-kit.multi-select {
diff --git a/plugins/discourse-ai/assets/stylesheets/modules/llms/common/ai-llms-editor.scss b/plugins/discourse-ai/assets/stylesheets/modules/llms/common/ai-llms-editor.scss
index 363ee852fcf..15cbb46cbc4 100644
--- a/plugins/discourse-ai/assets/stylesheets/modules/llms/common/ai-llms-editor.scss
+++ b/plugins/discourse-ai/assets/stylesheets/modules/llms/common/ai-llms-editor.scss
@@ -66,7 +66,7 @@
}
.ai-tool-list-editor__current,
-.ai-persona-list-editor__current,
+.ai-agent-list-editor__current,
.ai-llms-list-editor__configured {
.d-table {
@include viewport.from(md) {
diff --git a/plugins/discourse-ai/assets/stylesheets/modules/llms/common/spam.scss b/plugins/discourse-ai/assets/stylesheets/modules/llms/common/spam.scss
index e8009419ed0..75a7f9262a1 100644
--- a/plugins/discourse-ai/assets/stylesheets/modules/llms/common/spam.scss
+++ b/plugins/discourse-ai/assets/stylesheets/modules/llms/common/spam.scss
@@ -24,14 +24,14 @@
&__toggle,
&__llm,
- &__persona,
+ &__agent,
&__instructions {
margin-bottom: 1em;
}
&__toggle-label,
&__llm-label,
- &__persona-label,
+ &__agent-label,
&__instructions-label {
display: block;
margin-bottom: 0.5em;
diff --git a/plugins/discourse-ai/config/locales/client.en.yml b/plugins/discourse-ai/config/locales/client.en.yml
index cddae9cb678..85d5a326c88 100644
--- a/plugins/discourse-ai/config/locales/client.en.yml
+++ b/plugins/discourse-ai/config/locales/client.en.yml
@@ -6,8 +6,8 @@ en:
descriptions:
discourse_ai:
search: "Allows AI search"
- stream_completion: "Allows streaming AI persona completions"
- update_personas: "Allows updating AI personas"
+ stream_completion: "Allows streaming AI agent completions"
+ update_agents: "Allows updating AI agents"
manage_artifacts: "Allows managing AI artifacts (list, view, create, update, delete)"
site_settings:
@@ -31,9 +31,9 @@ en:
create_ai_llm_model: "Create LLM model"
update_ai_llm_model: "Update LLM model"
delete_ai_llm_model: "Delete LLM model"
- create_ai_persona: "Create AI persona"
- update_ai_persona: "Update AI persona"
- delete_ai_persona: "Delete AI persona"
+ create_ai_agent: "Create AI agent"
+ update_ai_agent: "Update AI agent"
+ delete_ai_agent: "Delete AI agent"
create_ai_tool: "Create AI tool"
update_ai_tool: "Update AI tool"
delete_ai_tool: "Delete AI tool"
@@ -110,9 +110,9 @@ en:
top_p:
label: "Top P"
description: "Top P to use for the LLM, increase to increase randomness (leave empty to use model default)"
- persona_id:
- label: "Persona"
- description: "AI Persona to use for report generation"
+ agent_id:
+ label: "Agent"
+ description: "AI agent to use for report generation"
ai_tool_action:
fields:
@@ -123,22 +123,22 @@ en:
label: "LLM Model"
description: "Language model for tools that use llm.generate() (optional)"
- llm_persona_triage:
+ llm_agent_triage:
fields:
- persona:
- label: "Persona"
- description: "AI Persona to use for triage (must have default LLM and User set)"
+ agent:
+ label: "Agent"
+ description: "AI agent to use for triage (must have default LLM and User set)"
whisper:
label: "Reply as Whisper"
- description: "Whether the persona's response should be a whisper"
+ description: "Whether the agent's response should be a whisper"
silent_mode:
label: "Silent Mode"
- description: "In silent mode persona will receive the content but will not post anything on the forum - useful when performing triage using tools"
+ description: "In silent mode the agent will receive the content but will not post anything on the forum - useful when performing triage using tools"
llm_triage:
fields:
- triage_persona:
- label: "Persona"
- description: "Persona used to triage, be sure for it to reply with a single word you can use to trigger the action"
+ triage_agent:
+ label: "Agent"
+ description: "Agent used to triage, be sure for it to reply with a single word you can use to trigger the action"
max_post_tokens:
label: "Max Post Tokens"
description: "The maximum number of tokens to scan using LLM triage"
@@ -184,9 +184,9 @@ en:
whisper:
label: "Reply as Whisper"
description: "Whether the AI's response should be a whisper"
- reply_persona:
- label: "Reply Persona"
- description: "AI Persona to use for replies (must have default LLM), will be prioritized over canned reply"
+ reply_agent:
+ label: "Reply Agent"
+ description: "AI agent to use for replies (must have default LLM), will be prioritized over canned reply"
max_output_tokens:
label: "Max output tokens"
description: "When specified, sets an upper bound to the maximum number of tokens the model can generate. Respects LLM's max output tokens limit"
@@ -195,9 +195,9 @@ en:
manual: "Use specific tag list (configured below)"
discover: "Let AI discover and use any site tags"
fields:
- tagger_persona:
- label: "AI Persona"
- description: "The AI persona to use for analyzing and tagging topics"
+ tagger_agent:
+ label: "AI Agent"
+ description: "The AI agent to use for analyzing and tagging topics"
tag_mode:
label: "Tag Selection Mode"
description: "Choose how the AI selects tags"
@@ -228,7 +228,7 @@ en:
default_llm:
title: "Default LLM model"
- description: "The default LLM model to use for all AI features. This will be used if no LLM is specified in the feature configuration or persona. If no default LLM is specified, the last created LLM will be used."
+ description: "The default LLM model to use for all AI features. This will be used if no LLM is specified in the feature configuration or agent. If no default LLM is specified, the last created LLM will be used."
llm_selector:
none: "None"
@@ -236,19 +236,19 @@ en:
features:
short_title: "Features"
- description: "These are the AI features available to visitors on your site. These can be configured to use specific personas and LLMs, and can be access controlled by groups."
+ description: "These are the AI features available to visitors on your site. These can be configured to use specific agents and LLMs, and can be access controlled by groups."
back: "Back"
settings_save_error: "Some settings could not be saved."
disabled: "(disabled)"
- persona:
- one: "Persona:"
- other: "Personas:"
+ agent:
+ one: "Agent:"
+ other: "Agents:"
groups: "Groups:"
llm:
one: "LLM:"
other: "LLMs:"
no_llm: "No LLM selected"
- no_persona: "Not set"
+ no_agent: "Not set"
no_groups: "None"
edit: "Settings"
expand_list:
@@ -269,7 +269,7 @@ en:
unconfigured: "Unconfigured"
filters:
all: "All"
- text: "Search features, personas, LLMs, or groups..."
+ text: "Search features, agents, LLMs, or groups..."
no_results: "No features found matching your filters."
reset: "Reset"
@@ -315,7 +315,7 @@ en:
settings: "Basic Settings"
topic_criteria: "Topic Criteria"
post_criteria: "Post Criteria"
- personas: "Personas"
+ agents: "Agents"
ai_helper:
name: "Helper"
@@ -336,7 +336,7 @@ en:
access_permissions: "Access & Permissions"
enabled_features: "Enabled Features"
automation: "Automation"
- personas: "Personas"
+ agents: "Agents"
translation:
name: "Translation"
@@ -352,7 +352,7 @@ en:
schedule_topic_error: "Failed to schedule translations. Please try again."
setting_groups:
settings: "Basic Settings"
- personas: "Personas"
+ agents: "Agents"
backfill_and_limits: "Backfill & Limits"
spam:
@@ -417,7 +417,7 @@ en:
short_title: "Spam"
title: "Configure spam handling"
select_llm: "Select LLM"
- select_persona: "Select persona"
+ select_agent: "Select agent"
custom_instructions: "Custom instructions"
custom_instructions_help: "Custom instructions specific to your site to help guide the AI in identifying spam, e.g. 'Be more aggressive about scanning posts not in English'."
last_seven_days: "Last 7 days"
@@ -505,7 +505,7 @@ en:
custom: "Custom..."
credit_allocations: "Credit allocations"
- ai_persona:
+ ai_agent:
ai_tools: "Tools"
tool_strategies:
all: "Apply to all replies"
@@ -517,15 +517,15 @@ en:
edit: "Edit"
export: "Export"
import: "Import"
- import_error_conflict: "Conflict detected importing %{name}, would you like to update the existing persona?"
+ import_error_conflict: "Conflict detected importing %{name}, would you like to update the existing agent?"
overwrite: "Overwrite"
description: "Description"
no_llm_selected: "No language model selected"
- use_parent_llm: "Use persona's language model"
+ use_parent_llm: "Use agent's language model"
max_context_posts: "Max context posts"
max_context_posts_help: "The maximum number of posts to use as context for the AI when responding to a user. (empty for default)"
execution_mode: "Execution Mode"
- execution_mode_help: "Controls how the persona manages tool execution and conversation context. Default uses fixed turn/tool limits. Agentic uses a token budget with automatic context compression for longer, more capable tool-use sessions."
+ execution_mode_help: "Controls how the agent manages tool execution and conversation context. Default uses fixed turn/tool limits. Agentic uses a token budget with automatic context compression for longer, more capable tool-use sessions."
execution_mode_options:
default: "Default (Fixed Limits)"
agentic: "Agentic (Token Budget)"
@@ -543,27 +543,27 @@ en:
show_thinking: Show thinking
show_thinking_help: Will show end users the internal thinking and tool calls of the language model.
mentionable: Allow mentions
- mentionable_help: If enabled, users in allowed groups can mention this user in posts, the AI will respond as this persona.
+ mentionable_help: If enabled, users in allowed groups can mention this user in posts, the AI will respond as this agent.
user: User
create_user: Create user
- create_user_help: You can optionally attach a user to this persona. If you do, the AI will use this user to respond to requests.
+ create_user_help: You can optionally attach a user to this agent. If you do, the AI will use this user to respond to requests.
default_llm: Default language model
- default_llm_help: The default language model to use for this persona. Required if you wish to mention persona on public posts.
+ default_llm_help: The default language model to use for this agent. Required if you wish to mention the agent on public posts.
question_consolidator_llm: Language Model for Question Consolidator
question_consolidator_llm_help: The language model to use for the question consolidator, you may choose a less powerful model to save costs.
system_prompt: System prompt
forced_tool_strategy: Forced tool strategy
allow_chat_direct_messages: "Allow chat direct messages"
- allow_chat_direct_messages_help: "If enabled, users in allowed groups can send direct messages to this persona."
+ allow_chat_direct_messages_help: "If enabled, users in allowed groups can send direct messages to this agent."
allow_chat_channel_mentions: "Allow chat channel mentions"
- allow_chat_channel_mentions_help: "If enabled, users in allowed groups can mention this persona in chat channels."
+ allow_chat_channel_mentions_help: "If enabled, users in allowed groups can mention this agent in chat channels."
allow_personal_messages: "Allow personal messages"
- allow_personal_messages_help: "If enabled, users in allowed groups can send personal messages to this persona."
+ allow_personal_messages_help: "If enabled, users in allowed groups can send personal messages to this agent."
allow_topic_mentions: "Allow topic mentions"
- allow_topic_mentions_help: "If enabled, users in allowed groups can mention this persona in topics."
+ allow_topic_mentions_help: "If enabled, users in allowed groups can mention this agent in topics."
force_default_llm: "Always use default language model"
save: "Save"
- saved: "Persona saved"
+ saved: "Agent saved"
enabled: "Enabled?"
tools: "Enabled tools"
tokens: "tokens"
@@ -573,25 +573,25 @@ en:
tool_severity_high: "High capacity"
tool_severity_too_many: "Too many tools"
tool_tokens_warning: "Excess tools degrade AI performance by taking up valuable conversation memory. Consider removing non-essential tools."
- tool_count_warning: "Each tool's definition is sent to the model on every request. Having many tools increases token usage and can confuse the model, leading to worse tool selection. Only keep tools this persona actually needs."
+ tool_count_warning: "Each tool's definition is sent to the model on every request. Having many tools increases token usage and can confuse the model, leading to worse tool selection. Only keep tools this agent actually needs."
forced_tools: "Forced tools"
allowed_groups: "Allowed groups"
- confirm_delete: "Are you sure you want to delete this persona?"
- new: "New persona"
- no_personas: "You have not created any personas yet"
- title: "Personas"
- short_title: "Personas"
+ confirm_delete: "Are you sure you want to delete this agent?"
+ new: "New agent"
+ no_agents: "You have not created any agents yet"
+ title: "Agents"
+ short_title: "Agents"
delete: "Delete"
temperature: "Temperature"
temperature_help: "Temperature to use for the LLM. Increase to increase creativity (leave empty to use model default, generally a value from 0.0 to 2.0)"
top_p: "Top P"
top_p_help: "Top P to use for the LLM, increase to increase randomness (leave empty to use model default, generally a value from 0.0 to 1.0)"
priority: "Priority"
- priority_help: "Priority personas are displayed to users at the top of the persona list. If multiple personas have priority, they will be sorted alphabetically."
+ priority_help: "Priority agents are displayed to users at the top of the agent list. If multiple agents have priority, they will be sorted alphabetically."
tool_options: "Tool options"
rag_conversation_chunks: "Search conversation chunks"
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."
- 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."
+ agent_description: "Agents 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."
response_format:
title: "JSON response format"
no_format: "No JSON format specified"
@@ -613,12 +613,12 @@ en:
ai_bot:
title: "AI bot options"
- save_first: "More AI bot options will become available once you save the persona."
+ save_first: "More AI bot options will become available once you save the agent."
filters:
- text: "Find a persona"
+ text: "Find an agent"
reset: "Reset"
- no_results: "No personas found matching your filters."
+ no_results: "No agents found matching your filters."
all_features: "Any feature"
features_list:
@@ -662,7 +662,7 @@ en:
name_help: "Name will show up in the Discourse UI and is the short identifier you will use to find the tool in various settings, it should be distinct (it is required)"
new: "New tool"
tool_name: "Tool Name"
- tool_name_help: "Tool Name is presented to the large language model. It is not distinct, but it is distinct per persona. (persona validates on save)"
+ tool_name_help: "Tool Name is presented to the large language model. It is not distinct, but it is distinct per agent. (agent validates on save)"
description: "Description"
description_help: "A clear description of the tool's purpose for the language model"
subheader_description: "Tools extend the capabilities of AI bots with user-defined JavaScript functions."
@@ -777,13 +777,13 @@ en:
next_reset: "Credits reset on %{time}"
usage:
ai_bot: "AI bot"
- ai_helper: "Helper (%{persona})"
+ ai_helper: "Helper (%{agent})"
ai_helper_image_caption: "Image caption"
- ai_persona: "Persona (%{persona})"
+ ai_agent: "Agent (%{agent})"
ai_summarization: "Summarize"
ai_embeddings_semantic_search: "AI search"
ai_spam: "Spam"
- automation: "Automation (%{persona})"
+ automation: "Automation (%{agent})"
in_use_warning:
one: "This model is currently used by %{settings}. If misconfigured, the feature won't work as expected."
other: "This model is currently used by the following: %{settings}. If misconfigured, features won't work as expected. "
@@ -1019,7 +1019,7 @@ en:
click_to_run_label: "Run Artifact"
ai_bot:
- persona: "Persona"
+ agent: "Agent"
llm: "Model"
pm_warning: "AI chatbot messages are monitored regularly by moderators."
cancel_streaming: "Stop reply"
diff --git a/plugins/discourse-ai/config/locales/client.en_GB.yml b/plugins/discourse-ai/config/locales/client.en_GB.yml
index c2a0d3d6ecd..89627760d66 100644
--- a/plugins/discourse-ai/config/locales/client.en_GB.yml
+++ b/plugins/discourse-ai/config/locales/client.en_GB.yml
@@ -15,7 +15,7 @@ en_GB:
discourse_ai:
usage:
summary: "Summary"
- ai_persona:
+ ai_agent:
description: "Description"
tools:
description: "Description"
diff --git a/plugins/discourse-ai/config/locales/server.en.yml b/plugins/discourse-ai/config/locales/server.en.yml
index 7066ac8ab7f..e5b00f68afe 100644
--- a/plugins/discourse-ai/config/locales/server.en.yml
+++ b/plugins/discourse-ai/config/locales/server.en.yml
@@ -24,9 +24,9 @@ en:
ai_tool_action:
title: AI Tool Action
description: Execute an AI tool when the automation triggers
- llm_persona_triage:
- title: Triage posts using AI Persona
- description: "Respond to posts using a specific AI persona"
+ llm_agent_triage:
+ title: Triage posts using AI Agent
+ description: "Respond to posts using a specific AI agent"
llm_triage:
title: Triage posts using AI
description: "Triage posts using a large language model"
@@ -95,8 +95,8 @@ en:
ai_helper_automatic_chat_thread_title: "Automatically set the chat thread titles based on thread contents."
ai_helper_enabled_features: "Select the features to enable in the AI helper."
post_ai_helper_allowed_groups: "User groups allowed to access AI Helper features in posts"
- ai_helper_post_illustrator_persona: "The persona to use for the AI helper's illustrate post feature. Note: you must also create an image generation tool (Admin > Plugins > Discourse AI > Tools) for this feature to work."
- ai_helper_chat_thread_title_persona: "The persona to use for generating chat thread titles."
+ ai_helper_post_illustrator_agent: "The agent to use for the AI helper's illustrate post feature. Note: you must also create an image generation tool (Admin > Plugins > Discourse AI > Tools) for this feature to work."
+ ai_helper_chat_thread_title_agent: "The agent to use for generating chat thread titles."
ai_embeddings_selected_model: "Use the selected model for generating embeddings."
ai_embeddings_generate_for_pms: "Generate embeddings for personal messages."
@@ -112,7 +112,7 @@ en:
ai_embeddings_per_post_enabled: Generate embeddings for each post
ai_summarization_enabled: "Enable the summarize feature"
- ai_summarization_persona: "Persona to use for summarize feature"
+ ai_summarization_agent: "Agent to use for summarize feature"
ai_pm_summarization_allowed_groups: "Groups allowed to create and view summaries in PMs."
ai_summary_gists_enabled: "Generate brief summaries of latest replies in topics automatically"
ai_summary_backfill_maximum_topics_per_hour: "Number of topic summaries to backfill per hour."
@@ -128,7 +128,7 @@ en:
ai_bot_github_access_token: "GitHub access token for use with GitHub AI tools (required for search support)"
ai_discover_enabled: "Enable the discovery search feature"
- ai_discover_persona: "Persona to use for discovery search feature"
+ ai_discover_agent: "Agent to use for discovery search feature"
ai_google_custom_search_api_key: "API key for the Google Custom Search API see: https://developers.google.com/custom-search"
ai_google_custom_search_cx: "CX for Google Custom Search API"
@@ -137,7 +137,7 @@ en:
ai_discord_app_id: "The ID of the Discord application you would like to connect Discord search to"
ai_discord_app_public_key: "The public key of the Discord application you would like to connect Discord search to"
ai_discord_search_mode: "Select the search mode to use for Discord search"
- ai_discord_search_persona: "The persona to use for Discord search."
+ ai_discord_search_agent: "The agent to use for Discord search."
ai_discord_allowed_guilds: "Discord guilds (servers) where the bot is allowed to search"
ai_translation_enabled: "Enable the AI translation feature"
@@ -309,8 +309,8 @@ en:
ai_helper:
errors:
completion_request_failed: "Something went wrong while trying to provide suggestions. Please, try again."
- no_illustrator_persona: "Post Illustrator persona is not configured. Please check your site settings."
- no_image_generation_tool: "Post Illustrator persona must have an image generation tool attached. Please configure an image generation tool for this persona in the admin panel."
+ no_illustrator_agent: "Post Illustrator agent is not configured. Please check your site settings."
+ no_image_generation_tool: "Post Illustrator agent must have an image generation tool attached. Please configure an image generation tool for this agent in the admin panel."
no_image_generated: "Failed to generate image. Please try again or check your tool configuration."
llm_model_not_configured: "No language model is configured for image generation. Please configure a default language model in your site settings."
unknown_error: "An unexpected error occurred while generating thumbnails. Please try again."
@@ -350,10 +350,10 @@ en:
reply_error: "Sorry, it looks like our system encountered an unexpected issue while trying to reply.\n\n[details='Error details']\n%{details}\n[/details]"
default_pm_prefix: "[Untitled AI bot PM]"
thinking: "Thinking"
- personas:
+ agents:
default_llm_required: "Default LLM model is required prior to enabling Chat"
- cannot_delete_system_persona: "System personas cannot be deleted, please disable it instead"
- cannot_edit_system_persona: "System personas can only be renamed, you may not edit tools or system prompt, instead disable and make a copy"
+ cannot_delete_system_agent: "System agents cannot be deleted, please disable it instead"
+ cannot_edit_system_agent: "System agents can only be renamed, you may not edit tools or system prompt, instead disable and make a copy"
cannot_have_duplicate_tools: "Can not have duplicate tools"
github_helper:
name: "GitHub Helper"
@@ -393,10 +393,10 @@ en:
description: "AI Bot specialized in creating interactive web artifacts"
summarizer:
name: "Summarizer"
- description: "Default persona used to power AI summaries"
+ description: "Default agent used to power AI summaries"
short_summarizer:
name: "Summarizer (short form)"
- description: "Default persona used to power AI short summaries for topic lists' items"
+ description: "Default agent used to power AI short summaries for topic lists' items"
concept_finder:
name: "Concept Finder"
description: "AI Bot specialized in identifying concepts and themes in content"
@@ -408,31 +408,31 @@ en:
description: "AI Bot specialized in deduplicating concepts"
custom_prompt:
name: "Custom prompt"
- description: "Default persona powering the Helper's custom prompt feature"
+ description: "Default agent powering the Helper's custom prompt feature"
smart_dates:
name: "Smart dates"
- description: "Default persona powering the Helper's smart dates feature"
+ description: "Default agent powering the Helper's smart dates feature"
markdown_table_generator:
name: "Markdown table generator"
- description: "Default persona powering the Helper's generate Markdown table feature"
+ description: "Default agent powering the Helper's generate Markdown table feature"
post_illustrator:
name: "Post illustrator"
description: "Generates images to illustrate posts using available image generation tools"
proofreader:
name: "Proofreader"
- description: "Default persona powering the Helper's proofread text feature"
+ description: "Default agent powering the Helper's proofread text feature"
titles_generator:
name: "Titles generator"
- description: "Default persona powering the Helper's suggest topic titles feature"
+ description: "Default agent powering the Helper's suggest topic titles feature"
tutor:
name: "Tutor"
- description: "Default persona powering the Helper's explain feature"
+ description: "Default agent powering the Helper's explain feature"
translator:
name: "Translator"
- description: "Default persona powering the Helper's translator feature"
+ description: "Default agent powering the Helper's translator feature"
image_captioner:
name: "Image captions"
- description: "Default persona powering the Helper's image caption feature"
+ description: "Default agent powering the Helper's image caption feature"
locale_detector:
name: "Locale detector"
description: "Powers the translation feature by detecting the locale of a given text (posts, titles, etc.)"
@@ -447,19 +447,19 @@ en:
description: "Powers the translation feature by as a generic text translator, used for short texts like category names or tags"
spam_detector:
name: "Spam detector"
- description: "Default persona powering our Spam detection feature"
+ description: "Default agent powering our Spam detection feature"
content_creator:
name: "Content creator"
- description: "Default persona powering HyDE search"
+ description: "Default agent powering HyDE search"
report_runner:
name: "Report runner"
- description: "Default persona used in the report automation script"
+ description: "Default agent used in the report automation script"
discover:
name: "Discover"
- description: "Default persona used in the discoveries feature (complimentary search)"
+ description: "Default agent used in the discoveries feature (complimentary search)"
chat_thread_titler:
name: "Chat Thread Titler"
- description: "Default persona powering automatic chat thread title generation"
+ description: "Default agent powering automatic chat thread title generation"
topic_not_found: "Summary unavailable, topic not found!"
summarizing: "Summarizing topic"
@@ -468,7 +468,7 @@ en:
researcher:
researcher_llm:
name: "LLM"
- description: "Language model to use for research (default to current persona's LLM)"
+ description: "Language model to use for research (default to current agent's LLM)"
max_tokens_per_batch:
name: "Maximum tokens per batch"
description: "Maximum number of tokens to use for each batch in the research"
@@ -808,7 +808,7 @@ en:
set_llm_first: "Set %{setting} first"
model_unreachable: "We couldn't get a response from this model. Check your settings first."
invalid_seeded_model: "You can't use this model with this feature"
- invalid_persona_response_format: "The selected persona must have a response format with a boolean field names \"spam\""
+ invalid_agent_response_format: "The selected agent must have a response format with a boolean field names \"spam\""
must_select_model: "You must select a LLM first"
invalid_llm_id: "The selected LLM model is not valid"
endpoints:
@@ -822,7 +822,7 @@ en:
other: "We couldn't delete this model because %{settings} are using it. Update the settings and try again."
cannot_edit_builtin: "You can't edit a built-in model."
- personas:
+ agents:
malformed_examples: "The given examples have the wrong format."
embeddings:
@@ -863,12 +863,12 @@ en:
quota_exceeded: "You have exceeded the quota for this model. Please try again in %{relative_time}."
quota_required: "You must specify maximum tokens or usages for this model"
no_query_specified: The query parameter is required, please specify it.
- no_user_for_persona: The persona specified does not have a user associated with it.
- persona_not_found: The persona specified does not exist. Check the persona_name or persona_id params.
+ no_user_for_agent: The agent specified does not have a user associated with it.
+ agent_not_found: "The agent specified does not exist. Check the agent_name or agent_id params (legacy: agent_name or agent_id)."
no_user_specified: The username or the user_unique_id parameter is required, please specify it.
user_not_found: The user specified does not exist. Check the username param.
- persona_disabled: The persona specified is disabled. Check the persona_name or persona_id params.
- no_default_llm: The persona must have a default_llm defined.
+ agent_disabled: "The agent specified is disabled. Check the agent_name or agent_id params (legacy: agent_name or agent_id)."
+ no_default_llm: The agent must have a default_llm defined.
user_not_allowed: The user is not allowed to participate in the topic.
invalid_stream_resume_token: The resume_token is invalid or has expired.
no_tool_results_specified: The tool_results parameter is required when resuming a stream.
@@ -891,7 +891,7 @@ en:
stream_reply_state_too_large: "The stream state is too large to persist (max %{max} bytes)."
stream_reply_unexpected_error: An unexpected error occurred while streaming the reply.
prompt_message_length: The message %{idx} is over the 1000 character limit.
- persona_already_exists: Persona with the name %{name} already exists.
+ agent_already_exists: Agent with the name %{name} already exists.
custom_tool_exists:
one: "Custom tool with the name %{names} already exists."
other: "Custom tools with the names %{names} already exist."
diff --git a/plugins/discourse-ai/config/routes.rb b/plugins/discourse-ai/config/routes.rb
index 8610be057b1..d3fcfa5f2eb 100644
--- a/plugins/discourse-ai/config/routes.rb
+++ b/plugins/discourse-ai/config/routes.rb
@@ -84,6 +84,10 @@ Discourse::Application.routes.draw do
:constraints => StaffConstraint.new
scope "/admin/plugins/discourse-ai", constraints: AdminConstraint.new do
+ get "/ai-personas", to: redirect("/admin/plugins/discourse-ai/ai-agents")
+ get "/ai-personas/new", to: redirect("/admin/plugins/discourse-ai/ai-agents/new")
+ get "/ai-personas/:id/edit", to: redirect("/admin/plugins/discourse-ai/ai-agents/%{id}/edit")
+
resources :ai_artifacts,
only: %i[index show create update destroy],
path: "ai-artifacts",
@@ -92,12 +96,17 @@ Discourse::Application.routes.draw do
format: :json,
}
- resources :ai_personas,
+ resources :ai_agents,
only: %i[index new create edit update destroy],
- path: "ai-personas",
- controller: "discourse_ai/admin/ai_personas"
+ path: "ai-agents",
+ controller: "discourse_ai/admin/ai_agents"
- post "/ai-personas/stream-reply" => "discourse_ai/admin/ai_personas#stream_reply"
+ post "/ai-agents/stream-reply" => "discourse_ai/admin/ai_agents#stream_reply"
+ post "/ai-agents/:id/create-user", to: "discourse_ai/admin/ai_agents#create_user"
+ get "/ai-agents/:id/export", to: "discourse_ai/admin/ai_agents#export", format: :json
+ post "/ai-agents/import", to: "discourse_ai/admin/ai_agents#import"
+ put "/ai-agents/:id/files/remove", to: "discourse_ai/admin/ai_agents#remove_file"
+ get "/ai-agents/:id/files/status", to: "discourse_ai/admin/ai_agents#indexing_status_check"
resources(
:ai_tools,
@@ -110,13 +119,6 @@ Discourse::Application.routes.draw do
get "/ai-tools/:id/export", to: "discourse_ai/admin/ai_tools#export", format: :json
post "/ai-tools/import", to: "discourse_ai/admin/ai_tools#import"
- post "/ai-personas/:id/create-user", to: "discourse_ai/admin/ai_personas#create_user"
- get "/ai-personas/:id/export", to: "discourse_ai/admin/ai_personas#export", format: :json
- post "/ai-personas/import", to: "discourse_ai/admin/ai_personas#import"
-
- put "/ai-personas/:id/files/remove", to: "discourse_ai/admin/ai_personas#remove_file"
- get "/ai-personas/:id/files/status", to: "discourse_ai/admin/ai_personas#indexing_status_check"
-
post "/rag-document-fragments/files/upload",
to: "discourse_ai/admin/rag_document_fragments#upload_file"
get "/rag-document-fragments/files/status",
diff --git a/plugins/discourse-ai/config/settings.yml b/plugins/discourse-ai/config/settings.yml
index ab60dcc86a8..798b3c6220c 100644
--- a/plugins/discourse-ai/config/settings.yml
+++ b/plugins/discourse-ai/config/settings.yml
@@ -118,55 +118,55 @@ discourse_ai:
- "context_menu"
- "image_caption"
area: "ai-features/ai_helper"
- ai_helper_proofreader_persona:
+ ai_helper_proofreader_agent:
default: "-22"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/ai_helper"
- ai_helper_title_suggestions_persona:
+ ai_helper_title_suggestions_agent:
default: "-23"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/ai_helper"
- ai_helper_explain_persona:
+ ai_helper_explain_agent:
default: "-24"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/ai_helper"
- ai_helper_post_illustrator_persona:
+ ai_helper_post_illustrator_agent:
default: "-21"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/ai_helper"
- ai_helper_smart_dates_persona:
+ ai_helper_smart_dates_agent:
default: "-19"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/ai_helper"
- ai_helper_translator_persona:
+ ai_helper_translator_agent:
default: "-25"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/ai_helper"
- ai_helper_markdown_tables_persona:
+ ai_helper_markdown_tables_agent:
default: "-20"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/ai_helper"
- ai_helper_custom_prompt_persona:
+ ai_helper_custom_prompt_agent:
default: "-18"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/ai_helper"
- ai_helper_image_caption_persona:
+ ai_helper_image_caption_agent:
default: "-26"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/ai_helper"
- ai_helper_chat_thread_title_persona:
+ ai_helper_chat_thread_title_agent:
default: "-35"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/ai_helper"
ai_embeddings_enabled:
@@ -230,10 +230,10 @@ discourse_ai:
default: false
client: true
area: "ai-features/embeddings"
- ai_embeddings_semantic_search_hyde_persona:
+ ai_embeddings_semantic_search_hyde_agent:
default: "-32"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/embeddings"
ai_embeddings_discourse_service_api_endpoint:
@@ -269,10 +269,10 @@ discourse_ai:
client: true
validator: "DiscourseAi::Configuration::LlmDependencyValidator"
area: "ai-features/summarization"
- ai_summarization_persona:
+ ai_summarization_agent:
default: "-11"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/summarization"
ai_pm_summarization_allowed_groups:
type: group_list
@@ -283,10 +283,10 @@ discourse_ai:
default: false
client: true
area: "ai-features/summarization"
- ai_summary_gists_persona:
+ ai_summary_gists_agent:
default: "-12"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/summarization"
ai_summary_backfill_topic_max_age_days:
default: 30
@@ -354,11 +354,11 @@ discourse_ai:
default: false
client: true
area: "ai-features/search"
- ai_discover_persona:
+ ai_discover_agent:
default: "-34"
type: enum
client: true
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/search"
ai_automation_max_triage_per_minute:
default: 60
@@ -383,12 +383,12 @@ discourse_ai:
type: enum
choices:
- search
- - persona
+ - agent
area: "ai-features/discord"
- ai_discord_search_persona:
+ ai_discord_search_agent:
default: ""
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/discord"
ai_discord_allowed_guilds:
type: list
@@ -424,25 +424,25 @@ discourse_ai:
client: true
validator: "DiscourseAi::Configuration::LlmDependencyValidator"
area: "ai-features/translation"
- ai_translation_locale_detector_persona:
+ ai_translation_locale_detector_agent:
default: "-27"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/translation"
- ai_translation_post_raw_translator_persona:
+ ai_translation_post_raw_translator_agent:
default: "-28"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/translation"
- ai_translation_topic_title_translator_persona:
+ ai_translation_topic_title_translator_agent:
default: "-29"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/translation"
- ai_translation_short_text_translator_persona:
+ ai_translation_short_text_translator_agent:
default: "-30"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/translation"
ai_translation_backfill_hourly_rate:
default: 50
@@ -516,20 +516,20 @@ discourse_ai:
default: 5
client: false
area: "ai-features/inference"
- inferred_concepts_generate_persona:
+ inferred_concepts_generate_agent:
default: "-15"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/inference"
- inferred_concepts_match_persona:
+ inferred_concepts_match_agent:
default: "-16"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/inference"
- inferred_concepts_deduplicate_persona:
+ inferred_concepts_deduplicate_agent:
default: "-17"
type: enum
- enum: "DiscourseAi::Configuration::PersonaEnumerator"
+ enum: "DiscourseAi::Configuration::AgentEnumerator"
area: "ai-features/inference"
ai_artifact_kv_value_max_length:
default: 5000
diff --git a/plugins/discourse-ai/db/fixtures/agents/603_ai_agents.rb b/plugins/discourse-ai/db/fixtures/agents/603_ai_agents.rb
new file mode 100644
index 00000000000..c184528e22a
--- /dev/null
+++ b/plugins/discourse-ai/db/fixtures/agents/603_ai_agents.rb
@@ -0,0 +1,93 @@
+# frozen_string_literal: true
+
+summarization_agents = [DiscourseAi::Agents::Summarizer, DiscourseAi::Agents::ShortSummarizer]
+
+def from_setting(setting_name)
+ DB
+ .query_single(
+ "SELECT value FROM site_settings WHERE name = :setting_name",
+ setting_name: setting_name,
+ )
+ &.first
+ &.split("|")
+end
+
+DiscourseAi::Agents::Agent.system_agents.each do |agent_class, id|
+ agent = AiAgent.find_by(id: id)
+ if !agent
+ agent = AiAgent.new
+ agent.id = id
+
+ if agent_class == DiscourseAi::Agents::WebArtifactCreator
+ # this is somewhat sensitive, so we default it to staff
+ agent.allowed_group_ids = [Group::AUTO_GROUPS[:staff]]
+ elsif summarization_agents.include?(agent_class)
+ # Copy group permissions from site settings.
+ default_groups = [Group::AUTO_GROUPS[:staff], Group::AUTO_GROUPS[:trust_level_1]]
+
+ setting_name = "ai_custom_summarization_allowed_groups"
+ if agent_class == DiscourseAi::Agents::ShortSummarizer
+ setting_name = "ai_summary_gists_allowed_groups"
+ default_groups = [Group::AUTO_GROUPS[:everyone]]
+ end
+
+ agent.allowed_group_ids = from_setting(setting_name) || default_groups
+ elsif agent_class == DiscourseAi::Agents::CustomPrompt
+ setting_name = "ai_helper_custom_prompts_allowed_groups"
+ default_groups = [Group::AUTO_GROUPS[:staff]]
+ agent.allowed_group_ids = from_setting(setting_name) || default_groups
+ elsif agent_class == DiscourseAi::Agents::ContentCreator
+ agent.allowed_group_ids = [Group::AUTO_GROUPS[:everyone]]
+ else
+ agent.allowed_group_ids = [Group::AUTO_GROUPS[:trust_level_0]]
+ end
+
+ agent.enabled = agent_class.default_enabled
+ agent.priority = true if agent_class == DiscourseAi::Agents::General
+ end
+
+ names = [
+ agent_class.name,
+ agent_class.name + " 1",
+ agent_class.name + " 2",
+ agent_class.name + SecureRandom.hex,
+ ]
+ agent.name = DB.query_single(<<~SQL, names, id).first
+ SELECT guess_name
+ FROM (
+ SELECT unnest(Array[?]) AS guess_name
+ FROM (SELECT 1) as t
+ ) x
+ LEFT JOIN ai_agents ON ai_agents.name = x.guess_name AND ai_agents.id <> ?
+ WHERE ai_agents.id IS NULL
+ ORDER BY x.guess_name ASC
+ LIMIT 1
+ SQL
+
+ agent.description = agent_class.description
+
+ agent.system = true
+ instance = agent_class.new
+ tools = {}
+ instance.tools.map { |tool| tool.to_s.split("::").last }.each { |name| tools[name] = nil }
+ existing_tools = agent.tools || []
+
+ existing_tools.each do |tool|
+ if tool.is_a?(Array)
+ name, value = tool
+ tools[name] = value if tools.key?(name)
+ end
+ end
+
+ forced_tool_names = instance.force_tool_use.map { |tool| tool.to_s.split("::").last }
+ agent.tools = tools.map { |name, value| [name, value, forced_tool_names.include?(name)] }
+ agent.forced_tool_count = instance.forced_tool_count
+
+ agent.response_format = instance.response_format
+ agent.examples = instance.examples
+
+ agent.system_prompt = instance.system_prompt
+ agent.top_p = instance.top_p
+ agent.temperature = instance.temperature
+ agent.save!(validate: false)
+end
diff --git a/plugins/discourse-ai/db/fixtures/personas/603_ai_personas.rb b/plugins/discourse-ai/db/fixtures/personas/603_ai_personas.rb
deleted file mode 100644
index 9625a3c719e..00000000000
--- a/plugins/discourse-ai/db/fixtures/personas/603_ai_personas.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-# frozen_string_literal: true
-
-summarization_personas = [DiscourseAi::Personas::Summarizer, DiscourseAi::Personas::ShortSummarizer]
-
-def from_setting(setting_name)
- DB
- .query_single(
- "SELECT value FROM site_settings WHERE name = :setting_name",
- setting_name: setting_name,
- )
- &.first
- &.split("|")
-end
-
-DiscourseAi::Personas::Persona.system_personas.each do |persona_class, id|
- persona = AiPersona.find_by(id: id)
- if !persona
- persona = AiPersona.new
- persona.id = id
-
- if persona_class == DiscourseAi::Personas::WebArtifactCreator
- # this is somewhat sensitive, so we default it to staff
- persona.allowed_group_ids = [Group::AUTO_GROUPS[:staff]]
- elsif summarization_personas.include?(persona_class)
- # Copy group permissions from site settings.
- default_groups = [Group::AUTO_GROUPS[:staff], Group::AUTO_GROUPS[:trust_level_1]]
-
- setting_name = "ai_custom_summarization_allowed_groups"
- if persona_class == DiscourseAi::Personas::ShortSummarizer
- setting_name = "ai_summary_gists_allowed_groups"
- default_groups = [Group::AUTO_GROUPS[:everyone]]
- end
-
- persona.allowed_group_ids = from_setting(setting_name) || default_groups
- elsif persona_class == DiscourseAi::Personas::CustomPrompt
- setting_name = "ai_helper_custom_prompts_allowed_groups"
- default_groups = [Group::AUTO_GROUPS[:staff]]
- persona.allowed_group_ids = from_setting(setting_name) || default_groups
- elsif persona_class == DiscourseAi::Personas::ContentCreator
- persona.allowed_group_ids = [Group::AUTO_GROUPS[:everyone]]
- else
- persona.allowed_group_ids = [Group::AUTO_GROUPS[:trust_level_0]]
- end
-
- persona.enabled = persona_class.default_enabled
- persona.priority = true if persona_class == DiscourseAi::Personas::General
- end
-
- names = [
- persona_class.name,
- persona_class.name + " 1",
- persona_class.name + " 2",
- persona_class.name + SecureRandom.hex,
- ]
- persona.name = DB.query_single(<<~SQL, names, id).first
- SELECT guess_name
- FROM (
- SELECT unnest(Array[?]) AS guess_name
- FROM (SELECT 1) as t
- ) x
- LEFT JOIN ai_personas ON ai_personas.name = x.guess_name AND ai_personas.id <> ?
- WHERE ai_personas.id IS NULL
- ORDER BY x.guess_name ASC
- LIMIT 1
- SQL
-
- persona.description = persona_class.description
-
- persona.system = true
- instance = persona_class.new
- tools = {}
- instance.tools.map { |tool| tool.to_s.split("::").last }.each { |name| tools[name] = nil }
- existing_tools = persona.tools || []
-
- existing_tools.each do |tool|
- if tool.is_a?(Array)
- name, value = tool
- tools[name] = value if tools.key?(name)
- end
- end
-
- forced_tool_names = instance.force_tool_use.map { |tool| tool.to_s.split("::").last }
- persona.tools = tools.map { |name, value| [name, value, forced_tool_names.include?(name)] }
- persona.forced_tool_count = instance.forced_tool_count
-
- persona.response_format = instance.response_format
- persona.examples = instance.examples
-
- persona.system_prompt = instance.system_prompt
- persona.top_p = instance.top_p
- persona.temperature = instance.temperature
- persona.save!(validate: false)
-end
diff --git a/plugins/discourse-ai/db/migrate/20260306000001_rename_ai_personas_to_ai_agents.rb b/plugins/discourse-ai/db/migrate/20260306000001_rename_ai_personas_to_ai_agents.rb
new file mode 100644
index 00000000000..e512c804dd5
--- /dev/null
+++ b/plugins/discourse-ai/db/migrate/20260306000001_rename_ai_personas_to_ai_agents.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class RenameAiPersonasToAiAgents < ActiveRecord::Migration[7.2]
+ def up
+ # Create ai_agents as a view pointing to the real ai_personas table.
+ # New code references ai_agents; old table stays intact until
+ # FinalizeAiAgentsSchema post_migration does the actual rename.
+ if table_exists?(:ai_personas) && !ActiveRecord::Base.connection.view_exists?(:ai_agents)
+ execute "CREATE VIEW ai_agents AS SELECT * FROM ai_personas"
+ end
+ end
+
+ def down
+ execute "DROP VIEW IF EXISTS ai_agents"
+ end
+end
diff --git a/plugins/discourse-ai/db/post_migrate/20250210032351_post_migrate_persona_to_llm_model_id.rb b/plugins/discourse-ai/db/post_migrate/20250210032351_post_migrate_persona_to_llm_model_id.rb
index 0d161b561ec..0e3d20a8c63 100644
--- a/plugins/discourse-ai/db/post_migrate/20250210032351_post_migrate_persona_to_llm_model_id.rb
+++ b/plugins/discourse-ai/db/post_migrate/20250210032351_post_migrate_persona_to_llm_model_id.rb
@@ -1,8 +1,16 @@
# frozen_string_literal: true
class PostMigratePersonaToLlmModelId < ActiveRecord::Migration[7.2]
def up
+ view_existed = connection.view_exists?(:ai_agents)
+ execute "DROP VIEW IF EXISTS ai_agents" if view_existed
+
remove_column :ai_personas, :default_llm
remove_column :ai_personas, :question_consolidator_llm
+
+ if view_existed
+ columns = connection.columns(:ai_personas).map(&:name).join(", ")
+ execute "CREATE VIEW ai_agents AS SELECT #{columns} FROM ai_personas"
+ end
end
def down
diff --git a/plugins/discourse-ai/db/post_migrate/20260205065417_drop_tool_details_from_ai_personas.rb b/plugins/discourse-ai/db/post_migrate/20260205065417_drop_tool_details_from_ai_personas.rb
index 6bf4fc1c74b..b1d8eb73fb0 100644
--- a/plugins/discourse-ai/db/post_migrate/20260205065417_drop_tool_details_from_ai_personas.rb
+++ b/plugins/discourse-ai/db/post_migrate/20260205065417_drop_tool_details_from_ai_personas.rb
@@ -2,7 +2,15 @@
class DropToolDetailsFromAiPersonas < ActiveRecord::Migration[8.0]
def up
+ view_existed = connection.view_exists?(:ai_agents)
+ execute "DROP VIEW IF EXISTS ai_agents" if view_existed
+
Migration::ColumnDropper.execute_drop(:ai_personas, %i[tool_details])
+
+ if view_existed
+ columns = connection.columns(:ai_personas).map(&:name).join(", ")
+ execute "CREATE VIEW ai_agents AS SELECT #{columns} FROM ai_personas"
+ end
end
def down
diff --git a/plugins/discourse-ai/db/post_migrate/20260306000002_finalize_ai_agents_schema.rb b/plugins/discourse-ai/db/post_migrate/20260306000002_finalize_ai_agents_schema.rb
new file mode 100644
index 00000000000..fe624a9b819
--- /dev/null
+++ b/plugins/discourse-ai/db/post_migrate/20260306000002_finalize_ai_agents_schema.rb
@@ -0,0 +1,155 @@
+# frozen_string_literal: true
+
+class FinalizeAiAgentsSchema < ActiveRecord::Migration[7.2]
+ disable_ddl_transaction!
+
+ PERSONA_TO_AGENT_SETTINGS = {
+ "ai_helper_proofreader_persona" => "ai_helper_proofreader_agent",
+ "ai_helper_title_suggestions_persona" => "ai_helper_title_suggestions_agent",
+ "ai_helper_explain_persona" => "ai_helper_explain_agent",
+ "ai_helper_post_illustrator_persona" => "ai_helper_post_illustrator_agent",
+ "ai_helper_smart_dates_persona" => "ai_helper_smart_dates_agent",
+ "ai_helper_translator_persona" => "ai_helper_translator_agent",
+ "ai_helper_markdown_tables_persona" => "ai_helper_markdown_tables_agent",
+ "ai_helper_custom_prompt_persona" => "ai_helper_custom_prompt_agent",
+ "ai_helper_image_caption_persona" => "ai_helper_image_caption_agent",
+ "ai_helper_chat_thread_title_persona" => "ai_helper_chat_thread_title_agent",
+ "ai_embeddings_semantic_search_hyde_persona" => "ai_embeddings_semantic_search_hyde_agent",
+ "ai_summarization_persona" => "ai_summarization_agent",
+ "ai_summary_gists_persona" => "ai_summary_gists_agent",
+ "ai_discover_persona" => "ai_discover_agent",
+ "ai_discord_search_persona" => "ai_discord_search_agent",
+ "ai_translation_locale_detector_persona" => "ai_translation_locale_detector_agent",
+ "ai_translation_post_raw_translator_persona" => "ai_translation_post_raw_translator_agent",
+ "ai_translation_topic_title_translator_persona" =>
+ "ai_translation_topic_title_translator_agent",
+ "ai_translation_short_text_translator_persona" => "ai_translation_short_text_translator_agent",
+ "inferred_concepts_generate_persona" => "inferred_concepts_generate_agent",
+ "inferred_concepts_match_persona" => "inferred_concepts_match_agent",
+ "inferred_concepts_deduplicate_persona" => "inferred_concepts_deduplicate_agent",
+ }
+
+ def up
+ # 0. Drop the forward-compat view and do the actual table rename
+ execute "DROP VIEW IF EXISTS ai_agents"
+
+ if table_exists?(:ai_personas) && !table_exists?(:ai_agents)
+ rename_table :ai_personas, :ai_agents
+ end
+
+ raise "ai_agents table must exist at this point" unless table_exists?(:ai_agents)
+
+ if table_exists?(:ai_moderation_settings) &&
+ column_exists?(:ai_moderation_settings, :ai_persona_id)
+ rename_column :ai_moderation_settings, :ai_persona_id, :ai_agent_id
+ end
+
+ # 1. Update polymorphic target_type references
+ execute <<~SQL
+ UPDATE rag_document_fragments
+ SET target_type = 'AiAgent'
+ WHERE target_type = 'AiPersona'
+ SQL
+
+ execute <<~SQL
+ UPDATE upload_references
+ SET target_type = 'AiAgent'
+ WHERE target_type = 'AiPersona'
+ SQL
+
+ # 2. Rename site settings
+ PERSONA_TO_AGENT_SETTINGS.each { |old_name, new_name| execute <<~SQL }
+ UPDATE site_settings
+ SET name = '#{new_name}'
+ WHERE name = '#{old_name}'
+ AND NOT EXISTS (SELECT 1 FROM site_settings WHERE name = '#{new_name}')
+ SQL
+
+ # 3. Rename custom fields
+ execute <<~SQL
+ UPDATE topic_custom_fields
+ SET name = 'ai_agent_id'
+ WHERE name = 'ai_persona_id'
+ SQL
+
+ execute <<~SQL
+ UPDATE topic_custom_fields
+ SET name = 'ai_agent'
+ WHERE name = 'ai_persona'
+ SQL
+
+ execute <<~SQL
+ UPDATE post_custom_fields
+ SET name = 'ai_agent_id'
+ WHERE name = 'ai_persona_id'
+ SQL
+
+ # 3b. Rename automation script and field names
+ execute <<~SQL
+ UPDATE discourse_automation_automations
+ SET script = 'llm_agent_triage'
+ WHERE script = 'llm_persona_triage'
+ SQL
+
+ execute <<~SQL
+ UPDATE discourse_automation_fields
+ SET name = 'agent'
+ WHERE name = 'persona'
+ AND automation_id IN (
+ SELECT id FROM discourse_automation_automations
+ WHERE script = 'llm_agent_triage'
+ )
+ SQL
+
+ execute <<~SQL
+ UPDATE discourse_automation_fields
+ SET name = 'triage_agent'
+ WHERE name = 'triage_persona'
+ AND automation_id IN (
+ SELECT id FROM discourse_automation_automations
+ WHERE script = 'llm_triage'
+ )
+ SQL
+
+ execute <<~SQL
+ UPDATE discourse_automation_fields
+ SET name = 'reply_agent'
+ WHERE name = 'reply_persona'
+ AND automation_id IN (
+ SELECT id FROM discourse_automation_automations
+ WHERE script = 'llm_triage'
+ )
+ SQL
+
+ execute <<~SQL
+ UPDATE discourse_automation_fields
+ SET name = 'agent_id'
+ WHERE name = 'persona_id'
+ AND automation_id IN (
+ SELECT id FROM discourse_automation_automations
+ WHERE script = 'llm_report'
+ )
+ SQL
+
+ execute <<~SQL
+ UPDATE discourse_automation_fields
+ SET name = 'tagger_agent'
+ WHERE name = 'tagger_persona'
+ AND automation_id IN (
+ SELECT id FROM discourse_automation_automations
+ WHERE script = 'llm_tagger'
+ )
+ SQL
+
+ # 4. Ensure stale columns are gone (idempotent cleanup)
+ remove_column :ai_agents, :default_llm if column_exists?(:ai_agents, :default_llm)
+ if column_exists?(:ai_agents, :question_consolidator_llm)
+ remove_column :ai_agents, :question_consolidator_llm
+ end
+ remove_column :ai_agents, :tool_details if column_exists?(:ai_agents, :tool_details)
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
diff --git a/plugins/discourse-ai/discourse_automation/llm_persona_triage.rb b/plugins/discourse-ai/discourse_automation/llm_agent_triage.rb
similarity index 70%
rename from plugins/discourse-ai/discourse_automation/llm_persona_triage.rb
rename to plugins/discourse-ai/discourse_automation/llm_agent_triage.rb
index e59c2b623c8..d6a54c4c6ef 100644
--- a/plugins/discourse-ai/discourse_automation/llm_persona_triage.rb
+++ b/plugins/discourse-ai/discourse_automation/llm_agent_triage.rb
@@ -1,17 +1,17 @@
# frozen_string_literal: true
if defined?(DiscourseAutomation)
- DiscourseAutomation::Scriptable.add("llm_persona_triage") do
+ DiscourseAutomation::Scriptable.add("llm_agent_triage") do
version 1
run_in_background
triggerables %i[post_created_edited stalled_topic]
- field :persona,
+ field :agent,
component: :choices,
required: true,
extra: {
- content: DiscourseAi::Automation.available_persona_choices,
+ content: DiscourseAi::Automation.available_agent_choices,
}
field :whisper, component: :boolean
field :silent_mode, component: :boolean
@@ -22,38 +22,35 @@ if defined?(DiscourseAutomation)
next if post.blank?
next if post.user&.bot?
- persona_id = fields.dig("persona", "value")
+ agent_id = fields.dig("agent", "value")
whisper = !!fields.dig("whisper", "value")
silent_mode = !!fields.dig("silent_mode", "value")
begin
RateLimiter.new(
Discourse.system_user,
- "llm_persona_triage_#{post.id}",
+ "llm_agent_triage_#{post.id}",
SiteSetting.ai_automation_max_triage_per_post_per_minute,
1.minute,
).performed!
RateLimiter.new(
Discourse.system_user,
- "llm_persona_triage",
+ "llm_agent_triage",
SiteSetting.ai_automation_max_triage_per_minute,
1.minute,
).performed!
- DiscourseAi::Automation::LlmPersonaTriage.handle(
+ DiscourseAi::Automation::LlmAgentTriage.handle(
post: post,
- persona_id: persona_id,
+ agent_id: agent_id,
whisper: whisper,
automation: self.automation,
silent_mode: silent_mode,
action: context["action"],
)
rescue => e
- Discourse.warn_exception(
- e,
- message: "llm_persona_triage: skipped triage on post #{post.id}",
- )
+ Discourse.warn_exception(e, message: "llm_agent_triage: skipped triage on post #{post.id}")
raise e if Rails.env.tests?
end
end
diff --git a/plugins/discourse-ai/discourse_automation/llm_report.rb b/plugins/discourse-ai/discourse_automation/llm_report.rb
index c5e308d8fbb..eba5bb92b0c 100644
--- a/plugins/discourse-ai/discourse_automation/llm_report.rb
+++ b/plugins/discourse-ai/discourse_automation/llm_report.rb
@@ -21,14 +21,14 @@ if defined?(DiscourseAutomation)
field :sample_size, component: :text, required: true, default_value: 100
field :tokens_per_post, component: :text, required: true, default_value: 150
- field :persona_id,
+ field :agent_id,
component: :choices,
required: true,
default_value:
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::ReportRunner],
+ DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::ReportRunner],
extra: {
content:
- DiscourseAi::Automation.available_persona_choices(
+ DiscourseAi::Automation.available_agent_choices(
require_user: false,
require_default_llm: false,
),
@@ -72,7 +72,7 @@ if defined?(DiscourseAutomation)
offset = fields.dig("offset", "value").to_i
priority_group = fields.dig("priority_group", "value")
tokens_per_post = fields.dig("tokens_per_post", "value")
- persona_id = fields.dig("persona_id", "value")
+ agent_id = fields.dig("agent_id", "value")
exclude_category_ids = fields.dig("exclude_categories", "value")
exclude_tags = fields.dig("exclude_tags", "value")
@@ -92,9 +92,8 @@ if defined?(DiscourseAutomation)
end
# Backwards-compat for scripts created before this field was added.
- if persona_id == "" || persona_id.nil?
- persona_id =
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::ReportRunner]
+ if agent_id == "" || agent_id.nil?
+ agent_id = DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::ReportRunner]
end
suppress_notifications = !!fields.dig("suppress_notifications", "value")
@@ -103,7 +102,7 @@ if defined?(DiscourseAutomation)
receivers: receivers,
topic_id: topic_id,
title: title,
- persona_id: persona_id,
+ agent_id: agent_id,
model: model,
category_ids: category_ids,
tags: tags,
diff --git a/plugins/discourse-ai/discourse_automation/llm_tagger.rb b/plugins/discourse-ai/discourse_automation/llm_tagger.rb
index 4e7e8577037..3949da67780 100644
--- a/plugins/discourse-ai/discourse_automation/llm_tagger.rb
+++ b/plugins/discourse-ai/discourse_automation/llm_tagger.rb
@@ -9,12 +9,12 @@ if defined?(DiscourseAutomation)
triggerables %i[post_created_edited stalled_topic]
- field :tagger_persona,
+ field :tagger_agent,
component: :choices,
required: true,
extra: {
content:
- DiscourseAi::Automation.available_persona_choices(
+ DiscourseAi::Automation.available_agent_choices(
require_user: false,
require_default_llm: true,
),
@@ -68,7 +68,7 @@ if defined?(DiscourseAutomation)
next if latest_revision&.modifications&.has_key?("tags")
end
- tagger_persona_id = fields.dig("tagger_persona", "value")
+ tagger_agent_id = fields.dig("tagger_agent", "value")
tag_mode = fields.dig("tag_mode", "value") || "manual"
manual_tags = fields.dig("available_tags", "value") || []
confidence_threshold = fields.dig("confidence_threshold", "value").to_f
@@ -113,7 +113,7 @@ if defined?(DiscourseAutomation)
DiscourseAi::Automation::LlmTagger.handle(
post: post,
- tagger_persona_id: tagger_persona_id,
+ tagger_agent_id: tagger_agent_id,
tag_mode: tag_mode,
available_tags: manual_tags,
confidence_threshold: confidence_threshold,
diff --git a/plugins/discourse-ai/discourse_automation/llm_triage.rb b/plugins/discourse-ai/discourse_automation/llm_triage.rb
index a03c21a5024..dbc59f9a412 100644
--- a/plugins/discourse-ai/discourse_automation/llm_triage.rb
+++ b/plugins/discourse-ai/discourse_automation/llm_triage.rb
@@ -13,12 +13,12 @@ if defined?(DiscourseAutomation)
field :include_personal_messages, component: :boolean
# Inputs
- field :triage_persona,
+ field :triage_agent,
component: :choices,
required: true,
extra: {
content:
- DiscourseAi::Automation.available_persona_choices(
+ DiscourseAi::Automation.available_agent_choices(
require_user: false,
require_default_llm: true,
),
@@ -42,11 +42,11 @@ if defined?(DiscourseAutomation)
default: "review"
field :canned_reply_user, component: :user
field :canned_reply, component: :message
- field :reply_persona,
+ field :reply_agent,
component: :choices,
extra: {
content:
- DiscourseAi::Automation.available_persona_choices(
+ DiscourseAi::Automation.available_agent_choices(
require_user: false,
require_default_llm: true,
),
@@ -67,11 +67,11 @@ if defined?(DiscourseAutomation)
next if !include_personal_messages
end
- triage_persona_id = fields.dig("triage_persona", "value")
+ triage_agent_id = fields.dig("triage_agent", "value")
canned_reply = fields.dig("canned_reply", "value")
canned_reply_user = fields.dig("canned_reply_user", "value")
- reply_persona_id = fields.dig("reply_persona", "value")
+ reply_agent_id = fields.dig("reply_agent", "value")
whisper = fields.dig("whisper", "value")
notify_author_pm = fields.dig("notify_author_pm", "value")
notify_author_pm_user = fields.dig("notify_author_pm_user", "value")
@@ -134,13 +134,13 @@ if defined?(DiscourseAutomation)
DiscourseAi::Automation::LlmTriage.handle(
post: post,
- triage_persona_id: triage_persona_id,
+ triage_agent_id: triage_agent_id,
search_for_text: search_for_text,
category_id: category_id,
tags: tags,
canned_reply: canned_reply,
canned_reply_user: canned_reply_user,
- reply_persona_id: reply_persona_id,
+ reply_agent_id: reply_agent_id,
whisper: whisper,
hide_topic: hide_topic,
flag_post: flag_post,
diff --git a/plugins/discourse-ai/evals/personas/topic_summary_eval.yml b/plugins/discourse-ai/evals/agents/topic_summary_eval.yml
similarity index 89%
rename from plugins/discourse-ai/evals/personas/topic_summary_eval.yml
rename to plugins/discourse-ai/evals/agents/topic_summary_eval.yml
index 30a5e7b5135..c6d0436c886 100644
--- a/plugins/discourse-ai/evals/personas/topic_summary_eval.yml
+++ b/plugins/discourse-ai/evals/agents/topic_summary_eval.yml
@@ -1,5 +1,5 @@
key: topic_summary_eval
-description: Variant of the built-in summarizer persona tuned for eval comparisons
+description: Variant of the built-in summarizer agent tuned for eval comparisons
system_prompt: |
You are an AI specialized in summarizing Discourse forum topics for busy staff members.
Produce a single paragraph that highlights the most important actions, open questions,
diff --git a/plugins/discourse-ai/evals/lib/persona_prompt_loader.rb b/plugins/discourse-ai/evals/lib/agent_prompt_loader.rb
similarity index 71%
rename from plugins/discourse-ai/evals/lib/persona_prompt_loader.rb
rename to plugins/discourse-ai/evals/lib/agent_prompt_loader.rb
index bfe29baa0b1..327606d8672 100644
--- a/plugins/discourse-ai/evals/lib/persona_prompt_loader.rb
+++ b/plugins/discourse-ai/evals/lib/agent_prompt_loader.rb
@@ -4,9 +4,9 @@ require "yaml"
module DiscourseAi
module Evals
- class PersonaPromptLoader
- DEFAULT_PERSONA_KEY = "default"
- PERSONA_GLOB = File.join(__dir__, "../personas/**/*.yml")
+ class AgentPromptLoader
+ DEFAULT_AGENT_KEY = "default"
+ AGENT_GLOB = File.join(__dir__, "../agents/**/*.yml")
def list
entries.map { |entry| [entry[:key], entry[:description]] }
@@ -18,23 +18,23 @@ module DiscourseAi
end
def entries
- @entries ||= Dir.glob(PERSONA_GLOB).sort.map { |path| load_entry(path) }.compact
+ @entries ||= Dir.glob(AGENT_GLOB).sort.map { |path| load_entry(path) }.compact
end
def variants_for(keys, comparison_mode: nil)
keys_array = Array(keys)
variants = []
- if keys_array.empty? || comparison_mode == :personas
- variants << { key: DEFAULT_PERSONA_KEY, prompt: nil }
+ if keys_array.empty? || comparison_mode == :agents
+ variants << { key: DEFAULT_AGENT_KEY, prompt: nil }
end
keys_array.each do |key|
- next if key == DEFAULT_PERSONA_KEY
+ next if key == DEFAULT_AGENT_KEY
prompt = find_prompt(key)
if prompt.to_s.strip.empty?
- puts "Error: Unknown persona key '#{key}'. Run --list-personas to view options."
+ puts "Error: Unknown agent key '#{key}'. Run --list-agents to view options."
exit 1
end
@@ -45,7 +45,7 @@ module DiscourseAi
end
def print(output: $stdout)
- output.puts("#{DEFAULT_PERSONA_KEY}: built-in persona prompt")
+ output.puts("#{DEFAULT_AGENT_KEY}: built-in agent prompt")
list.each do |key, description|
if description && !description.empty?
output.puts("#{key}: #{description}")
@@ -72,7 +72,7 @@ module DiscourseAi
{ key: key.to_s.strip, system_prompt: system_prompt, description: description }
rescue Psych::SyntaxError => e
- warn "Warning: failed to load persona prompt from #{path}: #{e.message}"
+ warn "Warning: failed to load agent prompt from #{path}: #{e.message}"
nil
end
end
diff --git a/plugins/discourse-ai/evals/lib/cli.rb b/plugins/discourse-ai/evals/lib/cli.rb
index 8391d574637..cfd940bea95 100644
--- a/plugins/discourse-ai/evals/lib/cli.rb
+++ b/plugins/discourse-ai/evals/lib/cli.rb
@@ -1,19 +1,19 @@
# frozen_string_literal: true
require_relative "features"
-require_relative "persona_prompt_loader"
+require_relative "agent_prompt_loader"
class DiscourseAi::Evals::Cli
DEFAULT_JUDGE = "gpt-4o"
- attr_reader :persona_keys
+ attr_reader :agent_keys
attr_accessor :eval_name,
:models,
:list,
:list_models,
:list_features,
- :list_personas,
+ :list_agents,
:feature_key,
:judge_name,
:comparison_mode,
@@ -32,8 +32,8 @@ class DiscourseAi::Evals::Cli
opts.on("--list-models", "List models") { cli.list_models = true }
opts.on("--list-features", "List features available for evals") { cli.list_features = true }
- opts.on("--list-personas", "List persona definitions available to evals") do
- cli.list_personas = true
+ opts.on("--list-agents", "List agent definitions available to evals") do
+ cli.list_agents = true
end
opts.on(
@@ -57,11 +57,11 @@ class DiscourseAi::Evals::Cli
) { |judge| cli.judge_name = judge }
opts.on(
- "--persona-keys KEYS",
- "Comma-separated list of persona keys to run sequentially",
- ) { |keys| keys.split(",").each { |key| cli.add_persona_key(key) } }
+ "--agent-keys KEYS",
+ "Comma-separated list of agent keys to run sequentially",
+ ) { |keys| keys.split(",").each { |key| cli.add_agent_key(key) } }
- opts.on("--compare MODE", "Comparison mode (personas or llms)") do |mode|
+ opts.on("--compare MODE", "Comparison mode (agents or llms)") do |mode|
cli.comparison_mode = mode
end
@@ -89,17 +89,17 @@ class DiscourseAi::Evals::Cli
normalized = cli.comparison_mode.to_s.downcase.strip
cli.comparison_mode =
case normalized
- when "persona", "personas"
- :personas
+ when "agent", "agents"
+ :agents
when "llms", "models"
:llms
else
- STDERR.puts("Unknown comparison mode '#{cli.comparison_mode}'. Use Personas or LLMs.")
+ STDERR.puts("Unknown comparison mode '#{cli.comparison_mode}'. Use Agents or LLMs.")
exit 1
end
- if cli.comparison_mode == :personas
- cli.add_persona_key(DiscourseAi::Evals::PersonaPromptLoader::DEFAULT_PERSONA_KEY)
+ if cli.comparison_mode == :agents
+ cli.add_agent_key(DiscourseAi::Evals::AgentPromptLoader::DEFAULT_AGENT_KEY)
end
end
@@ -112,18 +112,18 @@ class DiscourseAi::Evals::Cli
end
def initialize
- @persona_keys = Set.new
+ @agent_keys = Set.new
end
def judge_provided?
judge_name.present?
end
- def add_persona_key(key)
+ def add_agent_key(key)
trimmed = key.to_s.strip
return if trimmed.empty?
- @persona_keys << trimmed
+ @agent_keys << trimmed
end
def select_evals(available_evals)
@@ -143,27 +143,27 @@ class DiscourseAi::Evals::Cli
evals
end
- def validate_comparison_requirements!(llms:, persona_variants:)
+ def validate_comparison_requirements!(llms:, agent_variants:)
case comparison_mode
when :llms
- if persona_variants.length != 1
- STDERR.puts("LLM comparison runs against exactly one persona.")
+ if agent_variants.length != 1
+ STDERR.puts("LLM comparison runs against exactly one agent.")
exit 1
end
- when :personas
+ when :agents
if llms.length != 1
- STDERR.puts("Persona comparison requires exactly one LLM.")
+ STDERR.puts("Agent comparison requires exactly one LLM.")
exit 1
end
- if persona_variants.length < 2
- STDERR.puts("Persona comparison needs at least two personas.")
+ if agent_variants.length < 2
+ STDERR.puts("Agent comparison needs at least two agents.")
exit 1
end
else
- if persona_variants.length > 1
+ if agent_variants.length > 1
STDERR.puts(
- "Non-comparison runs accept only one persona. Remove extra --persona-keys or use --compare personas.",
+ "Non-comparison runs accept only one agent. Remove extra --agent-keys or use --compare agents.",
)
exit 1
end
diff --git a/plugins/discourse-ai/evals/lib/console_formatter.rb b/plugins/discourse-ai/evals/lib/console_formatter.rb
index 2b03e1b8b64..d2b4f2030d0 100644
--- a/plugins/discourse-ai/evals/lib/console_formatter.rb
+++ b/plugins/discourse-ai/evals/lib/console_formatter.rb
@@ -3,7 +3,7 @@
module DiscourseAi
module Evals
# Renders richer CLI output for eval runs: a compact progress bar followed by
- # a table summarizing each case across models/personas.
+ # a table summarizing each case across models/agents.
class ConsoleFormatter
PROGRESS_BAR_WIDTH = 28
SAMPLE_WIDTH = 46
@@ -11,11 +11,11 @@ module DiscourseAi
DEFAULT_MAX_WIDTH = 120
JUDGE_COLUMN_LABEL = "judge"
- def initialize(label:, output:, total_targets:, persona_key: nil)
+ def initialize(label:, output:, total_targets:, agent_key: nil)
@run_label = label
@output = output
@total_targets = total_targets
- @persona_key = persona_key
+ @agent_key = agent_key
@rows = []
@columns = []
@completed_units = 0
@@ -27,7 +27,7 @@ module DiscourseAi
def announce_start
header = "Starting evaluation #{run_label}"
- header << " (persona: #{persona_key})" if persona_key && persona_key != "default"
+ header << " (agent: #{agent_key})" if agent_key && agent_key != "default"
output.puts(header)
end
@@ -137,7 +137,7 @@ module DiscourseAi
private
- attr_reader :run_label, :output, :rows, :columns, :persona_key, :row_offsets
+ attr_reader :run_label, :output, :rows, :columns, :agent_key, :row_offsets
def register_column(label)
label = label.to_s
diff --git a/plugins/discourse-ai/evals/lib/recorder.rb b/plugins/discourse-ai/evals/lib/recorder.rb
index a182a191bf6..4a89ad7ea4e 100644
--- a/plugins/discourse-ai/evals/lib/recorder.rb
+++ b/plugins/discourse-ai/evals/lib/recorder.rb
@@ -10,7 +10,7 @@ module DiscourseAi
class Recorder
def self.with_cassette(
an_eval,
- persona_key: nil,
+ agent_key: nil,
output: $stdout,
total_targets: 1,
formatter: nil,
@@ -21,9 +21,9 @@ module DiscourseAi
FileUtils.mkdir_p(logs_dir)
now = Time.now.strftime("%Y%m%d-%H%M%S")
- normalized_key = normalize_persona_key(persona_key)
- persona_segment = sanitized_persona_key(normalized_key)
- base_filename = [an_eval.id, persona_segment, now].compact.join("-")
+ normalized_key = normalize_agent_key(agent_key)
+ agent_segment = sanitized_agent_key(normalized_key)
+ base_filename = [an_eval.id, agent_segment, now].compact.join("-")
structured_log_filename = "#{base_filename}.json"
log_filename = "#{base_filename}.log"
@@ -42,7 +42,7 @@ module DiscourseAi
formatter: formatter,
announce_formatter: announce_formatter,
finalize_formatter: finalize_formatter,
- persona_key: normalized_key,
+ agent_key: normalized_key,
output: output,
).tap { |recorder| recorder.running }
end
@@ -56,7 +56,7 @@ module DiscourseAi
formatter: nil,
announce_formatter: true,
finalize_formatter: true,
- persona_key:,
+ agent_key:,
output: $stdout
)
@an_eval = an_eval
@@ -70,20 +70,20 @@ module DiscourseAi
label: an_eval.id,
output: output,
total_targets: total_targets,
- persona_key: persona_key,
+ agent_key: agent_key,
)
@announce_formatter = announce_formatter
@finalize_formatter = finalize_formatter
- normalized = persona_key.to_s.strip
- @persona_key = normalized.empty? ? "default" : normalized
+ normalized = agent_key.to_s.strip
+ @agent_key = normalized.empty? ? "default" : normalized
end
def running
- logger.info("Starting evaluation '#{an_eval.id}' (persona: #{persona_key})")
+ logger.info("Starting evaluation '#{an_eval.id}' (agent: #{agent_key})")
formatter.announce_start if announce_formatter
structured_logger.start_root(
- name: "Evaluating #{an_eval.id} (persona: #{persona_key})",
- args: an_eval.to_json.merge(persona_key: persona_key),
+ name: "Evaluating #{an_eval.id} (agent: #{agent_key})",
+ args: an_eval.to_json.merge(agent_key: agent_key),
)
end
@@ -160,11 +160,11 @@ module DiscourseAi
def announce_comparison_judged(
eval_case_id:,
mode_label:,
- persona_key: nil,
+ agent_key: nil,
result:,
candidates: []
)
- step = start_comparison_step(eval_case_id, mode_label, persona_key)
+ step = start_comparison_step(eval_case_id, mode_label, agent_key)
formatter.pause_progress_line
formatter.record_comparison_judged(
@@ -186,13 +186,13 @@ module DiscourseAi
def announce_comparison_expected(
eval_case_id:,
mode_label:,
- persona_key: nil,
+ agent_key: nil,
winner:,
status_line: nil,
failures: [],
candidates: []
)
- step = start_comparison_step(eval_case_id, mode_label, persona_key)
+ step = start_comparison_step(eval_case_id, mode_label, agent_key)
formatter.pause_progress_line
formatter.record_comparison_expected(
@@ -210,14 +210,14 @@ module DiscourseAi
finish_comparison_step(step)
end
- def announce_comparison_aggregate(mode_label:, persona_key: nil, aggregate_scores:)
+ def announce_comparison_aggregate(mode_label:, agent_key: nil, aggregate_scores:)
return if aggregate_scores.blank?
- step = start_comparison_step(nil, mode_label, persona_key, summary: true)
+ step = start_comparison_step(nil, mode_label, agent_key, summary: true)
output.puts
- output.puts "#{comparison_header(nil, mode_label, persona_key, summary: true)}\n"
- logger.info(comparison_header(nil, mode_label, persona_key, summary: true))
+ output.puts "#{comparison_header(nil, mode_label, agent_key, summary: true)}\n"
+ logger.info(comparison_header(nil, mode_label, agent_key, summary: true))
aggregate_scores.each do |label, stats|
output.puts " - #{label}: #{stats[:passes]}/#{stats[:evals]} passed"
@@ -262,18 +262,18 @@ module DiscourseAi
:structured_logger,
:output,
:log_path,
- :persona_key,
+ :agent_key,
:formatter,
:announce_formatter,
:finalize_formatter
- def self.normalize_persona_key(key)
+ def self.normalize_agent_key(key)
stripped = key.to_s.strip
stripped = "default" if stripped.empty?
stripped
end
- def self.sanitized_persona_key(key)
+ def self.sanitized_agent_key(key)
stripped = key.to_s.strip
stripped = "default" if stripped.empty?
@@ -281,18 +281,18 @@ module DiscourseAi
slug.empty? ? "default" : slug.downcase
end
- def comparison_header(eval_case_id, mode_label, persona_key, summary: false)
+ def comparison_header(eval_case_id, mode_label, agent_key, summary: false)
header = "=== Comparison (#{mode_label}"
- header << ", persona: #{persona_key}" if persona_key
+ header << ", agent: #{agent_key}" if agent_key
header << ")"
header << " #{eval_case_id}" if eval_case_id && !summary
header
end
- def start_comparison_step(eval_case_id, mode_label, persona_key, summary: false)
+ def start_comparison_step(eval_case_id, mode_label, agent_key, summary: false)
ensure_root!
name = "Comparison (#{mode_label}"
- name += ", persona: #{persona_key}" if persona_key
+ name += ", agent: #{agent_key}" if agent_key
name += ")"
name += " #{eval_case_id}" if eval_case_id && !summary
structured_logger.add_child_step(name: name)
diff --git a/plugins/discourse-ai/evals/lib/runners/ai_helper.rb b/plugins/discourse-ai/evals/lib/runners/ai_helper.rb
index a977eed071f..876ff100472 100644
--- a/plugins/discourse-ai/evals/lib/runners/ai_helper.rb
+++ b/plugins/discourse-ai/evals/lib/runners/ai_helper.rb
@@ -6,14 +6,14 @@ module DiscourseAi
module Evals
module Runners
class AiHelper < Base
- PERSONA_MAP = {
- "proofread" => DiscourseAi::Personas::Proofreader,
- "explain" => DiscourseAi::Personas::Tutor,
- "smart_dates" => DiscourseAi::Personas::SmartDates,
- "title_suggestions" => DiscourseAi::Personas::TitlesGenerator,
- "markdown_tables" => DiscourseAi::Personas::MarkdownTableGenerator,
- "custom_prompt" => DiscourseAi::Personas::CustomPrompt,
- "translator" => DiscourseAi::Personas::Translator,
+ AGENT_MAP = {
+ "proofread" => DiscourseAi::Agents::Proofreader,
+ "explain" => DiscourseAi::Agents::Tutor,
+ "smart_dates" => DiscourseAi::Agents::SmartDates,
+ "title_suggestions" => DiscourseAi::Agents::TitlesGenerator,
+ "markdown_tables" => DiscourseAi::Agents::MarkdownTableGenerator,
+ "custom_prompt" => DiscourseAi::Agents::CustomPrompt,
+ "translator" => DiscourseAi::Agents::Translator,
}.freeze
SANITIZE_REGEX_STR =
@@ -27,12 +27,12 @@ module DiscourseAi
feature_name&.start_with?("ai_helper:")
end
- def initialize(feature_name, persona_prompt_override = nil)
- @persona_class =
- PERSONA_MAP.fetch(feature_name) do
+ def initialize(feature_name, agent_prompt_override = nil)
+ @agent_class =
+ AGENT_MAP.fetch(feature_name) do
raise ArgumentError, "Unsupported AI Helper mode '#{feature_name}'"
end
- super(feature_name, persona_prompt_override)
+ super(feature_name, agent_prompt_override)
end
def run(eval_case, llm, execution_context:)
@@ -55,7 +55,7 @@ module DiscourseAi
private
- attr_reader :feature_name, :persona_class
+ attr_reader :feature_name, :agent_class
def build_user(locale)
return Discourse.system_user if locale.blank?
@@ -77,7 +77,7 @@ module DiscourseAi
bot = build_bot(llm, user)
user_input = build_user_input(input, custom_prompt)
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: user,
skip_show_thinking: true,
feature_name: "ai_helper:#{feature_name}",
@@ -99,13 +99,13 @@ module DiscourseAi
end
def build_bot(llm, user)
- persona = resolve_persona(persona_class: persona_class)
+ agent = resolve_agent(agent_class: agent_class)
- DiscourseAi::Personas::Bot.as(user, persona: persona, model: llm)
+ DiscourseAi::Agents::Bot.as(user, agent: agent, model: llm)
end
def capture_response(bot, context, execution_context:)
- schema_info = bot.persona.response_format&.first
+ schema_info = bot.agent.response_format&.first
if schema_info.present?
capture_structured_response(
diff --git a/plugins/discourse-ai/evals/lib/runners/base.rb b/plugins/discourse-ai/evals/lib/runners/base.rb
index 95d0adab502..111d3a7c33d 100644
--- a/plugins/discourse-ai/evals/lib/runners/base.rb
+++ b/plugins/discourse-ai/evals/lib/runners/base.rb
@@ -9,7 +9,7 @@ module DiscourseAi
raise NotImplemented
end
- def find_runner(feature, persona_prompt)
+ def find_runner(feature, agent_prompt)
registry = [
DiscourseAi::Evals::Runners::AiHelper,
DiscourseAi::Evals::Runners::Translation,
@@ -20,32 +20,32 @@ module DiscourseAi
DiscourseAi::Evals::Runners::Inference,
]
klass = registry.find { |runner| runner.can_handle?(feature) }
- klass&.new(feature.split(":").last, persona_prompt) if klass
+ klass&.new(feature.split(":").last, agent_prompt) if klass
end
end
- attr_reader :feature_name, :persona_prompt_override
+ attr_reader :feature_name, :agent_prompt_override
- def initialize(feature, persona_prompt_override = nil)
+ def initialize(feature, agent_prompt_override = nil)
@feature_name = feature
- @persona_prompt_override = persona_prompt_override
+ @agent_prompt_override = agent_prompt_override
end
private
- def resolve_persona(persona_class: nil)
- if persona_class.nil?
- raise ArgumentError, "Unable to resolve persona for runner (#{self.class.name})"
+ def resolve_agent(agent_class: nil)
+ if agent_class.nil?
+ raise ArgumentError, "Unable to resolve agent for runner (#{self.class.name})"
end
- persona = persona_class.new
+ agent = agent_class.new
- if persona_prompt_override.present?
- override = persona_prompt_override
- persona.define_singleton_method(:system_prompt) { override }
+ if agent_prompt_override.present?
+ override = agent_prompt_override
+ agent.define_singleton_method(:system_prompt) { override }
end
- persona
+ agent
end
def capture_plain_response(bot, context, execution_context:)
diff --git a/plugins/discourse-ai/evals/lib/runners/discoveries.rb b/plugins/discourse-ai/evals/lib/runners/discoveries.rb
index abd3d033d1e..235e2b1e87a 100644
--- a/plugins/discourse-ai/evals/lib/runners/discoveries.rb
+++ b/plugins/discourse-ai/evals/lib/runners/discoveries.rb
@@ -29,18 +29,18 @@ module DiscourseAi
query = case_args[:query].presence || case_args[:input].presence
raise ArgumentError, "Discovery evals require :query or :input" if query.blank?
- persona = resolve_persona(persona_class: DiscourseAi::Personas::Discover)
+ agent = resolve_agent(agent_class: DiscourseAi::Agents::Discover)
user = Discourse.system_user
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: user,
skip_show_thinking: true,
feature_name: "discover",
messages: [{ type: :user, content: query }],
)
- bot = DiscourseAi::Personas::Bot.as(user, persona: persona, model: llm)
+ bot = DiscourseAi::Agents::Bot.as(user, agent: agent, model: llm)
response = capture_plain_response(bot, context, execution_context:).strip
wrap_result(response, { query: query })
diff --git a/plugins/discourse-ai/evals/lib/runners/hyde.rb b/plugins/discourse-ai/evals/lib/runners/hyde.rb
index a64625e8963..894a0c27bf6 100644
--- a/plugins/discourse-ai/evals/lib/runners/hyde.rb
+++ b/plugins/discourse-ai/evals/lib/runners/hyde.rb
@@ -29,18 +29,18 @@ module DiscourseAi
query = case_args[:query].presence || case_args[:input].presence
raise ArgumentError, "HyDE evals require :query or :input" if query.blank?
- persona = resolve_persona(persona_class: DiscourseAi::Personas::ContentCreator)
+ agent = resolve_agent(agent_class: DiscourseAi::Agents::ContentCreator)
user = Discourse.system_user
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: user,
skip_show_thinking: true,
feature_name: "semantic_search_hyde",
messages: [{ type: :user, content: query }],
)
- bot = DiscourseAi::Personas::Bot.as(user, persona: persona, model: llm)
+ bot = DiscourseAi::Agents::Bot.as(user, agent: agent, model: llm)
response = capture_plain_response(bot, context, execution_context:).strip
wrap_result(response, { query: query })
diff --git a/plugins/discourse-ai/evals/lib/runners/inference.rb b/plugins/discourse-ai/evals/lib/runners/inference.rb
index f22994e17dd..dc364e1b7e9 100644
--- a/plugins/discourse-ai/evals/lib/runners/inference.rb
+++ b/plugins/discourse-ai/evals/lib/runners/inference.rb
@@ -8,17 +8,17 @@ module DiscourseAi
class Inference < Base
OPERATIONS = {
"generate_concepts" => {
- persona_class: DiscourseAi::Personas::ConceptFinder,
+ agent_class: DiscourseAi::Agents::ConceptFinder,
schema_key: :concepts,
schema_type: "array",
},
"match_concepts" => {
- persona_class: DiscourseAi::Personas::ConceptMatcher,
+ agent_class: DiscourseAi::Agents::ConceptMatcher,
schema_key: :matching_concepts,
schema_type: "array",
},
"deduplicate_concepts" => {
- persona_class: DiscourseAi::Personas::ConceptDeduplicator,
+ agent_class: DiscourseAi::Agents::ConceptDeduplicator,
schema_key: :streamlined_tags,
schema_type: "array",
},
@@ -52,7 +52,7 @@ module DiscourseAi
content = conversation_to_text(args)
raise ArgumentError, "Missing input for generate concepts eval" if content.blank?
- persona, user = persona_bundle(feature_name)
+ agent, user = agent_bundle(feature_name)
context =
build_ctx.tap do |ctx|
ctx.messages = [{ type: :user, content: content }]
@@ -60,7 +60,7 @@ module DiscourseAi
end
values =
- capture_structured_output(persona, user, llm, context, feature_name, execution_context:)
+ capture_structured_output(agent, user, llm, context, feature_name, execution_context:)
wrap_result(format_response(values), { query: content })
end
@@ -71,7 +71,7 @@ module DiscourseAi
raise ArgumentError, "Match concepts eval requires :input/:conversation and :concepts"
end
- persona, user = persona_bundle(feature_name)
+ agent, user = agent_bundle(feature_name)
context =
build_ctx.tap do |ctx|
@@ -80,7 +80,7 @@ module DiscourseAi
end
values =
- capture_structured_output(persona, user, llm, context, feature_name, execution_context:)
+ capture_structured_output(agent, user, llm, context, feature_name, execution_context:)
wrap_result(format_response(values), { query: content, concepts: candidates })
end
@@ -88,29 +88,29 @@ module DiscourseAi
candidates = args[:concepts].to_a.map(&:to_s)
raise ArgumentError, "Deduplicate concepts eval requires :concepts" if candidates.empty?
- persona, user = persona_bundle(feature_name)
+ agent, user = agent_bundle(feature_name)
context =
build_ctx.tap { |ctx| ctx.messages = [{ type: :user, content: candidates.join(", ") }] }
values =
- capture_structured_output(persona, user, llm, context, feature_name, execution_context:)
+ capture_structured_output(agent, user, llm, context, feature_name, execution_context:)
wrap_result(format_response(values), { concepts: candidates })
end
- def persona_bundle(op)
+ def agent_bundle(op)
config = OPERATIONS.fetch(op) { raise ArgumentError }
- persona_klass = config.fetch(:persona_class)
+ agent_klass = config.fetch(:agent_class)
- resolve_persona(persona_class: persona_klass)
+ resolve_agent(agent_class: agent_klass)
end
- def capture_structured_output(persona, user, llm, context, op, execution_context:)
+ def capture_structured_output(agent, user, llm, context, op, execution_context:)
schema = OPERATIONS.fetch(op)
schema_key = schema[:schema_key]
schema_type = schema[:schema_type] || "array"
- bot = DiscourseAi::Personas::Bot.as(user, persona: persona, model: llm)
+ bot = DiscourseAi::Agents::Bot.as(user, agent: agent, model: llm)
capture_structured_response(
bot,
context,
@@ -137,7 +137,7 @@ module DiscourseAi
end
def build_ctx
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: Discourse.system_user,
skip_show_thinking: true,
feature_name: "evals/inference/#{feature_name}",
diff --git a/plugins/discourse-ai/evals/lib/runners/spam.rb b/plugins/discourse-ai/evals/lib/runners/spam.rb
index 6b95e19d947..51dd25dd7ff 100644
--- a/plugins/discourse-ai/evals/lib/runners/spam.rb
+++ b/plugins/discourse-ai/evals/lib/runners/spam.rb
@@ -12,13 +12,13 @@ module DiscourseAi
def run(eval_case, llm, execution_context:)
args = eval_case.args
- persona = resolve_persona(persona_class: DiscourseAi::Personas::SpamDetector)
+ agent = resolve_agent(agent_class: DiscourseAi::Agents::SpamDetector)
user = Discourse.system_user
content = "- Topic title: #{args[:title]}\nPost content: #{args[:input]}"
context =
- DiscourseAi::Personas::BotContext
+ DiscourseAi::Agents::BotContext
.new(
user: user,
skip_show_thinking: true,
@@ -29,16 +29,16 @@ module DiscourseAi
ctx.custom_instructions = args[:custom_instructions] if args[:custom_instructions]
end
- verdict = capture_verdict(persona, user, llm, context, execution_context:)
+ verdict = capture_verdict(agent, user, llm, context, execution_context:)
wrap_result(verdict.to_s, { feature: feature_name })
end
private
- def capture_verdict(persona, user, llm, context, execution_context:)
- bot = DiscourseAi::Personas::Bot.as(user, persona: persona, model: llm)
- schema = persona.response_format&.first
+ def capture_verdict(agent, user, llm, context, execution_context:)
+ bot = DiscourseAi::Agents::Bot.as(user, agent: agent, model: llm)
+ schema = agent.response_format&.first
if schema.present?
capture_structured_response(
diff --git a/plugins/discourse-ai/evals/lib/runners/summarization.rb b/plugins/discourse-ai/evals/lib/runners/summarization.rb
index ca5dc67c9e2..54f5d25842c 100644
--- a/plugins/discourse-ai/evals/lib/runners/summarization.rb
+++ b/plugins/discourse-ai/evals/lib/runners/summarization.rb
@@ -27,11 +27,11 @@ module DiscourseAi
{ poster: user.username, id: index + 1, text: text }
end
- persona_class, strategy = persona_and_strategy(topic)
- persona = resolve_persona(persona_class: persona_class)
+ agent_class, strategy = agent_and_strategy(topic)
+ agent = resolve_agent(agent_class: agent_class)
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: user,
skip_show_thinking: true,
feature_name: "evals/#{feature_name}",
@@ -39,22 +39,22 @@ module DiscourseAi
messages: strategy.as_llm_messages(content),
)
- summary = capture_summary(persona, user, llm, context, execution_context:)
+ summary = capture_summary(agent, user, llm, context, execution_context:)
wrap_result(summary, { feature: feature_name })
end
private
- def persona_and_strategy(topic)
+ def agent_and_strategy(topic)
if regular_summaries?
[
- DiscourseAi::Personas::Summarizer,
+ DiscourseAi::Agents::Summarizer,
DiscourseAi::Summarization::Strategies::TopicSummary.new(topic),
]
elsif gists?
[
- DiscourseAi::Personas::ShortSummarizer,
+ DiscourseAi::Agents::ShortSummarizer,
DiscourseAi::Summarization::Strategies::HotTopicGists.new(topic),
]
else
@@ -62,9 +62,9 @@ module DiscourseAi
end
end
- def capture_summary(persona, user, llm, context, execution_context:)
- bot = DiscourseAi::Personas::Bot.as(user, persona: persona, model: llm)
- schema = persona.response_format&.first
+ def capture_summary(agent, user, llm, context, execution_context:)
+ bot = DiscourseAi::Agents::Bot.as(user, agent: agent, model: llm)
+ schema = agent.response_format&.first
if schema.present?
capture_structured_response(
diff --git a/plugins/discourse-ai/evals/lib/runners/translation.rb b/plugins/discourse-ai/evals/lib/runners/translation.rb
index 75b60a3aea3..629c3eeb690 100644
--- a/plugins/discourse-ai/evals/lib/runners/translation.rb
+++ b/plugins/discourse-ai/evals/lib/runners/translation.rb
@@ -7,10 +7,10 @@ module DiscourseAi
module Runners
class Translation < Base
OPERATIONS = {
- "locale_detector" => DiscourseAi::Personas::LocaleDetector,
- "post_raw_translator" => DiscourseAi::Personas::PostRawTranslator,
- "topic_title_translator" => DiscourseAi::Personas::TopicTitleTranslator,
- "short_text_translator" => DiscourseAi::Personas::ShortTextTranslator,
+ "locale_detector" => DiscourseAi::Agents::LocaleDetector,
+ "post_raw_translator" => DiscourseAi::Agents::PostRawTranslator,
+ "topic_title_translator" => DiscourseAi::Agents::TopicTitleTranslator,
+ "short_text_translator" => DiscourseAi::Agents::ShortTextTranslator,
}.freeze
def self.can_handle?(feature_name)
@@ -65,31 +65,31 @@ module DiscourseAi
end
def detect_locale(content, llm, execution_context:)
- persona = persona_for_operation
+ agent = agent_for_operation
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: system_user,
skip_show_thinking: true,
feature_name: "translation/#{operation}",
messages: [{ type: :user, content: content }],
)
- bot = DiscourseAi::Personas::Bot.as(system_user, persona: persona, model: llm)
+ bot = DiscourseAi::Agents::Bot.as(system_user, agent: agent, model: llm)
capture_plain_response(bot, context, execution_context:).strip
end
def translate_content(content, target_locale, llm, execution_context:)
- persona = persona_for_operation
+ agent = agent_for_operation
payload = { content:, target_locale: }.to_json
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: system_user,
skip_show_thinking: true,
feature_name: "translation/#{operation}",
messages: [{ type: :user, content: payload }],
)
- bot = DiscourseAi::Personas::Bot.as(system_user, persona: persona, model: llm)
+ bot = DiscourseAi::Agents::Bot.as(system_user, agent: agent, model: llm)
capture_plain_response(bot, context, execution_context:).strip
end
@@ -115,9 +115,9 @@ module DiscourseAi
@user ||= Discourse.system_user
end
- def persona_for_operation
- persona_class = OPERATIONS.fetch(operation)
- resolve_persona(persona_class: persona_class)
+ def agent_for_operation
+ agent_class = OPERATIONS.fetch(operation)
+ resolve_agent(agent_class: agent_class)
end
end
end
diff --git a/plugins/discourse-ai/evals/lib/workbench.rb b/plugins/discourse-ai/evals/lib/workbench.rb
index be3d69a3c89..1f4a0e079be 100644
--- a/plugins/discourse-ai/evals/lib/workbench.rb
+++ b/plugins/discourse-ai/evals/lib/workbench.rb
@@ -12,7 +12,7 @@ require_relative "runners/inference"
require_relative "runners/spam"
require_relative "runners/summarization"
require_relative "judge"
-require_relative "persona_prompt_loader"
+require_relative "agent_prompt_loader"
require_relative "console_formatter"
module DiscourseAi
@@ -25,32 +25,32 @@ module DiscourseAi
# keeps higher-level scripts (`evals/run`) simple while centralizing
# instrumentation and error handling.
class Workbench
- def initialize(output: $stdout, judge_llm: nil, persona_variants: nil, comparison: nil)
+ def initialize(output: $stdout, judge_llm: nil, agent_variants: nil, comparison: nil)
@output = output
@judge_llm = judge_llm
- @persona_variants = persona_variants
+ @agent_variants = agent_variants
@comparison = comparison
end
- def run_evals(eval_cases:, llms: nil, persona_variants: nil)
- persona_variants ||= @persona_variants || [{ key: :default, prompt: nil }]
+ def run_evals(eval_cases:, llms: nil, agent_variants: nil)
+ agent_variants ||= @agent_variants || [{ key: :default, prompt: nil }]
formatter =
- build_formatter(eval_cases: eval_cases, llms: llms, persona_variants: persona_variants)
+ build_formatter(eval_cases: eval_cases, llms: llms, agent_variants: agent_variants)
formatter.announce_start
if running_comparisons?
compare(
eval_cases: eval_cases,
llms: llms,
- persona_variants: persona_variants,
+ agent_variants: agent_variants,
formatter: formatter,
)
else
run(
eval_cases: eval_cases,
llms: llms,
- persona_variants: persona_variants,
+ agent_variants: agent_variants,
formatter: formatter,
)
end
@@ -58,25 +58,20 @@ module DiscourseAi
formatter&.finalize
end
- def compare(
- eval_cases:,
- llms:,
- persona_variants: [{ key: :default, prompt: nil }],
- formatter:
- )
+ def compare(eval_cases:, llms:, agent_variants: [{ key: :default, prompt: nil }], formatter:)
aggregate_scores = Hash.new { |h, k| h[k] = { passes: 0, evals: eval_cases.length } }
eval_cases.each do |eval_case|
- persona_compare = persona_variants.length > 1 && llms.length == 1
- total_targets = persona_compare ? persona_variants.length : llms.length
- persona_label = persona_compare ? "multiple" : persona_variants.first&.dig(:key)
+ agent_compare = agent_variants.length > 1 && llms.length == 1
+ total_targets = agent_compare ? agent_variants.length : llms.length
+ agent_label = agent_compare ? "multiple" : agent_variants.first&.dig(:key)
recorder =
Recorder.with_cassette(
eval_case,
output: output,
total_targets: total_targets,
- persona_key: persona_label,
+ agent_key: agent_label,
formatter: formatter,
announce_formatter: false,
finalize_formatter: false,
@@ -84,11 +79,11 @@ module DiscourseAi
execution_context = recorder.execution_context
candidates = []
- persona_variants.each do |variant|
+ agent_variants.each do |variant|
llms.each do |llm|
llm_name = llm.display_name || llm.name
start_time = Time.now.utc
- display_label = table_label_for(variant, llm_name, persona_compare)
+ display_label = table_label_for(variant, llm_name, agent_compare)
execution =
execute_eval(eval_case, llm, variant, skip_judge: true, execution_context:)
@@ -118,7 +113,7 @@ module DiscourseAi
variant: variant,
llm_name: llm_name,
execution: execution,
- persona_compare: persona_compare,
+ agent_compare: agent_compare,
display_label: display_label,
)
rescue DiscourseAi::Evals::Eval::EvalError => e
@@ -146,7 +141,7 @@ module DiscourseAi
recorder,
eval_case,
candidates,
- persona_variants.first&.dig(:key),
+ agent_variants.first&.dig(:key),
aggregate_scores,
execution_context:,
)
@@ -155,18 +150,18 @@ module DiscourseAi
end
end
- def run(eval_cases:, llms:, persona_variants: [{ key: :default, prompt: nil }], formatter:)
- # We only allow one persona at a time here.
+ def run(eval_cases:, llms:, agent_variants: [{ key: :default, prompt: nil }], formatter:)
+ # We only allow one agent at a time here.
# If not specified, will contain an element with the default key.
- variant = persona_variants.first
+ variant = agent_variants.first
eval_cases.each do |eval_case|
recorder =
Recorder.with_cassette(
eval_case,
output: output,
- total_targets: persona_variants.length * llms.length,
- persona_key: variant&.dig(:key),
+ total_targets: agent_variants.length * llms.length,
+ agent_key: variant&.dig(:key),
formatter: formatter,
announce_formatter: false,
finalize_formatter: false,
@@ -235,7 +230,7 @@ module DiscourseAi
def execute_eval(
eval_case,
llm,
- persona_variant = { key: :default, prompt: nil },
+ agent_variant = { key: :default, prompt: nil },
skip_judge: false,
execution_context: nil
)
@@ -252,7 +247,7 @@ module DiscourseAi
)
end
- runner = DiscourseAi::Evals::Runners::Base.find_runner(feature, persona_variant[:prompt])
+ runner = DiscourseAi::Evals::Runners::Base.find_runner(feature, agent_variant[:prompt])
raw =
if runner
@@ -288,7 +283,7 @@ module DiscourseAi
private
- attr_reader :output, :judge_llm, :persona_variants, :comparison
+ attr_reader :output, :judge_llm, :agent_variants, :comparison
def normalize_entries(raw)
raw.is_a?(Array) ? raw : [raw]
@@ -312,13 +307,13 @@ module DiscourseAi
recorder,
eval_case,
candidates,
- persona_key,
+ agent_key,
aggregate_scores,
execution_context: nil
)
return if candidates.length < 2
- mode_label = comparison_mode_label(persona_key, candidates)
+ mode_label = comparison_mode_label(agent_key, candidates)
if judge_llm.present? || eval_case.judge.present?
judged =
@@ -329,13 +324,13 @@ module DiscourseAi
recorder.announce_comparison_judged(
eval_case_id: eval_case.id,
mode_label: mode_label,
- persona_key: persona_key,
+ agent_key: agent_key,
result: judged,
candidates: candidates,
)
recorder.announce_comparison_aggregate(
mode_label: mode_label,
- persona_key: persona_key,
+ agent_key: agent_key,
aggregate_scores: aggregate_scores,
)
else
@@ -360,7 +355,7 @@ module DiscourseAi
recorder.announce_comparison_expected(
eval_case_id: eval_case.id,
mode_label: mode_label,
- persona_key: persona_key,
+ agent_key: agent_key,
winner: winner,
status_line: status_line,
failures: failures,
@@ -368,7 +363,7 @@ module DiscourseAi
)
recorder.announce_comparison_aggregate(
mode_label: mode_label,
- persona_key: persona_key,
+ agent_key: agent_key,
aggregate_scores: aggregate_scores,
)
end
@@ -393,19 +388,19 @@ module DiscourseAi
entries.join(" -- ")
end
- def comparison_mode_label(persona_key, candidates)
- unique_personas = candidates.map { |c| c[:persona_label] }.compact.uniq
- unique_personas.length > 1 ? "personas" : "LLMs"
+ def comparison_mode_label(agent_key, candidates)
+ unique_agents = candidates.map { |c| c[:agent_label] }.compact.uniq
+ unique_agents.length > 1 ? "agents" : "LLMs"
end
- def table_label_for(variant, llm_name, persona_compare)
- persona_key = variant[:key]
- persona_label = persona_key.presence || :default
+ def table_label_for(variant, llm_name, agent_compare)
+ agent_key = variant[:key]
+ agent_label = agent_key.presence || :default
- if persona_compare
- persona_label
- elsif persona_label != :default && persona_label != "default"
- "#{llm_name} (#{persona_label})"
+ if agent_compare
+ agent_label
+ elsif agent_label != :default && agent_label != "default"
+ "#{llm_name} (#{agent_label})"
else
llm_name
end
@@ -427,19 +422,19 @@ module DiscourseAi
variant:,
llm_name:,
execution:,
- persona_compare:,
+ agent_compare:,
display_label:
)
output =
normalize_candidate_output(
eval_case,
execution[:raw_entries],
- persona_compare ? variant[:key] : llm_name,
+ agent_compare ? variant[:key] : llm_name,
)
{
- label: persona_compare ? variant[:key] : llm_name,
+ label: agent_compare ? variant[:key] : llm_name,
display_label: display_label,
- persona_label: variant[:key],
+ agent_label: variant[:key],
classified_entries: execution[:classified],
output: output,
}
@@ -512,17 +507,17 @@ module DiscourseAi
end
end
- def print_persona_heading(variant)
+ def print_agent_heading(variant)
return unless variant[:key]
label =
- if variant[:key] == DiscourseAi::Evals::PersonaPromptLoader::DEFAULT_PERSONA_KEY
+ if variant[:key] == DiscourseAi::Evals::AgentPromptLoader::DEFAULT_AGENT_KEY
"default (built-in)"
else
variant[:key]
end
- output.puts "\n=== Persona: #{label} ==="
+ output.puts "\n=== Agent: #{label} ==="
end
def judge_result(eval_case, result, execution_context: nil)
@@ -539,24 +534,24 @@ module DiscourseAi
)
end
- def build_formatter(eval_cases:, llms:, persona_variants:)
- persona_variants ||= [{ key: :default, prompt: nil }]
+ def build_formatter(eval_cases:, llms:, agent_variants:)
+ agent_variants ||= [{ key: :default, prompt: nil }]
total_targets =
if running_comparisons?
- persona_compare = persona_variants.length > 1 && llms.length == 1
- persona_compare ? persona_variants.length : llms.length
+ agent_compare = agent_variants.length > 1 && llms.length == 1
+ agent_compare ? agent_variants.length : llms.length
else
- persona_variants.length * llms.length
+ agent_variants.length * llms.length
end
run_label = "eval run (#{eval_cases.length} cases)"
- persona_key = persona_variants.first&.dig(:key)
+ agent_key = agent_variants.first&.dig(:key)
DiscourseAi::Evals::ConsoleFormatter.new(
label: run_label,
output: output,
total_targets: total_targets,
- persona_key: persona_key,
+ agent_key: agent_key,
)
end
diff --git a/plugins/discourse-ai/evals/run b/plugins/discourse-ai/evals/run
index 31f00ebaedf..b4abca95def 100755
--- a/plugins/discourse-ai/evals/run
+++ b/plugins/discourse-ai/evals/run
@@ -9,7 +9,7 @@ require_relative "lib/prompts/single_test_runner"
require_relative "lib/features"
require_relative "lib/recorder"
require_relative "lib/workbench"
-require_relative "lib/persona_prompt_loader"
+require_relative "lib/agent_prompt_loader"
require_relative "lib/cli"
features_registry =
@@ -28,10 +28,10 @@ if cli.list_features
exit 0
end
-persona_loader = DiscourseAi::Evals::PersonaPromptLoader.new
+agent_loader = DiscourseAi::Evals::AgentPromptLoader.new
-if cli.list_personas
- persona_loader.print
+if cli.list_agents
+ agent_loader.print
exit 0
end
@@ -78,10 +78,10 @@ if judge_name.present?
end
end
-persona_variants =
- persona_loader.variants_for(cli.persona_keys, comparison_mode: cli.comparison_mode)
+agent_variants =
+ agent_loader.variants_for(cli.agent_keys, comparison_mode: cli.comparison_mode)
-cli.validate_comparison_requirements!(llms: llms, persona_variants: persona_variants)
+cli.validate_comparison_requirements!(llms: llms, agent_variants: agent_variants)
cli.validate_judge_presence!(
requires_judge: requires_judge,
@@ -92,6 +92,6 @@ cli.validate_judge_presence!(
DiscourseAi::Evals::Workbench.new(
output: $stdout,
judge_llm: judge_llm,
- persona_variants: persona_variants,
+ agent_variants: agent_variants,
comparison: cli.comparison_mode,
-).run_evals(eval_cases: selected_evals, llms: llms, persona_variants: persona_variants)
+).run_evals(eval_cases: selected_evals, llms: llms, agent_variants: agent_variants)
diff --git a/plugins/discourse-ai/lib/personas/persona.rb b/plugins/discourse-ai/lib/agents/agent.rb
similarity index 91%
rename from plugins/discourse-ai/lib/personas/persona.rb
rename to plugins/discourse-ai/lib/agents/agent.rb
index dbd4096ffc6..8f11098728e 100644
--- a/plugins/discourse-ai/lib/personas/persona.rb
+++ b/plugins/discourse-ai/lib/agents/agent.rb
@@ -1,8 +1,8 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
- class Persona
+ module Agents
+ class Agent
class << self
def default_enabled
true
@@ -48,8 +48,8 @@ module DiscourseAi
false
end
- def system_personas
- @system_personas ||= {
+ def system_agents
+ @system_agents ||= {
General => -1,
SqlHelper => -2,
Artist => -3,
@@ -87,17 +87,17 @@ module DiscourseAi
}
end
- def system_personas_by_id
- @system_personas_by_id ||= system_personas.invert
+ def system_agents_by_id
+ @system_agents_by_id ||= system_agents.invert
end
def all(user:)
# listing tools has to be dynamic cause site settings may change
- AiPersona.all_personas.filter do |persona|
- next false if !user.in_any_groups?(persona.allowed_group_ids)
+ AiAgent.all_agents.filter do |agent|
+ next false if !user.in_any_groups?(agent.allowed_group_ids)
- if persona.system
- instance = persona.new
+ if agent.system
+ instance = agent.new
(
instance.required_tools == [] ||
(instance.required_tools - all_available_tools).empty?
@@ -109,15 +109,15 @@ module DiscourseAi
end
def find_by(id: nil, name: nil, user:)
- all(user: user).find { |persona| persona.id == id || persona.name == name }
+ all(user: user).find { |agent| agent.id == id || agent.name == name }
end
def name
- I18n.t("discourse_ai.ai_bot.personas.#{to_s.demodulize.underscore}.name")
+ I18n.t("discourse_ai.ai_bot.agents.#{to_s.demodulize.underscore}.name")
end
def description
- I18n.t("discourse_ai.ai_bot.personas.#{to_s.demodulize.underscore}.description")
+ I18n.t("discourse_ai.ai_bot.agents.#{to_s.demodulize.underscore}.description")
end
def all_available_tools
@@ -183,8 +183,8 @@ module DiscourseAi
end
def id
- @ai_persona&.id || self.class.system_personas[self.class.superclass] ||
- self.class.system_personas[self.class]
+ @ai_agent&.id || self.class.system_agents[self.class.superclass] ||
+ self.class.system_agents[self.class]
end
def tools
@@ -283,7 +283,7 @@ module DiscourseAi
prompt.max_pixels = self.class.vision_max_pixels if self.class.vision_enabled
prompt.tools = available_tools.map(&:signature) if available_tools
available_tools.each do |tool|
- tool.inject_prompt(prompt: prompt, context: context, persona: self)
+ tool.inject_prompt(prompt: prompt, context: context, agent: self)
end
prompt
end
@@ -364,7 +364,7 @@ module DiscourseAi
tool_klass.new(
arguments,
tool_call_id: function_id || function_name,
- persona_options: options[tool_klass].to_h,
+ agent_options: options[tool_klass].to_h,
bot_user: bot_user,
llm: llm,
context: context,
@@ -388,8 +388,7 @@ module DiscourseAi
end
def rag_fragments_prompt(conversation_context, llm:, user:)
- upload_refs =
- UploadReference.where(target_id: id, target_type: "AiPersona").pluck(:upload_id)
+ upload_refs = UploadReference.where(target_id: id, target_type: "AiAgent").pluck(:upload_id)
return nil if !DiscourseAi::Embeddings.enabled?
return nil if conversation_context.blank? || upload_refs.blank?
@@ -404,7 +403,7 @@ module DiscourseAi
consolidated_question = DiscourseAi::Completions::Prompt.text_only(latest_interactions[0])
else
consolidated_question =
- DiscourseAi::Personas::QuestionConsolidator.consolidate_question(
+ DiscourseAi::Agents::QuestionConsolidator.consolidate_question(
llm,
latest_interactions,
user,
@@ -434,7 +433,7 @@ module DiscourseAi
interactions_vector,
limit: search_limit,
offset: 0,
- ) { |builder| builder.join(<<~SQL, target_id: id, target_type: "AiPersona") }
+ ) { |builder| builder.join(<<~SQL, target_id: id, target_type: "AiAgent") }
rag_document_fragments ON
rag_document_fragments.id = rag_document_fragment_id AND
rag_document_fragments.target_id = :target_id AND
diff --git a/plugins/discourse-ai/lib/personas/artifact_update_strategies/base.rb b/plugins/discourse-ai/lib/agents/artifact_update_strategies/base.rb
similarity index 95%
rename from plugins/discourse-ai/lib/personas/artifact_update_strategies/base.rb
rename to plugins/discourse-ai/lib/agents/artifact_update_strategies/base.rb
index 457008fb3a9..496aaf0a29d 100644
--- a/plugins/discourse-ai/lib/personas/artifact_update_strategies/base.rb
+++ b/plugins/discourse-ai/lib/agents/artifact_update_strategies/base.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module ArtifactUpdateStrategies
class InvalidFormatError < StandardError
end
@@ -42,7 +42,7 @@ module DiscourseAi
def storage_api
if @artifact.metadata.is_a?(Hash) && @artifact.metadata["requires_storage"]
- DiscourseAi::Personas::Tools::CreateArtifact.storage_api
+ DiscourseAi::Agents::Tools::CreateArtifact.storage_api
end
end
diff --git a/plugins/discourse-ai/lib/personas/artifact_update_strategies/diff.rb b/plugins/discourse-ai/lib/agents/artifact_update_strategies/diff.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/artifact_update_strategies/diff.rb
rename to plugins/discourse-ai/lib/agents/artifact_update_strategies/diff.rb
index fb078691368..430b99e5c8c 100644
--- a/plugins/discourse-ai/lib/personas/artifact_update_strategies/diff.rb
+++ b/plugins/discourse-ai/lib/agents/artifact_update_strategies/diff.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module ArtifactUpdateStrategies
class Diff < Base
attr_reader :failed_searches
diff --git a/plugins/discourse-ai/lib/personas/artifact_update_strategies/full.rb b/plugins/discourse-ai/lib/agents/artifact_update_strategies/full.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/artifact_update_strategies/full.rb
rename to plugins/discourse-ai/lib/agents/artifact_update_strategies/full.rb
index ffbf87e5c44..5cec696e224 100644
--- a/plugins/discourse-ai/lib/personas/artifact_update_strategies/full.rb
+++ b/plugins/discourse-ai/lib/agents/artifact_update_strategies/full.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module ArtifactUpdateStrategies
class Full < Base
private
diff --git a/plugins/discourse-ai/lib/personas/artist.rb b/plugins/discourse-ai/lib/agents/artist.rb
similarity index 95%
rename from plugins/discourse-ai/lib/personas/artist.rb
rename to plugins/discourse-ai/lib/agents/artist.rb
index 8c81d98594b..3f7bc37261b 100644
--- a/plugins/discourse-ai/lib/personas/artist.rb
+++ b/plugins/discourse-ai/lib/agents/artist.rb
@@ -1,15 +1,15 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
- class Artist < Persona
+ module Agents
+ class Artist < Agent
def tools
# Only include Tools::Image if custom image generation tools are configured
Tools::Tool.available_custom_image_tools.present? ? [Tools::Image] : []
end
def required_tools
- # Always require Tools::Image - availability is checked by Persona.all()
+ # Always require Tools::Image - availability is checked by Agent.all()
[Tools::Image]
end
diff --git a/plugins/discourse-ai/lib/personas/bot.rb b/plugins/discourse-ai/lib/agents/bot.rb
similarity index 93%
rename from plugins/discourse-ai/lib/personas/bot.rb
rename to plugins/discourse-ai/lib/agents/bot.rb
index b89cfe0b063..26357c85162 100644
--- a/plugins/discourse-ai/lib/personas/bot.rb
+++ b/plugins/discourse-ai/lib/agents/bot.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
class Bot
BOT_NOT_FOUND = Class.new(StandardError)
@@ -22,20 +22,20 @@ module DiscourseAi
prompt.push(type: :user, content: BUDGET_EXHAUSTED_HINT)
end
- def self.as(bot_user, persona: DiscourseAi::Personas::General.new, model: nil)
- new(bot_user, persona, model)
+ def self.as(bot_user, agent: DiscourseAi::Agents::General.new, model: nil)
+ new(bot_user, agent, model)
end
- def initialize(bot_user, persona, model = nil)
+ def initialize(bot_user, agent, model = nil)
@bot_user = bot_user
- @persona = persona
+ @agent = agent
@model =
model || self.class.guess_model(bot_user) ||
- LlmModel.find(@persona.class.default_llm_id || SiteSetting.ai_default_llm_model)
+ LlmModel.find(@agent.class.default_llm_id || SiteSetting.ai_default_llm_model)
end
attr_reader :bot_user, :model
- attr_accessor :persona
+ attr_accessor :agent
def llm
DiscourseAi::Completions::Llm.proxy(model)
@@ -45,12 +45,12 @@ module DiscourseAi
return if prompt.tool_choice == :none
context.chosen_tools ||= []
- forced_tools = persona.force_tool_use.map { |tool| tool.name }
+ forced_tools = agent.force_tool_use.map { |tool| tool.name }
force_tool = forced_tools.find { |name| !context.chosen_tools.include?(name) }
- if force_tool && persona.forced_tool_count > 0
+ if force_tool && agent.forced_tool_count > 0
user_turns = prompt.messages.select { |m| m[:type] == :user }.length
- force_tool = false if user_turns > persona.forced_tool_count
+ force_tool = false if user_turns > agent.forced_tool_count
end
if force_tool
@@ -69,7 +69,7 @@ module DiscourseAi
context.cancel_manager ||= DiscourseAi::Completions::CancelManager.new
current_llm = llm
- prompt = persona.craft_prompt(context, llm: current_llm)
+ prompt = agent.craft_prompt(context, llm: current_llm)
total_completions = 0
ongoing_chain = true
@@ -79,18 +79,18 @@ module DiscourseAi
llm_kwargs = llm_args.dup
llm_kwargs[:user] = user
- llm_kwargs[:temperature] = persona.temperature if persona.temperature
- llm_kwargs[:top_p] = persona.top_p if persona.top_p
+ llm_kwargs[:temperature] = agent.temperature if agent.temperature
+ llm_kwargs[:top_p] = agent.top_p if agent.top_p
- if !context.bypass_response_format && persona.response_format.present?
- llm_kwargs[:response_format] = build_json_schema(persona.response_format)
+ if !context.bypass_response_format && agent.response_format.present?
+ llm_kwargs[:response_format] = build_json_schema(agent.response_format)
end
needs_newlines = false
tools_ran = 0
- use_token_budget = persona.class.execution_mode == "agentic"
- token_budget = persona.class.max_turn_tokens
+ use_token_budget = agent.class.execution_mode == "agentic"
+ token_budget = agent.class.max_turn_tokens
# In token budget mode, compression manages context size instead of
# the dialect's destructive trim_messages. Disabling trim prevents
@@ -135,7 +135,7 @@ module DiscourseAi
tool_halted = false
- allow_partial_tool_calls = persona.allow_partial_tool_calls?
+ allow_partial_tool_calls = agent.allow_partial_tool_calls?
existing_tools = Set.new
current_thinking = []
thinking_placeholder = nil
@@ -150,7 +150,7 @@ module DiscourseAi
**llm_kwargs,
) do |partial|
tool =
- persona.find_tool(
+ agent.find_tool(
partial,
bot_user: user,
llm: current_llm,
@@ -258,7 +258,7 @@ module DiscourseAi
end
def returns_json?
- persona.response_format.present?
+ agent.response_format.present?
end
private
@@ -419,7 +419,7 @@ module DiscourseAi
return if max_tokens.blank? || max_tokens <= 0
tokenizer = current_llm.tokenizer
- threshold_pct = (persona.class.compression_threshold || 85) / 100.0
+ threshold_pct = (agent.class.compression_threshold || 85) / 100.0
threshold = (max_tokens * threshold_pct).to_i
estimated_tokens =
@@ -535,7 +535,7 @@ module DiscourseAi
def self.guess_model(bot_user)
associated_llm = LlmModel.find_by(user_id: bot_user.id)
- return if associated_llm.nil? # Might be a persona user. Handled by constructor.
+ return if associated_llm.nil? # Might be a agent user. Handled by constructor.
associated_llm
end
diff --git a/plugins/discourse-ai/lib/personas/bot_context.rb b/plugins/discourse-ai/lib/agents/bot_context.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/bot_context.rb
rename to plugins/discourse-ai/lib/agents/bot_context.rb
index 69d58ea5827..10c61e6cbaa 100644
--- a/plugins/discourse-ai/lib/personas/bot_context.rb
+++ b/plugins/discourse-ai/lib/agents/bot_context.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
class BotContext
attr_accessor :messages,
:topic_id,
diff --git a/plugins/discourse-ai/lib/personas/chat_thread_titler.rb b/plugins/discourse-ai/lib/agents/chat_thread_titler.rb
similarity index 95%
rename from plugins/discourse-ai/lib/personas/chat_thread_titler.rb
rename to plugins/discourse-ai/lib/agents/chat_thread_titler.rb
index 9117f63dafd..61d30c9e548 100644
--- a/plugins/discourse-ai/lib/personas/chat_thread_titler.rb
+++ b/plugins/discourse-ai/lib/agents/chat_thread_titler.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class ChatThreadTitler < Persona
+ module Agents
+ class ChatThreadTitler < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/concept_deduplicator.rb b/plugins/discourse-ai/lib/agents/concept_deduplicator.rb
similarity index 98%
rename from plugins/discourse-ai/lib/personas/concept_deduplicator.rb
rename to plugins/discourse-ai/lib/agents/concept_deduplicator.rb
index 9f93d68178a..ef90ca16d2b 100644
--- a/plugins/discourse-ai/lib/personas/concept_deduplicator.rb
+++ b/plugins/discourse-ai/lib/agents/concept_deduplicator.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class ConceptDeduplicator < Persona
+ module Agents
+ class ConceptDeduplicator < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/concept_finder.rb b/plugins/discourse-ai/lib/agents/concept_finder.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/concept_finder.rb
rename to plugins/discourse-ai/lib/agents/concept_finder.rb
index 283c1e9db1e..068abc06a72 100644
--- a/plugins/discourse-ai/lib/personas/concept_finder.rb
+++ b/plugins/discourse-ai/lib/agents/concept_finder.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class ConceptFinder < Persona
+ module Agents
+ class ConceptFinder < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/concept_matcher.rb b/plugins/discourse-ai/lib/agents/concept_matcher.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/concept_matcher.rb
rename to plugins/discourse-ai/lib/agents/concept_matcher.rb
index 46b77817f4a..9196ae98f93 100644
--- a/plugins/discourse-ai/lib/personas/concept_matcher.rb
+++ b/plugins/discourse-ai/lib/agents/concept_matcher.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class ConceptMatcher < Persona
+ module Agents
+ class ConceptMatcher < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/content_creator.rb b/plugins/discourse-ai/lib/agents/content_creator.rb
similarity index 94%
rename from plugins/discourse-ai/lib/personas/content_creator.rb
rename to plugins/discourse-ai/lib/agents/content_creator.rb
index f29dc2e7b2d..af0e36af5e2 100644
--- a/plugins/discourse-ai/lib/personas/content_creator.rb
+++ b/plugins/discourse-ai/lib/agents/content_creator.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class ContentCreator < Persona
+ module Agents
+ class ContentCreator < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/creative.rb b/plugins/discourse-ai/lib/agents/creative.rb
similarity index 81%
rename from plugins/discourse-ai/lib/personas/creative.rb
rename to plugins/discourse-ai/lib/agents/creative.rb
index 407c22409cb..30a54015949 100644
--- a/plugins/discourse-ai/lib/personas/creative.rb
+++ b/plugins/discourse-ai/lib/agents/creative.rb
@@ -1,8 +1,8 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
- class Creative < Persona
+ module Agents
+ class Creative < Agent
def tools
[]
end
diff --git a/plugins/discourse-ai/lib/personas/custom_prompt.rb b/plugins/discourse-ai/lib/agents/custom_prompt.rb
similarity index 93%
rename from plugins/discourse-ai/lib/personas/custom_prompt.rb
rename to plugins/discourse-ai/lib/agents/custom_prompt.rb
index 1a599aea9c4..75350aff52b 100644
--- a/plugins/discourse-ai/lib/personas/custom_prompt.rb
+++ b/plugins/discourse-ai/lib/agents/custom_prompt.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class CustomPrompt < Persona
+ module Agents
+ class CustomPrompt < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/designer.rb b/plugins/discourse-ai/lib/agents/designer.rb
similarity index 94%
rename from plugins/discourse-ai/lib/personas/designer.rb
rename to plugins/discourse-ai/lib/agents/designer.rb
index ecb6a7e1b9e..1427f0f7c24 100644
--- a/plugins/discourse-ai/lib/personas/designer.rb
+++ b/plugins/discourse-ai/lib/agents/designer.rb
@@ -1,8 +1,8 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
- class Designer < Persona
+ module Agents
+ class Designer < Agent
def tools
# Only include image tools if custom image generation tools are configured
if Tools::Tool.available_custom_image_tools.present?
@@ -13,7 +13,7 @@ module DiscourseAi
end
def required_tools
- # Always require image tools - availability is checked by Persona.all()
+ # Always require image tools - availability is checked by Agent.all()
[Tools::CreateImage, Tools::EditImage]
end
diff --git a/plugins/discourse-ai/lib/personas/discourse_helper.rb b/plugins/discourse-ai/lib/agents/discourse_helper.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/discourse_helper.rb
rename to plugins/discourse-ai/lib/agents/discourse_helper.rb
index a5c0a2682d2..ca04b3708b6 100644
--- a/plugins/discourse-ai/lib/personas/discourse_helper.rb
+++ b/plugins/discourse-ai/lib/agents/discourse_helper.rb
@@ -1,8 +1,8 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
- class DiscourseHelper < Persona
+ module Agents
+ class DiscourseHelper < Agent
def tools
[Tools::DiscourseMetaSearch]
end
diff --git a/plugins/discourse-ai/lib/personas/discover.rb b/plugins/discourse-ai/lib/agents/discover.rb
similarity index 98%
rename from plugins/discourse-ai/lib/personas/discover.rb
rename to plugins/discourse-ai/lib/agents/discover.rb
index 4af2bc0db64..c18fd8c2d32 100644
--- a/plugins/discourse-ai/lib/personas/discover.rb
+++ b/plugins/discourse-ai/lib/agents/discover.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class Discover < Persona
+ module Agents
+ class Discover < Agent
def self.default_enabled
true
end
diff --git a/plugins/discourse-ai/lib/personas/forum_researcher.rb b/plugins/discourse-ai/lib/agents/forum_researcher.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/forum_researcher.rb
rename to plugins/discourse-ai/lib/agents/forum_researcher.rb
index 634ce4aaf25..2ad3c12cdcf 100644
--- a/plugins/discourse-ai/lib/personas/forum_researcher.rb
+++ b/plugins/discourse-ai/lib/agents/forum_researcher.rb
@@ -1,8 +1,8 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
- class ForumResearcher < Persona
+ module Agents
+ class ForumResearcher < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/general.rb b/plugins/discourse-ai/lib/agents/general.rb
similarity index 95%
rename from plugins/discourse-ai/lib/personas/general.rb
rename to plugins/discourse-ai/lib/agents/general.rb
index 3647c5ce437..a7a88cbfca6 100644
--- a/plugins/discourse-ai/lib/personas/general.rb
+++ b/plugins/discourse-ai/lib/agents/general.rb
@@ -1,8 +1,8 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
- class General < Persona
+ module Agents
+ class General < Agent
def tools
base_tools = [
Tools::Search,
diff --git a/plugins/discourse-ai/lib/personas/github_helper.rb b/plugins/discourse-ai/lib/agents/github_helper.rb
similarity index 94%
rename from plugins/discourse-ai/lib/personas/github_helper.rb
rename to plugins/discourse-ai/lib/agents/github_helper.rb
index e7823bfb17b..bb40f29e993 100644
--- a/plugins/discourse-ai/lib/personas/github_helper.rb
+++ b/plugins/discourse-ai/lib/agents/github_helper.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class GithubHelper < Persona
+ module Agents
+ class GithubHelper < Agent
def tools
[
Tools::GithubFileContent,
diff --git a/plugins/discourse-ai/lib/personas/image_captioner.rb b/plugins/discourse-ai/lib/agents/image_captioner.rb
similarity index 92%
rename from plugins/discourse-ai/lib/personas/image_captioner.rb
rename to plugins/discourse-ai/lib/agents/image_captioner.rb
index 8eb6aed03e1..7f94798dce9 100644
--- a/plugins/discourse-ai/lib/personas/image_captioner.rb
+++ b/plugins/discourse-ai/lib/agents/image_captioner.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class ImageCaptioner < Persona
+ module Agents
+ class ImageCaptioner < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/locale_detector.rb b/plugins/discourse-ai/lib/agents/locale_detector.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/locale_detector.rb
rename to plugins/discourse-ai/lib/agents/locale_detector.rb
index 4dcf8e5208c..387a3440768 100644
--- a/plugins/discourse-ai/lib/personas/locale_detector.rb
+++ b/plugins/discourse-ai/lib/agents/locale_detector.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class LocaleDetector < Persona
+ module Agents
+ class LocaleDetector < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/markdown_table_generator.rb b/plugins/discourse-ai/lib/agents/markdown_table_generator.rb
similarity index 96%
rename from plugins/discourse-ai/lib/personas/markdown_table_generator.rb
rename to plugins/discourse-ai/lib/agents/markdown_table_generator.rb
index 3ec3e375345..ec871526927 100644
--- a/plugins/discourse-ai/lib/personas/markdown_table_generator.rb
+++ b/plugins/discourse-ai/lib/agents/markdown_table_generator.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class MarkdownTableGenerator < Persona
+ module Agents
+ class MarkdownTableGenerator < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/post_illustrator.rb b/plugins/discourse-ai/lib/agents/post_illustrator.rb
similarity index 89%
rename from plugins/discourse-ai/lib/personas/post_illustrator.rb
rename to plugins/discourse-ai/lib/agents/post_illustrator.rb
index e1a3615cd1b..caff044db7e 100644
--- a/plugins/discourse-ai/lib/personas/post_illustrator.rb
+++ b/plugins/discourse-ai/lib/agents/post_illustrator.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class PostIllustrator < Persona
+ module Agents
+ class PostIllustrator < Agent
def self.default_enabled
false
end
@@ -25,7 +25,7 @@ module DiscourseAi
image_tool_ids = AiTool.where(enabled: true, is_image_generation_tool: true).pluck(:id)
image_tool_ids.map do |tool_id|
- DiscourseAi::Personas::Tools::Custom.class_instance(tool_id)
+ DiscourseAi::Agents::Tools::Custom.class_instance(tool_id)
end
end
end
diff --git a/plugins/discourse-ai/lib/personas/post_raw_translator.rb b/plugins/discourse-ai/lib/agents/post_raw_translator.rb
similarity index 98%
rename from plugins/discourse-ai/lib/personas/post_raw_translator.rb
rename to plugins/discourse-ai/lib/agents/post_raw_translator.rb
index 705eb00712d..613a30fcb05 100644
--- a/plugins/discourse-ai/lib/personas/post_raw_translator.rb
+++ b/plugins/discourse-ai/lib/agents/post_raw_translator.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class PostRawTranslator < Persona
+ module Agents
+ class PostRawTranslator < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/proofreader.rb b/plugins/discourse-ai/lib/agents/proofreader.rb
similarity index 98%
rename from plugins/discourse-ai/lib/personas/proofreader.rb
rename to plugins/discourse-ai/lib/agents/proofreader.rb
index 730b831b389..56ad3b311eb 100644
--- a/plugins/discourse-ai/lib/personas/proofreader.rb
+++ b/plugins/discourse-ai/lib/agents/proofreader.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class Proofreader < Persona
+ module Agents
+ class Proofreader < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/question_consolidator.rb b/plugins/discourse-ai/lib/agents/question_consolidator.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/question_consolidator.rb
rename to plugins/discourse-ai/lib/agents/question_consolidator.rb
index 1e3e24892bc..dd49b07e646 100644
--- a/plugins/discourse-ai/lib/personas/question_consolidator.rb
+++ b/plugins/discourse-ai/lib/agents/question_consolidator.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
class QuestionConsolidator
attr_reader :llm, :messages, :user, :max_tokens
diff --git a/plugins/discourse-ai/lib/personas/report_runner.rb b/plugins/discourse-ai/lib/agents/report_runner.rb
similarity index 95%
rename from plugins/discourse-ai/lib/personas/report_runner.rb
rename to plugins/discourse-ai/lib/agents/report_runner.rb
index 9f49a3731bb..924646d3394 100644
--- a/plugins/discourse-ai/lib/personas/report_runner.rb
+++ b/plugins/discourse-ai/lib/agents/report_runner.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class ReportRunner < Persona
+ module Agents
+ class ReportRunner < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/researcher.rb b/plugins/discourse-ai/lib/agents/researcher.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/researcher.rb
rename to plugins/discourse-ai/lib/agents/researcher.rb
index 8b5e3e86d7f..9d249a86182 100644
--- a/plugins/discourse-ai/lib/personas/researcher.rb
+++ b/plugins/discourse-ai/lib/agents/researcher.rb
@@ -1,8 +1,8 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
- class Researcher < Persona
+ module Agents
+ class Researcher < Agent
def tools
[Tools::Google, Tools::WebBrowser]
end
diff --git a/plugins/discourse-ai/lib/personas/settings_explorer.rb b/plugins/discourse-ai/lib/agents/settings_explorer.rb
similarity index 92%
rename from plugins/discourse-ai/lib/personas/settings_explorer.rb
rename to plugins/discourse-ai/lib/agents/settings_explorer.rb
index e196a808f52..d01c5ce37fc 100644
--- a/plugins/discourse-ai/lib/personas/settings_explorer.rb
+++ b/plugins/discourse-ai/lib/agents/settings_explorer.rb
@@ -1,8 +1,8 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
- class SettingsExplorer < Persona
+ module Agents
+ class SettingsExplorer < Agent
def tools
[Tools::SettingContext, Tools::SearchSettings]
end
diff --git a/plugins/discourse-ai/lib/personas/short_summarizer.rb b/plugins/discourse-ai/lib/agents/short_summarizer.rb
similarity index 96%
rename from plugins/discourse-ai/lib/personas/short_summarizer.rb
rename to plugins/discourse-ai/lib/agents/short_summarizer.rb
index 723b2677fb8..c58c76071d1 100644
--- a/plugins/discourse-ai/lib/personas/short_summarizer.rb
+++ b/plugins/discourse-ai/lib/agents/short_summarizer.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class ShortSummarizer < Persona
+ module Agents
+ class ShortSummarizer < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/short_text_translator.rb b/plugins/discourse-ai/lib/agents/short_text_translator.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/short_text_translator.rb
rename to plugins/discourse-ai/lib/agents/short_text_translator.rb
index 8ba224b0208..bdce8abe12f 100644
--- a/plugins/discourse-ai/lib/personas/short_text_translator.rb
+++ b/plugins/discourse-ai/lib/agents/short_text_translator.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class ShortTextTranslator < Persona
+ module Agents
+ class ShortTextTranslator < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/smart_dates.rb b/plugins/discourse-ai/lib/agents/smart_dates.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/smart_dates.rb
rename to plugins/discourse-ai/lib/agents/smart_dates.rb
index cbcb4f0acc7..950b9bd54b5 100644
--- a/plugins/discourse-ai/lib/personas/smart_dates.rb
+++ b/plugins/discourse-ai/lib/agents/smart_dates.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class SmartDates < Persona
+ module Agents
+ class SmartDates < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/spam_detector.rb b/plugins/discourse-ai/lib/agents/spam_detector.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/spam_detector.rb
rename to plugins/discourse-ai/lib/agents/spam_detector.rb
index c87b7808d56..7e56dc3894a 100644
--- a/plugins/discourse-ai/lib/personas/spam_detector.rb
+++ b/plugins/discourse-ai/lib/agents/spam_detector.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class SpamDetector < Persona
+ module Agents
+ class SpamDetector < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/sql_helper.rb b/plugins/discourse-ai/lib/agents/sql_helper.rb
similarity index 98%
rename from plugins/discourse-ai/lib/personas/sql_helper.rb
rename to plugins/discourse-ai/lib/agents/sql_helper.rb
index 824ed42978c..329fa65d765 100644
--- a/plugins/discourse-ai/lib/personas/sql_helper.rb
+++ b/plugins/discourse-ai/lib/agents/sql_helper.rb
@@ -1,8 +1,8 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
- class SqlHelper < Persona
+ module Agents
+ class SqlHelper < Agent
def self.schema
return @schema if defined?(@schema)
diff --git a/plugins/discourse-ai/lib/personas/summarizer.rb b/plugins/discourse-ai/lib/agents/summarizer.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/summarizer.rb
rename to plugins/discourse-ai/lib/agents/summarizer.rb
index 3c46c473ea5..e5cc1f41ed5 100644
--- a/plugins/discourse-ai/lib/personas/summarizer.rb
+++ b/plugins/discourse-ai/lib/agents/summarizer.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class Summarizer < Persona
+ module Agents
+ class Summarizer < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/titles_generator.rb b/plugins/discourse-ai/lib/agents/titles_generator.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/titles_generator.rb
rename to plugins/discourse-ai/lib/agents/titles_generator.rb
index ccc2535b9e6..a66d7526d16 100644
--- a/plugins/discourse-ai/lib/personas/titles_generator.rb
+++ b/plugins/discourse-ai/lib/agents/titles_generator.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class TitlesGenerator < Persona
+ module Agents
+ class TitlesGenerator < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/tool_runner.rb b/plugins/discourse-ai/lib/agents/tool_runner.rb
similarity index 94%
rename from plugins/discourse-ai/lib/personas/tool_runner.rb
rename to plugins/discourse-ai/lib/agents/tool_runner.rb
index a5de365322a..040ebee7dbf 100644
--- a/plugins/discourse-ai/lib/personas/tool_runner.rb
+++ b/plugins/discourse-ai/lib/agents/tool_runner.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
class ToolRunner
attr_reader :tool, :parameters, :llm
attr_accessor :running_attached_function, :timeout, :custom_raw
@@ -30,11 +30,11 @@ module DiscourseAi
timeout: nil,
secret_bindings: nil
)
- if context && !context.is_a?(DiscourseAi::Personas::BotContext)
+ if context && !context.is_a?(DiscourseAi::Agents::BotContext)
raise ArgumentError, "context must be a BotContext object"
end
- context ||= DiscourseAi::Personas::BotContext.new
+ context ||= DiscourseAi::Agents::BotContext.new
@parameters = parameters
@llm = llm
@@ -156,8 +156,8 @@ module DiscourseAi
search: function(params) {
return _discourse_search(params);
},
- updatePersona: function(persona_id_or_name, updates) {
- const result = _discourse_update_persona(persona_id_or_name, updates);
+ updateAgent: function(agent_id_or_name, updates) {
+ const result = _discourse_update_agent(agent_id_or_name, updates);
if (result.error) {
throw new Error(result.error);
}
@@ -166,29 +166,29 @@ module DiscourseAi
getPost: _discourse_get_post,
getTopic: _discourse_get_topic,
getUser: _discourse_get_user,
- getPersona: function(name) {
- const personaDetails = _discourse_get_persona(name);
- if (personaDetails.error) {
- throw new Error(personaDetails.error);
+ getAgent: function(name) {
+ const agentDetails = _discourse_get_agent(name);
+ if (agentDetails.error) {
+ throw new Error(agentDetails.error);
}
- // merge result.persona with {}..
+ // merge result.agent with {}..
return Object.assign({
update: function(updates) {
- const result = _discourse_update_persona(name, updates);
+ const result = _discourse_update_agent(name, updates);
if (result.error) {
throw new Error(result.error);
}
return result;
},
respondTo: function(params) {
- const result = _discourse_respond_to_persona(name, params);
+ const result = _discourse_respond_to_agent(name, params);
if (result.error) {
throw new Error(result.error);
}
return result;
}
- }, personaDetails.persona);
+ }, agentDetails.agent);
},
createChatMessage: function(params) {
const result = _discourse_create_chat_message(params);
@@ -640,15 +640,15 @@ module DiscourseAi
)
mini_racer_context.attach(
- "_discourse_respond_to_persona",
- ->(persona_name, params) do
+ "_discourse_respond_to_agent",
+ ->(agent_name, params) do
in_attached_function do
- # if we have 1000s of personas this can be slow ... we may need to optimize
- persona_class = AiPersona.all_personas.find { |persona| persona.name == persona_name }
- return { error: "Persona not found" } if persona_class.nil?
+ # if we have 1000s of agents this can be slow ... we may need to optimize
+ agent_class = AiAgent.all_agents.find { |agent| agent.name == agent_name }
+ return { error: "Agent not found" } if agent_class.nil?
- persona = persona_class.new
- bot = DiscourseAi::Personas::Bot.as(@bot_user || persona.user, persona: persona)
+ agent = agent_class.new
+ bot = DiscourseAi::Agents::Bot.as(@bot_user || agent.user, agent: agent)
playground = DiscourseAi::AiBot::Playground.new(bot)
if @context.post_id
@@ -890,17 +890,17 @@ module DiscourseAi
)
mini_racer_context.attach(
- "_discourse_get_persona",
- ->(persona_name) do
+ "_discourse_get_agent",
+ ->(agent_name) do
in_attached_function do
- persona = AiPersona.find_by(name: persona_name)
+ agent = AiAgent.find_by(name: agent_name)
- return { error: "Persona not found" } if persona.nil?
+ return { error: "Agent not found" } if agent.nil?
- # Return a subset of relevant persona attributes
+ # Return a subset of relevant agent attributes
{
- persona:
- persona.attributes.slice(
+ agent:
+ agent.attributes.slice(
"id",
"name",
"description",
@@ -922,19 +922,18 @@ module DiscourseAi
)
mini_racer_context.attach(
- "_discourse_update_persona",
- ->(persona_id_or_name, updates) do
+ "_discourse_update_agent",
+ ->(agent_id_or_name, updates) do
in_attached_function do
- # Find persona by ID or name
- persona = nil
- if persona_id_or_name.is_a?(Integer) ||
- persona_id_or_name.to_i.to_s == persona_id_or_name
- persona = AiPersona.find_by(id: persona_id_or_name.to_i)
+ # Find agent by ID or name
+ agent = nil
+ if agent_id_or_name.is_a?(Integer) || agent_id_or_name.to_i.to_s == agent_id_or_name
+ agent = AiAgent.find_by(id: agent_id_or_name.to_i)
else
- persona = AiPersona.find_by(name: persona_id_or_name)
+ agent = AiAgent.find_by(name: agent_id_or_name)
end
- return { error: "Persona not found" } if persona.nil?
+ return { error: "Agent not found" } if agent.nil?
allowed_updates = {}
@@ -956,12 +955,12 @@ module DiscourseAi
TrueClass,
) || updates["enabled"].is_a?(FalseClass)
- if persona.update(allowed_updates)
+ if agent.update(allowed_updates)
return(
{
success: true,
- persona:
- persona.attributes.slice(
+ agent:
+ agent.attributes.slice(
"id",
"name",
"description",
@@ -973,7 +972,7 @@ module DiscourseAi
}
)
else
- return { error: persona.errors.full_messages.join(", ") }
+ return { error: agent.errors.full_messages.join(", ") }
end
end
end,
@@ -1226,7 +1225,7 @@ module DiscourseAi
base64_encode = options && options["base64Encode"]
result = {}
- DiscourseAi::Personas::Tools::Tool.send_http_request(
+ DiscourseAi::Agents::Tools::Tool.send_http_request(
url,
headers: headers,
) do |response|
@@ -1260,7 +1259,7 @@ module DiscourseAi
base64_encode = options && options["base64Encode"]
result = {}
- DiscourseAi::Personas::Tools::Tool.send_http_request(
+ DiscourseAi::Agents::Tools::Tool.send_http_request(
url,
method: method,
headers: headers,
diff --git a/plugins/discourse-ai/lib/personas/tools/assign.rb b/plugins/discourse-ai/lib/agents/tools/assign.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/assign.rb
rename to plugins/discourse-ai/lib/agents/tools/assign.rb
index de0527c4636..1aa28107613 100644
--- a/plugins/discourse-ai/lib/personas/tools/assign.rb
+++ b/plugins/discourse-ai/lib/agents/tools/assign.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class Assign < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/close_topic.rb b/plugins/discourse-ai/lib/agents/tools/close_topic.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/close_topic.rb
rename to plugins/discourse-ai/lib/agents/tools/close_topic.rb
index 1eff78d6bf5..bc5b0a190c7 100644
--- a/plugins/discourse-ai/lib/personas/tools/close_topic.rb
+++ b/plugins/discourse-ai/lib/agents/tools/close_topic.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class CloseTopic < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/create_artifact.rb b/plugins/discourse-ai/lib/agents/tools/create_artifact.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/create_artifact.rb
rename to plugins/discourse-ai/lib/agents/tools/create_artifact.rb
index b70b1aef620..6276d385bcd 100644
--- a/plugins/discourse-ai/lib/personas/tools/create_artifact.rb
+++ b/plugins/discourse-ai/lib/agents/tools/create_artifact.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class CreateArtifact < Tool
def self.name
diff --git a/plugins/discourse-ai/lib/personas/tools/create_image.rb b/plugins/discourse-ai/lib/agents/tools/create_image.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/create_image.rb
rename to plugins/discourse-ai/lib/agents/tools/create_image.rb
index 8a6c618f102..40c038b1cee 100644
--- a/plugins/discourse-ai/lib/personas/tools/create_image.rb
+++ b/plugins/discourse-ai/lib/agents/tools/create_image.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class CreateImage < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/custom.rb b/plugins/discourse-ai/lib/agents/tools/custom.rb
similarity index 95%
rename from plugins/discourse-ai/lib/personas/tools/custom.rb
rename to plugins/discourse-ai/lib/agents/tools/custom.rb
index c1fa27cac1f..674085cf6da 100644
--- a/plugins/discourse-ai/lib/personas/tools/custom.rb
+++ b/plugins/discourse-ai/lib/agents/tools/custom.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class Custom < Tool
def self.class_instance(tool_id)
@@ -33,7 +33,7 @@ module DiscourseAi
end
def self.has_custom_context?
- # note on safety, this can be cached safely, we bump the whole persona cache when an ai tool is saved
+ # note on safety, this can be cached safely, we bump the whole agent cache when an ai tool is saved
# which will expire this class
return @has_custom_context if defined?(@has_custom_context)
@@ -48,7 +48,7 @@ module DiscourseAi
end
def self.has_custom_system_message?
- # cached safely - persona cache is bumped when an ai tool is saved, expiring this class
+ # cached safely - agent cache is bumped when an ai tool is saved, expiring this class
return @has_custom_system_message if defined?(@has_custom_system_message)
@has_custom_system_message = false
@@ -61,7 +61,7 @@ module DiscourseAi
@has_custom_system_message
end
- def self.inject_prompt(prompt:, context:, persona:)
+ def self.inject_prompt(prompt:, context:, agent:)
needs_context = has_custom_context?
needs_system_message = has_custom_system_message?
return unless needs_context || needs_system_message
diff --git a/plugins/discourse-ai/lib/personas/tools/db_schema.rb b/plugins/discourse-ai/lib/agents/tools/db_schema.rb
similarity index 98%
rename from plugins/discourse-ai/lib/personas/tools/db_schema.rb
rename to plugins/discourse-ai/lib/agents/tools/db_schema.rb
index b0a6f296a23..30ee491955f 100644
--- a/plugins/discourse-ai/lib/personas/tools/db_schema.rb
+++ b/plugins/discourse-ai/lib/agents/tools/db_schema.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class DbSchema < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/delete_topic.rb b/plugins/discourse-ai/lib/agents/tools/delete_topic.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/delete_topic.rb
rename to plugins/discourse-ai/lib/agents/tools/delete_topic.rb
index 203b99e7ad7..ad5bec63c87 100644
--- a/plugins/discourse-ai/lib/personas/tools/delete_topic.rb
+++ b/plugins/discourse-ai/lib/agents/tools/delete_topic.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class DeleteTopic < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/discourse_meta_search.rb b/plugins/discourse-ai/lib/agents/tools/discourse_meta_search.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/discourse_meta_search.rb
rename to plugins/discourse-ai/lib/agents/tools/discourse_meta_search.rb
index 4ab5a8fa201..01cee1566a6 100644
--- a/plugins/discourse-ai/lib/personas/tools/discourse_meta_search.rb
+++ b/plugins/discourse-ai/lib/agents/tools/discourse_meta_search.rb
@@ -1,7 +1,7 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class DiscourseMetaSearch < Tool
class << self
diff --git a/plugins/discourse-ai/lib/personas/tools/edit_category.rb b/plugins/discourse-ai/lib/agents/tools/edit_category.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/edit_category.rb
rename to plugins/discourse-ai/lib/agents/tools/edit_category.rb
index a0a9bf6dccc..197a48caa2b 100644
--- a/plugins/discourse-ai/lib/personas/tools/edit_category.rb
+++ b/plugins/discourse-ai/lib/agents/tools/edit_category.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class EditCategory < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/edit_image.rb b/plugins/discourse-ai/lib/agents/tools/edit_image.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/edit_image.rb
rename to plugins/discourse-ai/lib/agents/tools/edit_image.rb
index 1388b177ed3..bd3b1d492d4 100644
--- a/plugins/discourse-ai/lib/personas/tools/edit_image.rb
+++ b/plugins/discourse-ai/lib/agents/tools/edit_image.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class EditImage < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/edit_post.rb b/plugins/discourse-ai/lib/agents/tools/edit_post.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/edit_post.rb
rename to plugins/discourse-ai/lib/agents/tools/edit_post.rb
index f69d7992702..5212c7c00f9 100644
--- a/plugins/discourse-ai/lib/personas/tools/edit_post.rb
+++ b/plugins/discourse-ai/lib/agents/tools/edit_post.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class EditPost < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/edit_tags.rb b/plugins/discourse-ai/lib/agents/tools/edit_tags.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/edit_tags.rb
rename to plugins/discourse-ai/lib/agents/tools/edit_tags.rb
index ba7579a7dbf..cc77d10da83 100644
--- a/plugins/discourse-ai/lib/personas/tools/edit_tags.rb
+++ b/plugins/discourse-ai/lib/agents/tools/edit_tags.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class EditTags < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/flag_post.rb b/plugins/discourse-ai/lib/agents/tools/flag_post.rb
similarity index 94%
rename from plugins/discourse-ai/lib/personas/tools/flag_post.rb
rename to plugins/discourse-ai/lib/agents/tools/flag_post.rb
index d75b822bdd7..0c9a4bbb3f6 100644
--- a/plugins/discourse-ai/lib/personas/tools/flag_post.rb
+++ b/plugins/discourse-ai/lib/agents/tools/flag_post.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class FlagPost < Tool
FLAG_TYPES = %w[
@@ -47,8 +47,8 @@ module DiscourseAi
end
def flag_type
- persona_flag_type = persona_option(:flag_type)
- (persona_flag_type.presence || feature_context[:flag_type].presence || "review").to_s
+ agent_flag_type = agent_option(:flag_type)
+ (agent_flag_type.presence || feature_context[:flag_type].presence || "review").to_s
end
def invoke
@@ -172,11 +172,11 @@ module DiscourseAi
context.feature_context || {}
end
- def persona_option(name)
- return nil if !persona_options.is_a?(Hash)
- return nil if !persona_options.key?(name)
+ def agent_option(name)
+ return nil if !agent_options.is_a?(Hash)
+ return nil if !agent_options.key?(name)
- persona_options[name]
+ agent_options[name]
end
end
end
diff --git a/plugins/discourse-ai/lib/personas/tools/github_diff.rb b/plugins/discourse-ai/lib/agents/tools/github_diff.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/github_diff.rb
rename to plugins/discourse-ai/lib/agents/tools/github_diff.rb
index 989684647de..cb67f5fd34f 100644
--- a/plugins/discourse-ai/lib/personas/tools/github_diff.rb
+++ b/plugins/discourse-ai/lib/agents/tools/github_diff.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class GithubDiff < Tool
LARGE_OBJECT_THRESHOLD = 30_000
diff --git a/plugins/discourse-ai/lib/personas/tools/github_file_content.rb b/plugins/discourse-ai/lib/agents/tools/github_file_content.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/github_file_content.rb
rename to plugins/discourse-ai/lib/agents/tools/github_file_content.rb
index 02c4004a2dd..232420cdd1b 100644
--- a/plugins/discourse-ai/lib/personas/tools/github_file_content.rb
+++ b/plugins/discourse-ai/lib/agents/tools/github_file_content.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class GithubFileContent < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/github_search_code.rb b/plugins/discourse-ai/lib/agents/tools/github_search_code.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/github_search_code.rb
rename to plugins/discourse-ai/lib/agents/tools/github_search_code.rb
index cbee46ed3a1..3994c69bdce 100644
--- a/plugins/discourse-ai/lib/personas/tools/github_search_code.rb
+++ b/plugins/discourse-ai/lib/agents/tools/github_search_code.rb
@@ -4,7 +4,7 @@ require "cgi"
require "uri"
module DiscourseAi
- module Personas
+ module Agents
module Tools
class GithubSearchCode < Tool
MAX_GH_RESULTS = 1_000
diff --git a/plugins/discourse-ai/lib/personas/tools/github_search_files.rb b/plugins/discourse-ai/lib/agents/tools/github_search_files.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/github_search_files.rb
rename to plugins/discourse-ai/lib/agents/tools/github_search_files.rb
index dc47d5cd138..935fc676ee8 100644
--- a/plugins/discourse-ai/lib/personas/tools/github_search_files.rb
+++ b/plugins/discourse-ai/lib/agents/tools/github_search_files.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class GithubSearchFiles < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/google.rb b/plugins/discourse-ai/lib/agents/tools/google.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/google.rb
rename to plugins/discourse-ai/lib/agents/tools/google.rb
index 665fe1631ec..f199c05778e 100644
--- a/plugins/discourse-ai/lib/personas/tools/google.rb
+++ b/plugins/discourse-ai/lib/agents/tools/google.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class Google < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/grant_badge.rb b/plugins/discourse-ai/lib/agents/tools/grant_badge.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/grant_badge.rb
rename to plugins/discourse-ai/lib/agents/tools/grant_badge.rb
index 55ff8b2e6ac..c464d8b83bb 100644
--- a/plugins/discourse-ai/lib/personas/tools/grant_badge.rb
+++ b/plugins/discourse-ai/lib/agents/tools/grant_badge.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class GrantBadge < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/image.rb b/plugins/discourse-ai/lib/agents/tools/image.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/image.rb
rename to plugins/discourse-ai/lib/agents/tools/image.rb
index 7ad8f8cf966..40743173c3e 100644
--- a/plugins/discourse-ai/lib/personas/tools/image.rb
+++ b/plugins/discourse-ai/lib/agents/tools/image.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class Image < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/javascript_evaluator.rb b/plugins/discourse-ai/lib/agents/tools/javascript_evaluator.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/javascript_evaluator.rb
rename to plugins/discourse-ai/lib/agents/tools/javascript_evaluator.rb
index 82860b076f5..6069e4b371d 100644
--- a/plugins/discourse-ai/lib/personas/tools/javascript_evaluator.rb
+++ b/plugins/discourse-ai/lib/agents/tools/javascript_evaluator.rb
@@ -3,7 +3,7 @@
require "json"
module DiscourseAi
- module Personas
+ module Agents
module Tools
class JavascriptEvaluator < Tool
TIMEOUT = 500
diff --git a/plugins/discourse-ai/lib/personas/tools/list_categories.rb b/plugins/discourse-ai/lib/agents/tools/list_categories.rb
similarity index 98%
rename from plugins/discourse-ai/lib/personas/tools/list_categories.rb
rename to plugins/discourse-ai/lib/agents/tools/list_categories.rb
index 895eaae5423..6cd2ab96ede 100644
--- a/plugins/discourse-ai/lib/personas/tools/list_categories.rb
+++ b/plugins/discourse-ai/lib/agents/tools/list_categories.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class ListCategories < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/list_tags.rb b/plugins/discourse-ai/lib/agents/tools/list_tags.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/tools/list_tags.rb
rename to plugins/discourse-ai/lib/agents/tools/list_tags.rb
index 852c9abc0af..83313ec88b3 100644
--- a/plugins/discourse-ai/lib/personas/tools/list_tags.rb
+++ b/plugins/discourse-ai/lib/agents/tools/list_tags.rb
@@ -1,7 +1,7 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class ListTags < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/lock_post.rb b/plugins/discourse-ai/lib/agents/tools/lock_post.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/lock_post.rb
rename to plugins/discourse-ai/lib/agents/tools/lock_post.rb
index 69983cc1110..b7deb922a87 100644
--- a/plugins/discourse-ai/lib/personas/tools/lock_post.rb
+++ b/plugins/discourse-ai/lib/agents/tools/lock_post.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class LockPost < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/mark_as_solved.rb b/plugins/discourse-ai/lib/agents/tools/mark_as_solved.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/mark_as_solved.rb
rename to plugins/discourse-ai/lib/agents/tools/mark_as_solved.rb
index 3bc5fb64cdc..846d6e20d21 100644
--- a/plugins/discourse-ai/lib/personas/tools/mark_as_solved.rb
+++ b/plugins/discourse-ai/lib/agents/tools/mark_as_solved.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class MarkAsSolved < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/move_posts.rb b/plugins/discourse-ai/lib/agents/tools/move_posts.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/move_posts.rb
rename to plugins/discourse-ai/lib/agents/tools/move_posts.rb
index dc55a0cc576..5eb801472c0 100644
--- a/plugins/discourse-ai/lib/personas/tools/move_posts.rb
+++ b/plugins/discourse-ai/lib/agents/tools/move_posts.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class MovePosts < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/option.rb b/plugins/discourse-ai/lib/agents/tools/option.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/tools/option.rb
rename to plugins/discourse-ai/lib/agents/tools/option.rb
index 777475b847f..4c61fe2a133 100644
--- a/plugins/discourse-ai/lib/personas/tools/option.rb
+++ b/plugins/discourse-ai/lib/agents/tools/option.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class Option
attr_reader :tool, :name, :type, :values, :default
diff --git a/plugins/discourse-ai/lib/personas/tools/random_picker.rb b/plugins/discourse-ai/lib/agents/tools/random_picker.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/random_picker.rb
rename to plugins/discourse-ai/lib/agents/tools/random_picker.rb
index 1abd537ff43..1a9da699fee 100644
--- a/plugins/discourse-ai/lib/personas/tools/random_picker.rb
+++ b/plugins/discourse-ai/lib/agents/tools/random_picker.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class RandomPicker < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/read.rb b/plugins/discourse-ai/lib/agents/tools/read.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/read.rb
rename to plugins/discourse-ai/lib/agents/tools/read.rb
index 3077de47fae..24bcde52d5d 100644
--- a/plugins/discourse-ai/lib/personas/tools/read.rb
+++ b/plugins/discourse-ai/lib/agents/tools/read.rb
@@ -1,7 +1,7 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
MAX_POSTS = 100
module Tools
diff --git a/plugins/discourse-ai/lib/personas/tools/read_artifact.rb b/plugins/discourse-ai/lib/agents/tools/read_artifact.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/read_artifact.rb
rename to plugins/discourse-ai/lib/agents/tools/read_artifact.rb
index e3074d71851..fa4dfbb4b97 100644
--- a/plugins/discourse-ai/lib/personas/tools/read_artifact.rb
+++ b/plugins/discourse-ai/lib/agents/tools/read_artifact.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class ReadArtifact < Tool
MAX_HTML_SIZE = 30.kilobytes
diff --git a/plugins/discourse-ai/lib/personas/tools/researcher.rb b/plugins/discourse-ai/lib/agents/tools/researcher.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/researcher.rb
rename to plugins/discourse-ai/lib/agents/tools/researcher.rb
index b9e9e3e242a..dff051fe689 100644
--- a/plugins/discourse-ai/lib/personas/tools/researcher.rb
+++ b/plugins/discourse-ai/lib/agents/tools/researcher.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class Researcher < Tool
attr_reader :filter, :result_count, :goals, :dry_run
diff --git a/plugins/discourse-ai/lib/personas/tools/search.rb b/plugins/discourse-ai/lib/agents/tools/search.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/search.rb
rename to plugins/discourse-ai/lib/agents/tools/search.rb
index b13094bf312..6fbc244cbc1 100644
--- a/plugins/discourse-ai/lib/personas/tools/search.rb
+++ b/plugins/discourse-ai/lib/agents/tools/search.rb
@@ -1,7 +1,7 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class Search < Tool
attr_reader :last_query
diff --git a/plugins/discourse-ai/lib/personas/tools/search_settings.rb b/plugins/discourse-ai/lib/agents/tools/search_settings.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/search_settings.rb
rename to plugins/discourse-ai/lib/agents/tools/search_settings.rb
index fc66c926c7a..68e84fbb4d1 100644
--- a/plugins/discourse-ai/lib/personas/tools/search_settings.rb
+++ b/plugins/discourse-ai/lib/agents/tools/search_settings.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class SearchSettings < Tool
INCLUDE_DESCRIPTIONS_MAX_LENGTH = 10
diff --git a/plugins/discourse-ai/lib/personas/tools/set_slow_mode.rb b/plugins/discourse-ai/lib/agents/tools/set_slow_mode.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/set_slow_mode.rb
rename to plugins/discourse-ai/lib/agents/tools/set_slow_mode.rb
index 59b371c7b34..ed17b178b37 100644
--- a/plugins/discourse-ai/lib/personas/tools/set_slow_mode.rb
+++ b/plugins/discourse-ai/lib/agents/tools/set_slow_mode.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class SetSlowMode < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/set_topic_timer.rb b/plugins/discourse-ai/lib/agents/tools/set_topic_timer.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/set_topic_timer.rb
rename to plugins/discourse-ai/lib/agents/tools/set_topic_timer.rb
index 987da896288..232091923fa 100644
--- a/plugins/discourse-ai/lib/personas/tools/set_topic_timer.rb
+++ b/plugins/discourse-ai/lib/agents/tools/set_topic_timer.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class SetTopicTimer < Tool
TIMER_TYPES = %w[close open delete silent_close bump].freeze
diff --git a/plugins/discourse-ai/lib/personas/tools/setting_context.rb b/plugins/discourse-ai/lib/agents/tools/setting_context.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/setting_context.rb
rename to plugins/discourse-ai/lib/agents/tools/setting_context.rb
index c37f2c5d4e6..2ffe79e764f 100644
--- a/plugins/discourse-ai/lib/personas/tools/setting_context.rb
+++ b/plugins/discourse-ai/lib/agents/tools/setting_context.rb
@@ -1,7 +1,7 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class SettingContext < Tool
MAX_CONTEXT_TOKENS = 2000
diff --git a/plugins/discourse-ai/lib/personas/tools/summarize.rb b/plugins/discourse-ai/lib/agents/tools/summarize.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/summarize.rb
rename to plugins/discourse-ai/lib/agents/tools/summarize.rb
index 94f6cf49395..af237ab1060 100644
--- a/plugins/discourse-ai/lib/personas/tools/summarize.rb
+++ b/plugins/discourse-ai/lib/agents/tools/summarize.rb
@@ -1,7 +1,7 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class Summarize < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/time.rb b/plugins/discourse-ai/lib/agents/tools/time.rb
similarity index 98%
rename from plugins/discourse-ai/lib/personas/tools/time.rb
rename to plugins/discourse-ai/lib/agents/tools/time.rb
index da3d4f43b99..50d5dcdd835 100644
--- a/plugins/discourse-ai/lib/personas/tools/time.rb
+++ b/plugins/discourse-ai/lib/agents/tools/time.rb
@@ -1,7 +1,7 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class Time < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/tool.rb b/plugins/discourse-ai/lib/agents/tools/tool.rb
similarity index 93%
rename from plugins/discourse-ai/lib/personas/tools/tool.rb
rename to plugins/discourse-ai/lib/agents/tools/tool.rb
index f3a2eff64ef..e09953e263e 100644
--- a/plugins/discourse-ai/lib/personas/tools/tool.rb
+++ b/plugins/discourse-ai/lib/agents/tools/tool.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class Tool
# Why 30 mega bytes?
@@ -43,25 +43,25 @@ module DiscourseAi
false
end
- def inject_prompt(prompt:, context:, persona:)
+ def inject_prompt(prompt:, context:, agent:)
end
def available_custom_image_tools
image_tool_ids = AiTool.where(enabled: true, is_image_generation_tool: true).pluck(:id)
image_tool_ids.map do |tool_id|
- DiscourseAi::Personas::Tools::Custom.class_instance(tool_id)
+ DiscourseAi::Agents::Tools::Custom.class_instance(tool_id)
end
end
end
# llm being public makes it a bit easier to test
attr_accessor :custom_raw, :parameters, :llm, :provider_data
- attr_reader :tool_call_id, :persona_options, :bot_user, :context
+ attr_reader :tool_call_id, :agent_options, :bot_user, :context
def initialize(
parameters,
tool_call_id: "",
- persona_options: {},
+ agent_options: {},
bot_user:,
llm:,
context: nil,
@@ -69,14 +69,14 @@ module DiscourseAi
)
@parameters = parameters
@tool_call_id = tool_call_id
- @persona_options =
- persona_options.is_a?(Hash) ? persona_options.with_indifferent_access : persona_options
+ @agent_options =
+ agent_options.is_a?(Hash) ? agent_options.with_indifferent_access : agent_options
@bot_user = bot_user
@llm = llm
- @context = context.nil? ? DiscourseAi::Personas::BotContext.new(messages: []) : context
+ @context = context.nil? ? DiscourseAi::Agents::BotContext.new(messages: []) : context
@provider_data = provider_data.is_a?(Hash) ? provider_data.deep_symbolize_keys : {}
- if [email protected]_a?(DiscourseAi::Personas::BotContext)
- raise ArgumentError, "context must be a DiscourseAi::Personas::Context"
+ if [email protected]_a?(DiscourseAi::Agents::BotContext)
+ raise ArgumentError, "context must be a DiscourseAi::Agents::Context"
end
end
@@ -99,7 +99,7 @@ module DiscourseAi
def options
result = ActiveSupport::HashWithIndifferentAccess.new
self.class.accepted_options.each do |option|
- val = @persona_options[option.name]
+ val = @agent_options[option.name]
if val
case option.type
when :boolean
diff --git a/plugins/discourse-ai/lib/personas/tools/unlist_topic.rb b/plugins/discourse-ai/lib/agents/tools/unlist_topic.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/unlist_topic.rb
rename to plugins/discourse-ai/lib/agents/tools/unlist_topic.rb
index 43aedc8477f..1f33b2303a4 100644
--- a/plugins/discourse-ai/lib/personas/tools/unlist_topic.rb
+++ b/plugins/discourse-ai/lib/agents/tools/unlist_topic.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class UnlistTopic < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/tools/update_artifact.rb b/plugins/discourse-ai/lib/agents/tools/update_artifact.rb
similarity index 98%
rename from plugins/discourse-ai/lib/personas/tools/update_artifact.rb
rename to plugins/discourse-ai/lib/agents/tools/update_artifact.rb
index 7c0d4e0d807..a2a1c2ac017 100644
--- a/plugins/discourse-ai/lib/personas/tools/update_artifact.rb
+++ b/plugins/discourse-ai/lib/agents/tools/update_artifact.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class UpdateArtifact < Tool
def self.name
@@ -36,8 +36,8 @@ module DiscourseAi
}
end
- def self.inject_prompt(prompt:, context:, persona:)
- return if persona.options["do_not_echo_artifact"].to_s == "true"
+ def self.inject_prompt(prompt:, context:, agent:)
+ return if agent.options["do_not_echo_artifact"].to_s == "true"
# we inject the current artifact content into the last user message
if topic_id = context.topic_id
posts = Post.where(topic_id: topic_id)
diff --git a/plugins/discourse-ai/lib/personas/tools/web_browser.rb b/plugins/discourse-ai/lib/agents/tools/web_browser.rb
similarity index 99%
rename from plugins/discourse-ai/lib/personas/tools/web_browser.rb
rename to plugins/discourse-ai/lib/agents/tools/web_browser.rb
index fd5500a6547..4b067cc1a65 100644
--- a/plugins/discourse-ai/lib/personas/tools/web_browser.rb
+++ b/plugins/discourse-ai/lib/agents/tools/web_browser.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
+ module Agents
module Tools
class WebBrowser < Tool
def self.signature
diff --git a/plugins/discourse-ai/lib/personas/topic_title_translator.rb b/plugins/discourse-ai/lib/agents/topic_title_translator.rb
similarity index 98%
rename from plugins/discourse-ai/lib/personas/topic_title_translator.rb
rename to plugins/discourse-ai/lib/agents/topic_title_translator.rb
index 8c295dee2d2..26f1fc7e05c 100644
--- a/plugins/discourse-ai/lib/personas/topic_title_translator.rb
+++ b/plugins/discourse-ai/lib/agents/topic_title_translator.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class TopicTitleTranslator < Persona
+ module Agents
+ class TopicTitleTranslator < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/translator.rb b/plugins/discourse-ai/lib/agents/translator.rb
similarity index 96%
rename from plugins/discourse-ai/lib/personas/translator.rb
rename to plugins/discourse-ai/lib/agents/translator.rb
index faf000050f2..3558abb72da 100644
--- a/plugins/discourse-ai/lib/personas/translator.rb
+++ b/plugins/discourse-ai/lib/agents/translator.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class Translator < Persona
+ module Agents
+ class Translator < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/tutor.rb b/plugins/discourse-ai/lib/agents/tutor.rb
similarity index 96%
rename from plugins/discourse-ai/lib/personas/tutor.rb
rename to plugins/discourse-ai/lib/agents/tutor.rb
index ba22b0b658f..89a32c2d9b6 100644
--- a/plugins/discourse-ai/lib/personas/tutor.rb
+++ b/plugins/discourse-ai/lib/agents/tutor.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
module DiscourseAi
- module Personas
- class Tutor < Persona
+ module Agents
+ class Tutor < Agent
def self.default_enabled
false
end
diff --git a/plugins/discourse-ai/lib/personas/web_artifact_creator.rb b/plugins/discourse-ai/lib/agents/web_artifact_creator.rb
similarity index 97%
rename from plugins/discourse-ai/lib/personas/web_artifact_creator.rb
rename to plugins/discourse-ai/lib/agents/web_artifact_creator.rb
index eacd7bc00dd..d116d8d4939 100644
--- a/plugins/discourse-ai/lib/personas/web_artifact_creator.rb
+++ b/plugins/discourse-ai/lib/agents/web_artifact_creator.rb
@@ -1,8 +1,8 @@
#frozen_string_literal: true
module DiscourseAi
- module Personas
- class WebArtifactCreator < Persona
+ module Agents
+ class WebArtifactCreator < Agent
def tools
[Tools::CreateArtifact, Tools::UpdateArtifact, Tools::ReadArtifact]
end
diff --git a/plugins/discourse-ai/lib/ai_bot.rb b/plugins/discourse-ai/lib/ai_bot.rb
index 6e745e058a5..d4940732653 100644
--- a/plugins/discourse-ai/lib/ai_bot.rb
+++ b/plugins/discourse-ai/lib/ai_bot.rb
@@ -6,6 +6,6 @@ module DiscourseAi
TOPIC_AI_BOT_PM_FIELD = "is_ai_bot_pm"
POST_AI_LLM_NAME_FIELD = "ai_llm_name"
POST_AI_LLM_MODEL_ID_FIELD = "ai_llm_model_id"
- POST_AI_PERSONA_ID_FIELD = "ai_persona_id"
+ POST_AI_AGENT_ID_FIELD = "ai_agent_id"
end
end
diff --git a/plugins/discourse-ai/lib/ai_bot/entry_point.rb b/plugins/discourse-ai/lib/ai_bot/entry_point.rb
index 08b2dac879a..0dd34b765b2 100644
--- a/plugins/discourse-ai/lib/ai_bot/entry_point.rb
+++ b/plugins/discourse-ai/lib/ai_bot/entry_point.rb
@@ -6,9 +6,9 @@ module DiscourseAi
Bot = Struct.new(:id, :name, :llm)
def self.all_bot_ids
- AiPersona
- .persona_users
- .map { |persona| persona[:user_id] }
+ AiAgent
+ .agent_users
+ .map { |agent| agent[:user_id] }
.concat(LlmModel.where(id: LlmModel.enabled_chat_bot_ids).pluck(:user_id).compact)
end
@@ -100,7 +100,7 @@ module DiscourseAi
plugin.register_modifier(:chat_allowed_bot_user_ids) do |user_ids, guardian|
if guardian.user
allowed_chat =
- AiPersona.allowed_modalities(
+ AiAgent.allowed_modalities(
user: guardian.user,
allow_chat_direct_messages: true,
allow_chat_channel_mentions: true,
@@ -140,7 +140,7 @@ module DiscourseAi
:topic_view,
:is_bot_pm,
include_condition: -> do
- object.topic && object.personal_message &&
+ object.topic && object.topic.private_message? &&
object.topic.custom_fields[TOPIC_AI_BOT_PM_FIELD]
end,
) { true }
@@ -155,19 +155,19 @@ module DiscourseAi
plugin.add_to_serializer(
:current_user,
- :ai_enabled_personas,
+ :ai_enabled_agents,
include_condition: -> { scope.authenticated? },
) do
- DiscourseAi::Personas::Persona
+ DiscourseAi::Agents::Agent
.all(user: scope.user)
- .map do |persona|
+ .map do |agent|
{
- id: persona.id,
- name: persona.name,
- description: persona.description,
- force_default_llm: persona.force_default_llm,
- username: persona.username,
- allow_personal_messages: persona.allow_personal_messages,
+ id: agent.id,
+ name: agent.name,
+ description: agent.description,
+ force_default_llm: agent.force_default_llm,
+ username: agent.username,
+ allow_personal_messages: agent.allow_personal_messages,
}
end
end
@@ -192,18 +192,18 @@ module DiscourseAi
) do
bots_map = DiscourseAi::AiBot::EntryPoint.enabled_user_ids_and_models_map
- persona_users = AiPersona.persona_users(user: scope.user)
- if persona_users.present?
- persona_users.filter! { |persona_user| persona_user[:username].present? }
+ agent_users = AiAgent.agent_users(user: scope.user)
+ if agent_users.present?
+ agent_users.filter! { |agent_user| agent_user[:username].present? }
bots_map.concat(
- persona_users.map do |persona_user|
+ agent_users.map do |agent_user|
{
- "id" => persona_user[:user_id],
- "username" => persona_user[:username],
- "has_default_llm" => persona_user[:default_llm_id].present?,
- "force_default_llm" => persona_user[:force_default_llm],
- "is_persona" => true,
+ "id" => agent_user[:user_id],
+ "username" => agent_user[:username],
+ "has_default_llm" => agent_user[:default_llm_id].present?,
+ "force_default_llm" => agent_user[:force_default_llm],
+ "is_agent" => true,
}
end,
)
@@ -218,12 +218,13 @@ module DiscourseAi
plugin.add_to_serializer(
:topic_view,
- :ai_persona_name,
+ :ai_agent_name,
include_condition: -> { SiteSetting.ai_bot_enabled && object.topic.private_message? },
) do
- id = topic.custom_fields["ai_persona_id"]
- name = DiscourseAi::Personas::Persona.find_by(user: scope.user, id: id.to_i)&.name if id
- name || topic.custom_fields["ai_persona"]
+ topic = object.topic
+ id = topic.custom_fields["ai_agent_id"]
+ name = DiscourseAi::Agents::Agent.find_by(user: scope.user, id: id.to_i)&.name if id
+ name || topic.custom_fields["ai_agent"]
end
plugin.on(:post_created) { |post| DiscourseAi::AiBot::Playground.schedule_reply(post) }
@@ -232,11 +233,11 @@ module DiscourseAi
DiscourseAi::AiBot::Playground.schedule_chat_reply(chat_message, channel, user, context)
end
- plugin.register_editable_topic_custom_field(:ai_persona_id)
+ plugin.register_editable_topic_custom_field(:ai_agent_id)
plugin.add_api_key_scope(
:discourse_ai,
- { stream_completion: { actions: %w[discourse_ai/admin/ai_personas#stream_reply] } },
+ { stream_completion: { actions: %w[discourse_ai/admin/ai_agents#stream_reply] } },
)
plugin.on(:site_setting_changed) do |name, old_value, new_value|
@@ -244,11 +245,13 @@ module DiscourseAi
new_value != old_value
RagDocumentFragment.delete_all
UploadReference
- .where(target: AiPersona.all)
+ .where(target: AiAgent.all)
.each do |ref|
Jobs.enqueue(
:digest_rag_upload,
- ai_persona_id: ref.target_id,
+ target_type: ref.target_type,
+ target_id: ref.target_id,
+ ai_agent_id: ref.target_id,
upload_id: ref.upload_id,
)
end
diff --git a/plugins/discourse-ai/lib/ai_bot/playground.rb b/plugins/discourse-ai/lib/ai_bot/playground.rb
index 7a9931f87b5..7c1229a82aa 100644
--- a/plugins/discourse-ai/lib/ai_bot/playground.rb
+++ b/plugins/discourse-ai/lib/ai_bot/playground.rb
@@ -15,9 +15,9 @@ module DiscourseAi
# The bot will take care of completions while this class updates the topic title
# and stream replies.
- def self.find_chat_persona(message, channel, user)
+ def self.find_chat_agent(message, channel, user)
if channel.direct_message_channel?
- AiPersona
+ AiAgent
.allowed_modalities(allow_chat_direct_messages: true)
.find do |p|
p[:user_id].in?(channel.allowed_user_ids) && (user.group_ids & p[:allowed_group_ids])
@@ -27,7 +27,7 @@ module DiscourseAi
if message.message.include?("@")
mentions = message.parsed_mentions.parsed_direct_mentions
if mentions.present?
- AiPersona
+ AiAgent
.allowed_modalities(allow_chat_channel_mentions: true)
.find { |p| p[:username].in?(mentions) && (user.group_ids & p[:allowed_group_ids]) }
end
@@ -39,15 +39,15 @@ module DiscourseAi
return if !SiteSetting.ai_bot_enabled
all_chat =
- AiPersona.allowed_modalities(
+ AiAgent.allowed_modalities(
allow_chat_channel_mentions: true,
allow_chat_direct_messages: true,
)
return if all_chat.blank?
return if all_chat.any? { |m| m[:user_id] == user.id }
- persona = find_chat_persona(message, channel, user)
- return if !persona
+ agent = find_chat_agent(message, channel, user)
+ return if !agent
post_ids = nil
post_ids = context.dig(:context, :post_ids) if context.is_a?(Hash)
@@ -56,7 +56,7 @@ module DiscourseAi
:create_ai_chat_reply,
channel_id: channel.id,
message_id: message.id,
- persona_id: persona[:id],
+ agent_id: agent[:id],
context_post_ids: post_ids,
)
end
@@ -100,10 +100,9 @@ module DiscourseAi
mentionables = nil
if post.topic.private_message?
- mentionables =
- AiPersona.allowed_modalities(user: post.user, allow_personal_messages: true)
+ mentionables = AiAgent.allowed_modalities(user: post.user, allow_personal_messages: true)
else
- mentionables = AiPersona.allowed_modalities(user: post.user, allow_topic_mentions: true)
+ mentionables = AiAgent.allowed_modalities(user: post.user, allow_topic_mentions: true)
end
mentioned = nil
@@ -135,7 +134,7 @@ module DiscourseAi
mentioned = mentionables.find { |mentionable| bot_user.id == mentionable[:user_id] }
end
- # public topic so we need to use the persona user
+ # public topic so we need to use the agent user
bot_user ||= User.find_by(id: mentioned[:user_id]) if mentioned
end
@@ -145,25 +144,23 @@ module DiscourseAi
end
if bot_user
- topic_persona_id = post.topic.custom_fields["ai_persona_id"]
- topic_persona_id = topic_persona_id.to_i if topic_persona_id.present?
+ topic_agent_id = post.topic.custom_fields["ai_agent_id"]
+ topic_agent_id = topic_agent_id.to_i if topic_agent_id.present?
- persona_id = mentioned&.dig(:id) || topic_persona_id
+ agent_id = mentioned&.dig(:id) || topic_agent_id
- persona = nil
+ agent = nil
- if persona_id
- persona = DiscourseAi::Personas::Persona.find_by(user: post.user, id: persona_id.to_i)
- end
+ agent = DiscourseAi::Agents::Agent.find_by(user: post.user, id: agent_id.to_i) if agent_id
- if !persona && persona_name = post.topic.custom_fields["ai_persona"]
- persona = DiscourseAi::Personas::Persona.find_by(user: post.user, name: persona_name)
+ if !agent && (agent_name = post.topic.custom_fields["ai_agent"])
+ agent = DiscourseAi::Agents::Agent.find_by(user: post.user, name: agent_name)
end
- # edge case, llm was mentioned in an ai persona conversation
- if persona_id == topic_persona_id && post.topic.private_message? && persona &&
+ # edge case, llm was mentioned in an ai agent conversation
+ if agent_id == topic_agent_id && post.topic.private_message? && agent &&
all_llm_users.present?
- if !persona.force_default_llm && mentions.present?
+ if !agent.force_default_llm && mentions.present?
mentioned_llm_user_id, _ =
all_llm_users.find { |id, username| mentions.include?(username) }
@@ -173,11 +170,11 @@ module DiscourseAi
end
end
- persona ||= DiscourseAi::Personas::General
+ agent ||= DiscourseAi::Agents::General
- bot_user = User.find(persona.user_id) if persona && persona.force_default_llm
+ bot_user = User.find(agent.user_id) if agent && agent.force_default_llm
- bot = DiscourseAi::Personas::Bot.as(bot_user, persona: persona.new)
+ bot = DiscourseAi::Agents::Bot.as(bot_user, agent: agent.new)
new(bot).update_playground_with(post)
end
end
@@ -185,7 +182,7 @@ module DiscourseAi
def self.reply_to_post(
post:,
user: nil,
- persona_id: nil,
+ agent_id: nil,
whisper: nil,
add_user_to_pm: false,
stream_reply: false,
@@ -195,14 +192,14 @@ module DiscourseAi
attributed_user: nil,
feature_context: nil
)
- ai_persona = AiPersona.find_by(id: persona_id)
- raise Discourse::InvalidParameters.new(:persona_id) if !ai_persona
- persona_class = ai_persona.class_instance
- persona = persona_class.new
+ ai_agent = AiAgent.find_by(id: agent_id)
+ raise Discourse::InvalidParameters.new(:agent_id) if !ai_agent
+ agent_class = ai_agent.class_instance
+ agent = agent_class.new
- bot_user = user || ai_persona.user
+ bot_user = user || ai_agent.user
raise Discourse::InvalidParameters.new(:user) if bot_user.nil?
- bot = DiscourseAi::Personas::Bot.as(bot_user, persona: persona)
+ bot = DiscourseAi::Agents::Bot.as(bot_user, agent: agent)
playground = new(bot)
playground.reply_to(
@@ -240,7 +237,7 @@ module DiscourseAi
post,
max_posts: 5,
bot_usernames: available_bot_usernames,
- include_uploads: bot.persona.class.vision_enabled,
+ include_uploads: bot.agent.class.vision_enabled,
)
# conversation context may contain tool calls, and confusing user names
@@ -306,15 +303,15 @@ module DiscourseAi
end
def reply_to_chat_message(message, channel, context_post_ids)
- persona_user = User.find(bot.persona.class.user_id)
+ agent_user = User.find(bot.agent.class.user_id)
participants = channel.user_chat_channel_memberships.map { |m| m.user.username }
context_post_ids = nil if !channel.direct_message_channel?
max_chat_messages = 40
- if bot.persona.class.respond_to?(:max_context_posts)
- max_chat_messages = bot.persona.class.max_context_posts || 40
+ if bot.agent.class.respond_to?(:max_context_posts)
+ max_chat_messages = bot.agent.class.max_context_posts || 40
end
if !channel.direct_message_channel?
@@ -323,7 +320,7 @@ module DiscourseAi
end
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
participants: participants,
message_id: message.id,
channel_id: channel.id,
@@ -333,7 +330,7 @@ module DiscourseAi
message,
channel: channel,
context_post_ids: context_post_ids,
- include_uploads: bot.persona.class.vision_enabled,
+ include_uploads: bot.agent.class.vision_enabled,
max_messages: max_chat_messages,
bot_user_ids: available_bot_user_ids,
instruction_message: instruction_message,
@@ -344,7 +341,7 @@ module DiscourseAi
)
reply = nil
- guardian = Guardian.new(persona_user)
+ guardian = Guardian.new(agent_user)
force_thread = message.thread_id.nil? && channel.direct_message_channel?
in_reply_to_id = channel.direct_message_channel? ? message.id : nil
@@ -452,12 +449,12 @@ module DiscourseAi
# safeguard
max_context_posts = 40
- if bot.persona.class.respond_to?(:max_context_posts)
- max_context_posts = bot.persona.class.max_context_posts || 40
+ if bot.agent.class.respond_to?(:max_context_posts)
+ max_context_posts = bot.agent.class.max_context_posts || 40
end
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
post: post,
user: attributed_user,
custom_instructions: custom_instructions,
@@ -468,19 +465,19 @@ module DiscourseAi
post,
style: context_style,
max_posts: max_context_posts,
- include_uploads: bot.persona.class.vision_enabled,
+ include_uploads: bot.agent.class.vision_enabled,
bot_usernames: available_bot_usernames,
),
)
reply_user = bot.bot_user
- if bot.persona.class.respond_to?(:user_id)
- reply_user = User.find_by(id: bot.persona.class.user_id) || reply_user
+ if bot.agent.class.respond_to?(:user_id)
+ reply_user = User.find_by(id: bot.agent.class.user_id) || reply_user
end
stream_reply = post.topic.private_message? if stream_reply.nil?
- # we need to ensure persona user is allowed to reply to the pm
+ # we need to ensure agent user is allowed to reply to the pm
if post.topic.private_message? && add_user_to_pm
if !post.topic.topic_allowed_users.exists?(user_id: reply_user.id)
post.topic.topic_allowed_users.create!(user_id: reply_user.id)
@@ -524,7 +521,7 @@ module DiscourseAi
custom_fields: {
DiscourseAi::AiBot::POST_AI_LLM_NAME_FIELD => bot.llm.llm_model.display_name,
DiscourseAi::AiBot::POST_AI_LLM_MODEL_ID_FIELD => bot.llm.llm_model.id,
- DiscourseAi::AiBot::POST_AI_PERSONA_ID_FIELD => bot.persona.id,
+ DiscourseAi::AiBot::POST_AI_AGENT_ID_FIELD => bot.agent.id,
},
)
end
@@ -537,7 +534,7 @@ module DiscourseAi
.llm
.llm_model
.id
- reply_post.custom_fields[DiscourseAi::AiBot::POST_AI_PERSONA_ID_FIELD] = bot.persona.id
+ reply_post.custom_fields[DiscourseAi::AiBot::POST_AI_AGENT_ID_FIELD] = bot.agent.id
reply_post.save_custom_fields
publish_update(reply_post, { raw: "" })
@@ -558,7 +555,7 @@ module DiscourseAi
)
end
- context.skip_show_thinking ||= !bot.persona.class.show_thinking
+ context.skip_show_thinking ||= !bot.agent.class.show_thinking
post_streamer = PostStreamer.new(delay: Rails.env.test? ? 0 : 0.5) if stream_reply
started_thinking = false
@@ -621,7 +618,7 @@ module DiscourseAi
custom_fields: {
DiscourseAi::AiBot::POST_AI_LLM_NAME_FIELD => bot.llm.llm_model.display_name,
DiscourseAi::AiBot::POST_AI_LLM_MODEL_ID_FIELD => bot.llm.llm_model.id,
- DiscourseAi::AiBot::POST_AI_PERSONA_ID_FIELD => bot.persona.id,
+ DiscourseAi::AiBot::POST_AI_AGENT_ID_FIELD => bot.agent.id,
},
)
end
@@ -693,11 +690,11 @@ module DiscourseAi
def available_bot_usernames
@bot_usernames ||=
- AiPersona.joins(:user).pluck(:username).concat(available_bot_users.map(&:username))
+ AiAgent.joins(:user).pluck(:username).concat(available_bot_users.map(&:username))
end
def available_bot_user_ids
- @bot_ids ||= AiPersona.joins(:user).pluck("users.id").concat(available_bot_users.map(&:id))
+ @bot_ids ||= AiAgent.joins(:user).pluck("users.id").concat(available_bot_users.map(&:id))
end
private
@@ -748,13 +745,12 @@ module DiscourseAi
end
def schedule_bot_reply(post)
- persona_id =
- DiscourseAi::Personas::Persona.system_personas[bot.persona.class] || bot.persona.class.id
+ agent_id = DiscourseAi::Agents::Agent.system_agents[bot.agent.class] || bot.agent.class.id
::Jobs.enqueue(
:create_ai_reply,
post_id: post.id,
bot_user_id: bot.bot_user.id,
- persona_id: persona_id,
+ agent_id: agent_id,
)
end
diff --git a/plugins/discourse-ai/lib/ai_bot/response_http_streamer.rb b/plugins/discourse-ai/lib/ai_bot/response_http_streamer.rb
index c682e770f3d..0a0b7242621 100644
--- a/plugins/discourse-ai/lib/ai_bot/response_http_streamer.rb
+++ b/plugins/discourse-ai/lib/ai_bot/response_http_streamer.rb
@@ -31,7 +31,7 @@ module DiscourseAi
# this allows us to release memory earlier
def queue_streamed_reply(
io:,
- persona:,
+ agent:,
user:,
topic:,
query:,
@@ -46,7 +46,7 @@ module DiscourseAi
if custom_tools.present? || resume_token.present?
stream_custom_tool_reply(
io: io,
- persona: persona,
+ agent: agent,
user: user,
topic: topic,
query: query,
@@ -59,7 +59,7 @@ module DiscourseAi
else
stream_standard_reply(
io: io,
- persona: persona,
+ agent: agent,
user: user,
topic: topic,
query: query,
@@ -80,7 +80,7 @@ module DiscourseAi
def stream_standard_reply(
io:,
- persona:,
+ agent:,
user:,
topic:,
query:,
@@ -100,7 +100,7 @@ module DiscourseAi
else
post_params[:title] = I18n.t("discourse_ai.ai_bot.default_pm_prefix")
post_params[:archetype] = Archetype.private_message
- post_params[:target_usernames] = "#{user.username},#{persona.user.username}"
+ post_params[:target_usernames] = "#{user.username},#{agent.user.username}"
end
post = PostCreator.create!(user, post_params)
@@ -108,13 +108,10 @@ module DiscourseAi
write_headers(io)
- persona_class = DiscourseAi::Personas::Persona.find_by(id: persona.id, user: current_user)
- bot = DiscourseAi::Personas::Bot.as(persona.user, persona: persona_class.new)
+ agent_class = DiscourseAi::Agents::Agent.find_by(id: agent.id, user: current_user)
+ bot = DiscourseAi::Agents::Bot.as(agent.user, agent: agent_class.new)
- write_chunk(
- io,
- { topic_id: topic.id, bot_user_id: persona.user.id, persona_id: persona.id },
- )
+ write_chunk(io, { topic_id: topic.id, bot_user_id: agent.user.id, agent_id: agent.id })
DiscourseAi::AiBot::Playground
.new(bot)
@@ -129,7 +126,7 @@ module DiscourseAi
def stream_custom_tool_reply(
io:,
- persona:,
+ agent:,
user:,
topic:,
query:,
@@ -145,7 +142,7 @@ module DiscourseAi
session =
DiscourseAi::AiBot::StreamReplyCustomToolsSession.new(
- persona: persona,
+ agent: agent,
user: user,
topic: topic,
query: query,
diff --git a/plugins/discourse-ai/lib/ai_bot/stream_reply_custom_tools_session.rb b/plugins/discourse-ai/lib/ai_bot/stream_reply_custom_tools_session.rb
index b66cd9b0248..c6e65dc5deb 100644
--- a/plugins/discourse-ai/lib/ai_bot/stream_reply_custom_tools_session.rb
+++ b/plugins/discourse-ai/lib/ai_bot/stream_reply_custom_tools_session.rb
@@ -27,7 +27,7 @@ module DiscourseAi
end
def initialize(
- persona:,
+ agent:,
user:,
topic:,
query:,
@@ -37,7 +37,7 @@ module DiscourseAi
resume_token:,
tool_results:
)
- @persona = persona
+ @agent = agent
@user = user
@topic = topic
@query = query
@@ -63,7 +63,7 @@ module DiscourseAi
event_blk.call(
:context,
- { topic_id: @topic.id, bot_user_id: @reply_user.id, persona_id: @persona.id },
+ { topic_id: @topic.id, bot_user_id: @reply_user.id, agent_id: @agent.id },
)
run_single_completion_round!(&event_blk)
@@ -89,23 +89,23 @@ module DiscourseAi
else
post_params[:title] = I18n.t("discourse_ai.ai_bot.default_pm_prefix")
post_params[:archetype] = Archetype.private_message
- post_params[:target_usernames] = "#{@user.username},#{@persona.user.username}"
+ post_params[:target_usernames] = "#{@user.username},#{@agent.user.username}"
end
@source_post = PostCreator.create!(@user, post_params)
@topic = @source_post.topic
@source_post_number = @source_post.post_number
- persona_class = DiscourseAi::Personas::Persona.find_by(id: @persona.id, user: @current_user)
- raise ProtocolError, I18n.t("discourse_ai.errors.persona_not_found") if persona_class.nil?
+ agent_class = DiscourseAi::Agents::Agent.find_by(id: @agent.id, user: @current_user)
+ raise ProtocolError, I18n.t("discourse_ai.errors.agent_not_found") if agent_class.nil?
- @bot = DiscourseAi::Personas::Bot.as(@persona.user, persona: persona_class.new)
+ @bot = DiscourseAi::Agents::Bot.as(@agent.user, agent: agent_class.new)
@reply_user = @bot.bot_user
@llm_model_id = @bot.model.id
- max_context_posts = @bot.persona.class.max_context_posts || 40
+ max_context_posts = @bot.agent.class.max_context_posts || 40
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
post: @source_post,
user: @user,
custom_instructions: @custom_instructions,
@@ -113,20 +113,20 @@ module DiscourseAi
DiscourseAi::Completions::PromptMessagesBuilder.messages_from_post(
@source_post,
max_posts: max_context_posts,
- include_uploads: @bot.persona.class.vision_enabled,
+ include_uploads: @bot.agent.class.vision_enabled,
bot_usernames: available_bot_usernames,
),
)
- @prompt = @bot.persona.craft_prompt(context, llm: @bot.llm)
- # This endpoint supports caller-owned tool execution. We replace persona tools so every
+ @prompt = @bot.agent.craft_prompt(context, llm: @bot.llm)
+ # This endpoint supports caller-owned tool execution. We replace agent tools so every
# emitted tool call can be completed through the resume protocol.
@prompt.tools =
@custom_tools.map do |tool|
DiscourseAi::Completions::ToolDefinition.from_hash(tool.deep_symbolize_keys)
end
- @temperature = @bot.persona.temperature
- @top_p = @bot.persona.top_p
+ @temperature = @bot.agent.temperature
+ @top_p = @bot.agent.top_p
end
def load_resume_state!
@@ -141,7 +141,7 @@ module DiscourseAi
raise ResumeTokenNotFound, I18n.t("discourse_ai.errors.invalid_stream_resume_token")
end
- @persona = AiPersona.find(payload["persona_id"])
+ @agent = AiAgent.find(payload["agent_id"])
@user = User.find(payload["user_id"])
@topic = Topic.find(payload["topic_id"])
@reply_user = User.find(payload["reply_user_id"])
@@ -194,7 +194,7 @@ module DiscourseAi
# text-only call or finalize immediately — don't overshoot.
if use_token_budget && @accumulated_tokens >= token_budget
if @prompt.messages.last&.dig(:type) == :tool
- DiscourseAi::Personas::Bot.inject_budget_exhausted_hint(@prompt)
+ DiscourseAi::Agents::Bot.inject_budget_exhausted_hint(@prompt)
@prompt.tool_choice = :none
final_reply = +""
@@ -271,7 +271,7 @@ module DiscourseAi
)
end
- DiscourseAi::Personas::Bot.inject_budget_exhausted_hint(@prompt)
+ DiscourseAi::Agents::Bot.inject_budget_exhausted_hint(@prompt)
@prompt.tool_choice = :none
final_reply = +""
@@ -402,7 +402,7 @@ module DiscourseAi
payload = {
version: 1,
current_user_id: @current_user&.id,
- persona_id: @persona.id,
+ agent_id: @agent.id,
user_id: @user.id,
topic_id: @topic.id,
reply_user_id: @reply_user.id,
@@ -489,7 +489,7 @@ module DiscourseAi
def available_bot_usernames
@available_bot_usernames ||=
- AiPersona.joins(:user).pluck(:username).concat(available_bot_users.map(&:username))
+ AiAgent.joins(:user).pluck(:username).concat(available_bot_users.map(&:username))
end
def available_bot_users
@@ -497,21 +497,21 @@ module DiscourseAi
User.joins("INNER JOIN llm_models llm ON llm.user_id = users.id").where(active: true)
end
- def resolve_persona_record
- @_persona_record ||=
- if @persona.is_a?(AiPersona)
- @persona
+ def resolve_agent_record
+ @_agent_record ||=
+ if @agent.is_a?(AiAgent)
+ @agent
else
- AiPersona.find_by(id: @persona.id)
+ AiAgent.find_by(id: @agent.id)
end
end
def resolve_token_budget
- resolve_persona_record&.max_turn_tokens
+ resolve_agent_record&.max_turn_tokens
end
def resolve_execution_mode
- resolve_persona_record&.execution_mode || "default"
+ resolve_agent_record&.execution_mode || "default"
end
def persist_reply_post!
@@ -526,20 +526,14 @@ module DiscourseAi
custom_fields: {
DiscourseAi::AiBot::POST_AI_LLM_NAME_FIELD => llm_model.display_name,
DiscourseAi::AiBot::POST_AI_LLM_MODEL_ID_FIELD => @llm_model_id,
- DiscourseAi::AiBot::POST_AI_PERSONA_ID_FIELD => @persona.id,
+ DiscourseAi::AiBot::POST_AI_AGENT_ID_FIELD => @agent.id,
},
)
if @source_post_number == 1 && @topic.private_message?
- persona_class =
- DiscourseAi::Personas::Persona.find_by(id: @persona.id, user: @current_user)
- if persona_class
- bot =
- DiscourseAi::Personas::Bot.as(
- @reply_user,
- persona: persona_class.new,
- model: llm_model,
- )
+ agent_class = DiscourseAi::Agents::Agent.find_by(id: @agent.id, user: @current_user)
+ if agent_class
+ bot = DiscourseAi::Agents::Bot.as(@reply_user, agent: agent_class.new, model: llm_model)
begin
DiscourseAi::AiBot::Playground.new(bot).title_playground(reply_post, @user)
rescue StandardError => e
diff --git a/plugins/discourse-ai/lib/ai_helper/assistant.rb b/plugins/discourse-ai/lib/ai_helper/assistant.rb
index 41c2d703272..35de8a7a419 100644
--- a/plugins/discourse-ai/lib/ai_helper/assistant.rb
+++ b/plugins/discourse-ai/lib/ai_helper/assistant.rb
@@ -37,8 +37,8 @@ module DiscourseAi
next if !user.in_any_groups?(prompt[:allowed_group_ids])
if prompt[:name] == ILLUSTRATE_POST
- persona = AiPersona.find_by(id: SiteSetting.ai_helper_post_illustrator_persona)
- next if persona.blank? || !persona_has_image_generation_tool?(persona)
+ agent = AiAgent.find_by(id: SiteSetting.ai_helper_post_illustrator_agent)
+ next if agent.blank? || !agent_has_image_generation_tool?(agent)
end
# We cannot cache this. It depends on the user's effective_locale.
@@ -116,7 +116,7 @@ module DiscourseAi
end
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: user,
skip_show_thinking: true,
feature_name: "ai_helper",
@@ -127,7 +127,7 @@ module DiscourseAi
context = attach_user_context(context, user, force_default_locale: force_default_locale)
bad_json = false
- json_summary_schema_key = bot.persona.response_format&.first.to_h
+ json_summary_schema_key = bot.agent.response_format&.first.to_h
schema_key = json_summary_schema_key["key"]&.to_sym
schema_type = json_summary_schema_key["type"]
@@ -251,7 +251,7 @@ module DiscourseAi
force_default_locale = false
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: user,
skip_show_thinking: true,
feature_name: IMAGE_CAPTION,
@@ -270,7 +270,7 @@ module DiscourseAi
Proc.new do |partial, _, type|
if type == :structured_output
structured_output = partial
- bot.persona.response_format&.first.to_h
+ bot.agent.response_format&.first.to_h
end
end
@@ -279,7 +279,7 @@ module DiscourseAi
raw_caption = ""
if structured_output
- json_summary_schema_key = bot.persona.response_format&.first.to_h
+ json_summary_schema_key = bot.agent.response_format&.first.to_h
raw_caption =
structured_output.read_buffered_property(json_summary_schema_key["key"]&.to_sym)
end
@@ -289,41 +289,41 @@ module DiscourseAi
private
- def persona_has_image_generation_tool?(persona)
- persona&.has_image_generation_tool?
+ def agent_has_image_generation_tool?(agent)
+ agent&.has_image_generation_tool?
rescue StandardError => e
Rails.logger.warn(
- "Failed to check image generation tool for persona #{persona&.id}: #{e.message}",
+ "Failed to check image generation tool for agent #{agent&.id}: #{e.message}",
)
false
end
def build_bot(helper_mode, user)
- persona_id = personas_prompt_map(include_image_caption: true).invert[helper_mode]
- raise Discourse::InvalidParameters.new(:mode) if persona_id.blank?
+ agent_id = agents_prompt_map(include_image_caption: true).invert[helper_mode]
+ raise Discourse::InvalidParameters.new(:mode) if agent_id.blank?
- persona_klass = AiPersona.find_by(id: persona_id)&.class_instance
- return if persona_klass.nil?
+ agent_klass = AiAgent.find_by(id: agent_id)&.class_instance
+ return if agent_klass.nil?
- llm_model = find_ai_helper_model(helper_mode, persona_klass)
+ llm_model = find_ai_helper_model(helper_mode, agent_klass)
- DiscourseAi::Personas::Bot.as(user, persona: persona_klass.new, model: llm_model)
+ DiscourseAi::Agents::Bot.as(user, agent: agent_klass.new, model: llm_model)
end
- def find_ai_helper_model(helper_mode, persona_klass)
+ def find_ai_helper_model(helper_mode, agent_klass)
if helper_mode == IMAGE_CAPTION && @image_caption_llm.is_a?(LlmModel)
return @image_caption_llm
end
return @helper_llm if helper_mode != IMAGE_CAPTION && @helper_llm.is_a?(LlmModel)
- self.class.find_ai_helper_model(helper_mode, persona_klass)
+ self.class.find_ai_helper_model(helper_mode, agent_klass)
end
# Priorities are:
- # 1. Persona's default LLM
+ # 1. Agent's default LLM
# 2. SiteSetting.ai_default_llm_model (or newest LLM if not set)
- def self.find_ai_helper_model(helper_mode, persona_klass)
- model_id = persona_klass.default_llm_id || SiteSetting.ai_default_llm_model
+ def self.find_ai_helper_model(helper_mode, agent_klass)
+ model_id = agent_klass.default_llm_id || SiteSetting.ai_default_llm_model
if model_id.present?
LlmModel.find_by(id: model_id)
@@ -332,31 +332,31 @@ module DiscourseAi
end
end
- def personas_prompt_map(include_image_caption: false)
+ def agents_prompt_map(include_image_caption: false)
map = {
- SiteSetting.ai_helper_translator_persona.to_i => TRANSLATE,
- SiteSetting.ai_helper_title_suggestions_persona.to_i => GENERATE_TITLES,
- SiteSetting.ai_helper_proofreader_persona.to_i => PROOFREAD,
- SiteSetting.ai_helper_markdown_tables_persona.to_i => MARKDOWN_TABLE,
- SiteSetting.ai_helper_custom_prompt_persona.to_i => CUSTOM_PROMPT,
- SiteSetting.ai_helper_explain_persona.to_i => EXPLAIN,
- SiteSetting.ai_helper_post_illustrator_persona.to_i => ILLUSTRATE_POST,
- SiteSetting.ai_helper_smart_dates_persona.to_i => REPLACE_DATES,
+ SiteSetting.ai_helper_translator_agent.to_i => TRANSLATE,
+ SiteSetting.ai_helper_title_suggestions_agent.to_i => GENERATE_TITLES,
+ SiteSetting.ai_helper_proofreader_agent.to_i => PROOFREAD,
+ SiteSetting.ai_helper_markdown_tables_agent.to_i => MARKDOWN_TABLE,
+ SiteSetting.ai_helper_custom_prompt_agent.to_i => CUSTOM_PROMPT,
+ SiteSetting.ai_helper_explain_agent.to_i => EXPLAIN,
+ SiteSetting.ai_helper_post_illustrator_agent.to_i => ILLUSTRATE_POST,
+ SiteSetting.ai_helper_smart_dates_agent.to_i => REPLACE_DATES,
}
if include_image_caption
- image_caption_persona = SiteSetting.ai_helper_image_caption_persona.to_i
- map[image_caption_persona] = IMAGE_CAPTION if image_caption_persona
+ image_caption_agent = SiteSetting.ai_helper_image_caption_agent.to_i
+ map[image_caption_agent] = IMAGE_CAPTION if image_caption_agent
end
map
end
def all_prompts
- AiPersona
- .where(id: personas_prompt_map.keys)
- .map do |ai_persona|
- prompt_name = personas_prompt_map[ai_persona.id]
+ AiAgent
+ .where(id: agents_prompt_map.keys)
+ .map do |ai_agent|
+ prompt_name = agents_prompt_map[ai_agent.id]
if prompt_name
{
@@ -367,7 +367,7 @@ module DiscourseAi
prompt_type: prompt_type(prompt_name),
icon: icon_map(prompt_name),
location: location_map(prompt_name),
- allowed_group_ids: ai_persona.allowed_group_ids,
+ allowed_group_ids: ai_agent.allowed_group_ids,
}
end
end
diff --git a/plugins/discourse-ai/lib/ai_helper/chat_thread_titler.rb b/plugins/discourse-ai/lib/ai_helper/chat_thread_titler.rb
index 1f183c16493..7c1f46c227c 100644
--- a/plugins/discourse-ai/lib/ai_helper/chat_thread_titler.rb
+++ b/plugins/discourse-ai/lib/ai_helper/chat_thread_titler.rb
@@ -22,21 +22,20 @@ module DiscourseAi
private
def call_llm(thread_content)
- ai_persona =
- AiPersona.find_by_id_from_cache(SiteSetting.ai_helper_chat_thread_title_persona)
- return nil if ai_persona.blank?
+ ai_agent = AiAgent.find_by_id_from_cache(SiteSetting.ai_helper_chat_thread_title_agent)
+ return nil if ai_agent.blank?
- persona_klass = ai_persona.class_instance
- llm_model = Assistant.find_ai_helper_model(FEATURE_NAME, persona_klass)
+ agent_klass = ai_agent.class_instance
+ llm_model = Assistant.find_ai_helper_model(FEATURE_NAME, agent_klass)
return nil if llm_model.blank?
- persona = persona_klass.new
+ agent = agent_klass.new
user = Discourse.system_user
- bot = DiscourseAi::Personas::Bot.as(user, persona: persona, model: llm_model)
+ bot = DiscourseAi::Agents::Bot.as(user, agent: agent, model: llm_model)
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: user,
skip_show_thinking: true,
feature_name: FEATURE_NAME,
diff --git a/plugins/discourse-ai/lib/ai_helper/entry_point.rb b/plugins/discourse-ai/lib/ai_helper/entry_point.rb
index ac240e9fe3e..9e1ffee06ec 100644
--- a/plugins/discourse-ai/lib/ai_helper/entry_point.rb
+++ b/plugins/discourse-ai/lib/ai_helper/entry_point.rb
@@ -20,8 +20,8 @@ module DiscourseAi
custom_prompt_allowed_group_ids =
DB.query_single(
- "SELECT allowed_group_ids FROM ai_personas WHERE id = :customp_prompt_persona_id",
- customp_prompt_persona_id: SiteSetting.ai_helper_custom_prompt_persona,
+ "SELECT allowed_group_ids FROM ai_agents WHERE id = :customp_prompt_agent_id",
+ customp_prompt_agent_id: SiteSetting.ai_helper_custom_prompt_agent,
).flatten
scope.user.in_any_groups?(custom_prompt_allowed_group_ids)
diff --git a/plugins/discourse-ai/lib/ai_moderation/spam_scanner.rb b/plugins/discourse-ai/lib/ai_moderation/spam_scanner.rb
index 45a7f8267a7..e341e902997 100644
--- a/plugins/discourse-ai/lib/ai_moderation/spam_scanner.rb
+++ b/plugins/discourse-ai/lib/ai_moderation/spam_scanner.rb
@@ -185,8 +185,8 @@ module DiscourseAi
end
used_llm = bot.model
- spam_persona = bot.persona
- used_prompt = spam_persona.craft_prompt(ctx, llm: used_llm).system_message_text
+ spam_agent = bot.agent
+ used_prompt = spam_agent.craft_prompt(ctx, llm: used_llm).system_message_text
text_content =
if target_msg[:content].is_a?(Array)
@@ -218,7 +218,10 @@ module DiscourseAi
def self.perform_scan!(post)
return if !enabled?
settings = AiModerationSetting.spam
- return if !settings || !settings.llm_model || !settings.ai_persona
+ return if !settings || !settings.llm_model
+
+ agent = settings.ai_agent
+ return if !agent
target_msg = build_target_content_msg(post)
custom_instructions = settings.custom_instructions.presence
@@ -293,7 +296,7 @@ module DiscourseAi
bypass_response_format: false,
user: Discourse.system_user
)
- DiscourseAi::Personas::BotContext
+ DiscourseAi::Agents::BotContext
.new(
user: user,
skip_show_thinking: true,
@@ -310,11 +313,11 @@ module DiscourseAi
llm_id: nil,
user: Discourse.system_user
)
- persona = settings.ai_persona.class_instance&.new
+ agent = settings.ai_agent.class_instance&.new
llm_model = llm_id ? LlmModel.find(llm_id) : settings.llm_model
- DiscourseAi::Personas::Bot.as(user, persona: persona, model: llm_model)
+ DiscourseAi::Agents::Bot.as(user, agent: agent, model: llm_model)
end
def self.is_spam?(structured_output)
diff --git a/plugins/discourse-ai/lib/ai_tool_scripts/preamble.js b/plugins/discourse-ai/lib/ai_tool_scripts/preamble.js
index 403a0ebed30..135f30482ad 100644
--- a/plugins/discourse-ai/lib/ai_tool_scripts/preamble.js
+++ b/plugins/discourse-ai/lib/ai_tool_scripts/preamble.js
@@ -168,11 +168,11 @@
* user_id_or_username (number | string): The ID or username of the user.
* Returns: Object (User details using UserSerializer structure) or null if not found.
*
- * discourse.getPersona(name): Gets an object representing another AI Persona configured on the site.
+ * discourse.getAgent(name): Gets an object representing another AI Agent configured on the site.
* Parameters:
- * name (string): The name of the target persona.
- * Returns: Object { respondTo: function(params) } or null if persona not found.
- * respondTo(params): Instructs the target persona to generate a response within the current context (e.g., replying to the same post or chat message).
+ * name (string): The name of the target agent.
+ * Returns: Object { respondTo: function(params) } or null if agent not found.
+ * respondTo(params): Instructs the target agent to generate a response within the current context (e.g., replying to the same post or chat message).
* Parameters:
* params (Object, optional): { instructions: string, whisper: boolean }
* Returns: { success: boolean, post_id?: number, post_number?: number, message_id?: number } or { error: string }
@@ -240,8 +240,8 @@
* Invocation Contexts:
*
* A) AI Bot Conversation (Post context):
- * When a user mentions an AI persona in a topic or PM, tools run with:
- * context.post_id (number): The post that triggered the persona.
+ * When a user mentions an AI agent in a topic or PM, tools run with:
+ * context.post_id (number): The post that triggered the agent.
* context.topic_id (number): The topic containing the post.
* context.private_message (boolean): Whether this is a PM.
* context.participants (string): Comma-separated usernames (in PMs).
@@ -249,7 +249,7 @@
* context.user_id (number): The user's ID.
*
* B) Chat Context:
- * When a user mentions an AI persona in a chat channel:
+ * When a user mentions an AI agent in a chat channel:
* context.message_id (number): The chat message that triggered the tool.
* context.channel_id (number): The chat channel ID.
* context.username (string): The user who sent the message.
diff --git a/plugins/discourse-ai/lib/automation.rb b/plugins/discourse-ai/lib/automation.rb
index 70935fcc33b..267c811adff 100644
--- a/plugins/discourse-ai/lib/automation.rb
+++ b/plugins/discourse-ai/lib/automation.rb
@@ -53,14 +53,14 @@ module DiscourseAi
SQL
end
- def self.available_persona_choices(require_user: true, require_default_llm: true)
- relation = AiPersona.includes(:user)
+ def self.available_agent_choices(require_user: true, require_default_llm: true)
+ relation = AiAgent.includes(:user)
relation = relation.where.not(user_id: nil) if require_user
relation = relation.where.not(default_llm: nil) if require_default_llm
- relation.map do |persona|
- phash = { id: persona.id, translated_name: persona.name, description: persona.name }
+ relation.map do |agent|
+ phash = { id: agent.id, translated_name: agent.name, description: agent.name }
- phash[:description] += " (#{persona&.user&.username})" if require_user
+ phash[:description] += " (#{agent&.user&.username})" if require_user
phash
end
diff --git a/plugins/discourse-ai/lib/automation/ai_tool_action.rb b/plugins/discourse-ai/lib/automation/ai_tool_action.rb
index 8d98c36d898..81620926dd0 100644
--- a/plugins/discourse-ai/lib/automation/ai_tool_action.rb
+++ b/plugins/discourse-ai/lib/automation/ai_tool_action.rb
@@ -10,7 +10,7 @@ module DiscourseAi
llm =
LlmModel.find_by(id: llm_model_id)&.then { |m| DiscourseAi::Completions::Llm.proxy(m) }
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
post: post,
feature_name: "ai_tool_action",
feature_context: {
diff --git a/plugins/discourse-ai/lib/automation/llm_persona_triage.rb b/plugins/discourse-ai/lib/automation/llm_agent_triage.rb
similarity index 82%
rename from plugins/discourse-ai/lib/automation/llm_persona_triage.rb
rename to plugins/discourse-ai/lib/automation/llm_agent_triage.rb
index bd5a29d73f9..1fedf15df4a 100644
--- a/plugins/discourse-ai/lib/automation/llm_persona_triage.rb
+++ b/plugins/discourse-ai/lib/automation/llm_agent_triage.rb
@@ -1,10 +1,10 @@
# frozen_string_literal: true
module DiscourseAi
module Automation
- module LlmPersonaTriage
+ module LlmAgentTriage
def self.handle(
post:,
- persona_id:,
+ agent_id:,
whisper: false,
silent_mode: false,
automation: nil,
@@ -12,7 +12,7 @@ module DiscourseAi
)
DiscourseAi::AiBot::Playground.reply_to_post(
post: post,
- persona_id: persona_id,
+ agent_id: agent_id,
whisper: whisper,
silent_mode: silent_mode,
feature_name: "automation - #{automation&.name}",
@@ -26,7 +26,7 @@ module DiscourseAi
rescue => e
Discourse.warn_exception(
e,
- message: "Error responding to: #{post&.url} in LlmPersonaTriage.handle",
+ message: "Error responding to: #{post&.url} in LlmAgentTriage.handle",
)
raise e if Rails.env.test?
nil
diff --git a/plugins/discourse-ai/lib/automation/llm_tagger.rb b/plugins/discourse-ai/lib/automation/llm_tagger.rb
index 690ccdedd0b..f69679272de 100644
--- a/plugins/discourse-ai/lib/automation/llm_tagger.rb
+++ b/plugins/discourse-ai/lib/automation/llm_tagger.rb
@@ -5,7 +5,7 @@ module DiscourseAi
module LlmTagger
def self.handle(
post:,
- tagger_persona_id:,
+ tagger_agent_id:,
tag_mode: "manual",
available_tags: [],
confidence_threshold:,
@@ -18,8 +18,8 @@ module DiscourseAi
# Skip if manual mode but no tags provided
return if tag_mode == "manual" && available_tags.empty?
- tagger_persona = AiPersona.find(tagger_persona_id)
- model_id = tagger_persona.default_llm_id || SiteSetting.ai_default_llm_model
+ tagger_agent = AiAgent.find(tagger_agent_id)
+ model_id = tagger_agent.default_llm_id || SiteSetting.ai_default_llm_model
return if model_id.blank?
model = LlmModel.find(model_id)
@@ -53,16 +53,16 @@ module DiscourseAi
end
bot =
- DiscourseAi::Personas::Bot.as(
+ DiscourseAi::Agents::Bot.as(
Discourse.system_user,
- persona: tagger_persona.class_instance.new,
+ agent: tagger_agent.class_instance.new,
model: model,
)
- persona_response_format = tagger_persona.response_format
+ agent_response_format = tagger_agent.response_format
bot_ctx =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: Discourse.system_user,
skip_show_thinking: true,
feature_name: "llm_tagger",
@@ -76,7 +76,7 @@ module DiscourseAi
},
}
- llm_args[:response_format] = persona_response_format if persona_response_format.present?
+ llm_args[:response_format] = agent_response_format if agent_response_format.present?
result = +""
bot.reply(bot_ctx, llm_args: llm_args) do |partial, _, type|
diff --git a/plugins/discourse-ai/lib/automation/llm_triage.rb b/plugins/discourse-ai/lib/automation/llm_triage.rb
index d2aba679c26..430d175460b 100644
--- a/plugins/discourse-ai/lib/automation/llm_triage.rb
+++ b/plugins/discourse-ai/lib/automation/llm_triage.rb
@@ -38,7 +38,7 @@ module DiscourseAi
def self.handle(
post:,
- triage_persona_id:,
+ triage_agent_id:,
search_for_text:,
category_id: nil,
tags: nil,
@@ -51,7 +51,7 @@ module DiscourseAi
max_post_tokens: nil,
stop_sequences: nil,
whisper: nil,
- reply_persona_id: nil,
+ reply_agent_id: nil,
max_output_tokens: nil,
action: nil,
notify_author_pm: nil,
@@ -59,7 +59,7 @@ module DiscourseAi
notify_author_pm_message: nil
)
if category_id.blank? && tags.blank? && canned_reply.blank? && hide_topic.blank? &&
- flag_post.blank? && reply_persona_id.blank?
+ flag_post.blank? && reply_agent_id.blank?
raise ArgumentError, "llm_triage: no action specified!"
end
@@ -68,15 +68,15 @@ module DiscourseAi
return
end
- triage_persona = AiPersona.find(triage_persona_id)
- model_id = triage_persona.default_llm_id || SiteSetting.ai_default_llm_model
+ triage_agent = AiAgent.find(triage_agent_id)
+ model_id = triage_agent.default_llm_id || SiteSetting.ai_default_llm_model
return if model_id.blank?
model = LlmModel.find(model_id)
bot =
- DiscourseAi::Personas::Bot.as(
+ DiscourseAi::Agents::Bot.as(
Discourse.system_user,
- persona: triage_persona.class_instance.new,
+ agent: triage_agent.class_instance.new,
model: model,
)
@@ -89,13 +89,13 @@ module DiscourseAi
strict: SiteSetting.ai_strict_token_counting,
) if max_post_tokens.present?
- if post.upload_ids.present? && triage_persona.vision_enabled
+ if post.upload_ids.present? && triage_agent.vision_enabled
input = [input]
input.concat(post.upload_ids.map { |upload_id| { upload_id: upload_id } })
end
bot_ctx =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: Discourse.system_user,
post: post,
skip_show_thinking: true,
@@ -138,11 +138,11 @@ module DiscourseAi
user = User.find_by_username(canned_reply_user) if canned_reply_user.present?
original_user = user
user = user || Discourse.system_user
- if reply_persona_id.present? && action != :edit
+ if reply_agent_id.present? && action != :edit
begin
DiscourseAi::AiBot::Playground.reply_to_post(
post: post,
- persona_id: reply_persona_id,
+ agent_id: reply_agent_id,
whisper: whisper,
user: original_user,
attributed_user: Discourse.system_user,
diff --git a/plugins/discourse-ai/lib/automation/report_runner.rb b/plugins/discourse-ai/lib/automation/report_runner.rb
index 835557f99c9..1b7d7d452ff 100644
--- a/plugins/discourse-ai/lib/automation/report_runner.rb
+++ b/plugins/discourse-ai/lib/automation/report_runner.rb
@@ -36,7 +36,7 @@ module DiscourseAi
def initialize(
sender_username:,
model:,
- persona_id:,
+ agent_id:,
sample_size:,
instructions:,
tokens_per_post:,
@@ -70,7 +70,7 @@ module DiscourseAi
@email_receivers = receivers&.filter { |r| r.include? "@" }
@title = title.presence || I18n.t("discourse_automation.scriptables.llm_report.title")
@model = LlmModel.find_by(id: model)
- @persona = AiPersona.find(persona_id).class_instance.new
+ @agent = AiAgent.find(agent_id).class_instance.new
@category_ids = category_ids
@tags = tags
@allow_secure_categories = allow_secure_categories
@@ -137,7 +137,7 @@ module DiscourseAi
INPUT
report_ctx =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: Discourse.system_user,
skip_show_thinking: true,
feature_name: "ai_report",
@@ -147,8 +147,8 @@ module DiscourseAi
puts if Rails.env.development? && @debug_mode
result = +""
- bot = DiscourseAi::Personas::Bot.as(Discourse.system_user, persona: @persona, model: @model)
- json_summary_schema_key = @persona.response_format&.first.to_h
+ bot = DiscourseAi::Agents::Bot.as(Discourse.system_user, agent: @agent, model: @model)
+ json_summary_schema_key = @agent.response_format&.first.to_h
buffer_blk =
Proc.new do |partial, _, type|
diff --git a/plugins/discourse-ai/lib/configuration/persona_enumerator.rb b/plugins/discourse-ai/lib/configuration/agent_enumerator.rb
similarity index 53%
rename from plugins/discourse-ai/lib/configuration/persona_enumerator.rb
rename to plugins/discourse-ai/lib/configuration/agent_enumerator.rb
index c115bc50a26..b25bdf4de8b 100644
--- a/plugins/discourse-ai/lib/configuration/persona_enumerator.rb
+++ b/plugins/discourse-ai/lib/configuration/agent_enumerator.rb
@@ -4,15 +4,15 @@ require "enum_site_setting"
module DiscourseAi
module Configuration
- class PersonaEnumerator < ::EnumSiteSetting
+ class AgentEnumerator < ::EnumSiteSetting
def self.valid_value?(val)
true
end
def self.values
- AiPersona
- .all_personas(enabled_only: false)
- .map { |persona| { name: persona.name, value: persona.id } }
+ AiAgent
+ .all_agents(enabled_only: false)
+ .map { |agent| { name: agent.name, value: agent.id } }
end
end
end
diff --git a/plugins/discourse-ai/lib/configuration/feature.rb b/plugins/discourse-ai/lib/configuration/feature.rb
index fed49adf34d..43550246793 100644
--- a/plugins/discourse-ai/lib/configuration/feature.rb
+++ b/plugins/discourse-ai/lib/configuration/feature.rb
@@ -12,13 +12,13 @@ module DiscourseAi
feature_cache[:summarization] ||= [
new(
"topic_summaries",
- "ai_summarization_persona",
+ "ai_summarization_agent",
DiscourseAi::Configuration::Module::SUMMARIZATION_ID,
DiscourseAi::Configuration::Module::SUMMARIZATION,
),
new(
"gists",
- "ai_summary_gists_persona",
+ "ai_summary_gists_agent",
DiscourseAi::Configuration::Module::SUMMARIZATION_ID,
DiscourseAi::Configuration::Module::SUMMARIZATION,
enabled_by_setting: "ai_summary_gists_enabled",
@@ -30,7 +30,7 @@ module DiscourseAi
feature_cache[:search] ||= [
new(
"discoveries",
- "ai_discover_persona",
+ "ai_discover_agent",
DiscourseAi::Configuration::Module::SEARCH_ID,
DiscourseAi::Configuration::Module::SEARCH,
),
@@ -41,7 +41,7 @@ module DiscourseAi
feature_cache[:discord] ||= [
new(
"search",
- "ai_discord_search_persona",
+ "ai_discord_search_agent",
DiscourseAi::Configuration::Module::DISCORD_ID,
DiscourseAi::Configuration::Module::DISCORD,
),
@@ -52,19 +52,19 @@ module DiscourseAi
feature_cache[:inference] ||= [
new(
"generate_concepts",
- "inferred_concepts_generate_persona",
+ "inferred_concepts_generate_agent",
DiscourseAi::Configuration::Module::INFERENCE_ID,
DiscourseAi::Configuration::Module::INFERENCE,
),
new(
"match_concepts",
- "inferred_concepts_match_persona",
+ "inferred_concepts_match_agent",
DiscourseAi::Configuration::Module::INFERENCE_ID,
DiscourseAi::Configuration::Module::INFERENCE,
),
new(
"deduplicate_concepts",
- "inferred_concepts_deduplicate_persona",
+ "inferred_concepts_deduplicate_agent",
DiscourseAi::Configuration::Module::INFERENCE_ID,
DiscourseAi::Configuration::Module::INFERENCE,
),
@@ -75,61 +75,61 @@ module DiscourseAi
feature_cache[:ai_helper] ||= [
new(
"proofread",
- "ai_helper_proofreader_persona",
+ "ai_helper_proofreader_agent",
DiscourseAi::Configuration::Module::AI_HELPER_ID,
DiscourseAi::Configuration::Module::AI_HELPER,
),
new(
"title_suggestions",
- "ai_helper_title_suggestions_persona",
+ "ai_helper_title_suggestions_agent",
DiscourseAi::Configuration::Module::AI_HELPER_ID,
DiscourseAi::Configuration::Module::AI_HELPER,
),
new(
"explain",
- "ai_helper_explain_persona",
+ "ai_helper_explain_agent",
DiscourseAi::Configuration::Module::AI_HELPER_ID,
DiscourseAi::Configuration::Module::AI_HELPER,
),
new(
"smart_dates",
- "ai_helper_smart_dates_persona",
+ "ai_helper_smart_dates_agent",
DiscourseAi::Configuration::Module::AI_HELPER_ID,
DiscourseAi::Configuration::Module::AI_HELPER,
),
new(
"markdown_tables",
- "ai_helper_markdown_tables_persona",
+ "ai_helper_markdown_tables_agent",
DiscourseAi::Configuration::Module::AI_HELPER_ID,
DiscourseAi::Configuration::Module::AI_HELPER,
),
new(
"translator",
- "ai_helper_translator_persona",
+ "ai_helper_translator_agent",
DiscourseAi::Configuration::Module::AI_HELPER_ID,
DiscourseAi::Configuration::Module::AI_HELPER,
),
new(
"custom_prompt",
- "ai_helper_custom_prompt_persona",
+ "ai_helper_custom_prompt_agent",
DiscourseAi::Configuration::Module::AI_HELPER_ID,
DiscourseAi::Configuration::Module::AI_HELPER,
),
new(
"image_caption",
- "ai_helper_image_caption_persona",
+ "ai_helper_image_caption_agent",
DiscourseAi::Configuration::Module::AI_HELPER_ID,
DiscourseAi::Configuration::Module::AI_HELPER,
),
new(
"post_illustrator",
- "ai_helper_post_illustrator_persona",
+ "ai_helper_post_illustrator_agent",
DiscourseAi::Configuration::Module::AI_HELPER_ID,
DiscourseAi::Configuration::Module::AI_HELPER,
),
new(
"chat_thread_titles",
- "ai_helper_chat_thread_title_persona",
+ "ai_helper_chat_thread_title_agent",
DiscourseAi::Configuration::Module::AI_HELPER_ID,
DiscourseAi::Configuration::Module::AI_HELPER,
enabled_by_setting: "ai_helper_automatic_chat_thread_title",
@@ -144,7 +144,7 @@ module DiscourseAi
nil,
DiscourseAi::Configuration::Module::BOT_ID,
DiscourseAi::Configuration::Module::BOT,
- persona_ids_lookup: -> { lookup_bot_persona_ids },
+ agent_ids_lookup: -> { lookup_bot_agent_ids },
llm_models_lookup: -> { lookup_bot_llms },
),
]
@@ -157,7 +157,7 @@ module DiscourseAi
nil,
DiscourseAi::Configuration::Module::SPAM_ID,
DiscourseAi::Configuration::Module::SPAM,
- persona_ids_lookup: -> { [AiModerationSetting.spam&.ai_persona_id].compact },
+ agent_ids_lookup: -> { [AiModerationSetting.spam&.ai_agent_id].compact },
llm_models_lookup: -> { [AiModerationSetting.spam&.llm_model].compact },
),
]
@@ -167,15 +167,15 @@ module DiscourseAi
feature_cache[:embeddings] ||= [
new(
"hyde",
- "ai_embeddings_semantic_search_hyde_persona",
+ "ai_embeddings_semantic_search_hyde_agent",
DiscourseAi::Configuration::Module::EMBEDDINGS_ID,
DiscourseAi::Configuration::Module::EMBEDDINGS,
),
]
end
- def lookup_bot_persona_ids
- AiPersona
+ def lookup_bot_agent_ids
+ AiAgent
.where(enabled: true)
.where(
"allow_chat_channel_mentions OR allow_chat_direct_messages OR allow_topic_mentions OR allow_personal_messages",
@@ -184,35 +184,35 @@ module DiscourseAi
end
def lookup_bot_llms
- persona_llms = AiPersona.where(id: lookup_bot_persona_ids).pluck(:default_llm_id)
+ agent_llms = AiAgent.where(id: lookup_bot_agent_ids).pluck(:default_llm_id)
enabled_chat_bot_llm_ids = LlmModel.enabled_chat_bot_ids
- LlmModel.where(id: (persona_llms + enabled_chat_bot_llm_ids).uniq).to_a
+ LlmModel.where(id: (agent_llms + enabled_chat_bot_llm_ids).uniq).to_a
end
def translation_features
feature_cache[:translation] ||= [
new(
"locale_detector",
- "ai_translation_locale_detector_persona",
+ "ai_translation_locale_detector_agent",
DiscourseAi::Configuration::Module::TRANSLATION_ID,
DiscourseAi::Configuration::Module::TRANSLATION,
),
new(
"post_raw_translator",
- "ai_translation_post_raw_translator_persona",
+ "ai_translation_post_raw_translator_agent",
DiscourseAi::Configuration::Module::TRANSLATION_ID,
DiscourseAi::Configuration::Module::TRANSLATION,
),
new(
"topic_title_translator",
- "ai_translation_topic_title_translator_persona",
+ "ai_translation_topic_title_translator_agent",
DiscourseAi::Configuration::Module::TRANSLATION_ID,
DiscourseAi::Configuration::Module::TRANSLATION,
),
new(
"short_text_translator",
- "ai_translation_short_text_translator_persona",
+ "ai_translation_short_text_translator_agent",
DiscourseAi::Configuration::Module::TRANSLATION_ID,
DiscourseAi::Configuration::Module::TRANSLATION,
),
@@ -227,7 +227,7 @@ module DiscourseAi
SELECT (fields.metadata->>'value') AS value, automations.name AS automation_name, fields.name AS name
FROM discourse_automation_fields fields
INNER JOIN discourse_automation_automations automations ON automations.id = fields.automation_id
- WHERE fields.name IN ('model', 'persona_id')
+ WHERE fields.name IN ('model', 'agent_id')
AND automations.script = 'llm_report'
AND automations.enabled
LIMIT 20
@@ -250,7 +250,7 @@ module DiscourseAi
nil,
DiscourseAi::Configuration::Module::AUTOMATION_REPORTS_ID,
DiscourseAi::Configuration::Module::AUTOMATION_REPORTS,
- persona_ids_lookup: -> { [fields.dig("persona_id")].compact.map(&:to_i) },
+ agent_ids_lookup: -> { [fields.dig("agent_id")].compact.map(&:to_i) },
llm_models_lookup: -> { [LlmModel.find_by(id: fields["model"])].compact },
)
end
@@ -265,8 +265,8 @@ module DiscourseAi
SELECT (fields.metadata->>'value') AS value, automations.name AS automation_name, fields.name AS name
FROM discourse_automation_fields fields
INNER JOIN discourse_automation_automations automations ON automations.id = fields.automation_id
- WHERE fields.name IN ('model', 'triage_persona', 'persona')
- AND automations.script IN ('llm_triage', 'llm_persona_triage')
+ WHERE fields.name IN ('model', 'triage_agent', 'agent')
+ AND automations.script IN ('llm_triage', 'llm_agent_triage')
AND automations.enabled
LIMIT 20
SQL
@@ -278,7 +278,7 @@ module DiscourseAi
if field.name == "model"
memo[field.automation_name][field.name] = field.value
else
- memo[field.automation_name]["persona_id"] = field.value
+ memo[field.automation_name]["agent_id"] = field.value
end
memo
@@ -291,7 +291,7 @@ module DiscourseAi
if field["model"].present?
-> { [LlmModel.find_by(id: field["model"])].compact }
else
- nil # llm_persona_triage uses the persona default_llm_id.
+ nil # llm_agent_triage uses the agent default_llm_id.
end
new(
@@ -299,7 +299,7 @@ module DiscourseAi
nil,
DiscourseAi::Configuration::Module::AUTOMATION_TRIAGE_ID,
DiscourseAi::Configuration::Module::AUTOMATION_TRIAGE,
- persona_ids_lookup: -> { [field.dig("persona_id")].compact.map(&:to_i) },
+ agent_ids_lookup: -> { [field.dig("agent_id")].compact.map(&:to_i) },
llm_models_lookup: llm_models_lookup,
)
end
@@ -322,54 +322,54 @@ module DiscourseAi
].flatten
end
- def find_features_using(persona_id:)
- all.select { |feature| feature.persona_ids.include?(persona_id) }
+ def find_features_using(agent_id:)
+ all.select { |feature| feature.agent_ids.include?(agent_id) }
end
end
def initialize(
name,
- persona_setting,
+ agent_setting,
module_id,
module_name,
enabled_by_setting: "",
- persona_ids_lookup: nil,
+ agent_ids_lookup: nil,
llm_models_lookup: nil
)
@name = name
- @persona_setting = persona_setting
+ @agent_setting = agent_setting
@module_id = module_id
@module_name = module_name
@enabled_by_setting = enabled_by_setting
- @persona_ids_lookup = persona_ids_lookup
+ @agent_ids_lookup = agent_ids_lookup
@llm_models_lookup = llm_models_lookup
end
def llm_models
return @llm_models_lookup.call if @llm_models_lookup
- return if !persona_ids
+ return if !agent_ids
llm_models = []
- personas = AiPersona.where(id: persona_ids)
- personas.each do |persona|
- next if persona.blank?
+ agents = AiAgent.where(id: agent_ids)
+ agents.each do |agent|
+ next if agent.blank?
- persona_klass = persona.class_instance
+ agent_klass = agent.class_instance
llm_model =
case module_name
when DiscourseAi::Configuration::Module::SUMMARIZATION
- DiscourseAi::Summarization.find_summarization_model(persona_klass)
+ DiscourseAi::Summarization.find_summarization_model(agent_klass)
when DiscourseAi::Configuration::Module::AI_HELPER
- DiscourseAi::AiHelper::Assistant.find_ai_helper_model(name, persona_klass)
+ DiscourseAi::AiHelper::Assistant.find_ai_helper_model(name, agent_klass)
when DiscourseAi::Configuration::Module::TRANSLATION
- DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
when DiscourseAi::Configuration::Module::EMBEDDINGS
- DiscourseAi::Embeddings::SemanticSearch.new(nil).find_ai_hyde_model(persona_klass)
+ DiscourseAi::Embeddings::SemanticSearch.new(nil).find_ai_hyde_model(agent_klass)
end
if llm_model.blank?
- llm_model_id = persona.default_llm_id || SiteSetting.ai_default_llm_model
+ llm_model_id = agent.default_llm_id || SiteSetting.ai_default_llm_model
llm_model = LlmModel.find_by(id: llm_model_id)
end
@@ -379,17 +379,17 @@ module DiscourseAi
llm_models.compact.uniq
end
- attr_reader :name, :persona_setting, :module_id, :module_name
+ attr_reader :name, :agent_setting, :module_id, :module_name
def enabled?
@enabled_by_setting.blank? || SiteSetting.get(@enabled_by_setting)
end
- def persona_ids
- if @persona_ids_lookup
- @persona_ids_lookup.call
+ def agent_ids
+ if @agent_ids_lookup
+ @agent_ids_lookup.call
else
- id = SiteSetting.get(persona_setting).to_i
+ id = SiteSetting.get(agent_setting).to_i
if id != 0
[id]
else
diff --git a/plugins/discourse-ai/lib/configuration/llm_enumerator.rb b/plugins/discourse-ai/lib/configuration/llm_enumerator.rb
index 1d20294ea95..f238edc7dee 100644
--- a/plugins/discourse-ai/lib/configuration/llm_enumerator.rb
+++ b/plugins/discourse-ai/lib/configuration/llm_enumerator.rb
@@ -13,58 +13,57 @@ module DiscourseAi
end
# this is unconditional, so it is clear that we always signal configuration
- AiPersona
+ AiAgent
.where.not(default_llm_id: nil)
.pluck(:default_llm_id, :name, :id)
- .each { |llm_id, name, id| rval[llm_id] << { type: :ai_persona, name: name, id: id } }
+ .each { |llm_id, name, id| rval[llm_id] << { type: :ai_agent, name: name, id: id } }
if SiteSetting.ai_helper_enabled
{
"#{I18n.t("js.discourse_ai.features.ai_helper.proofread")}" =>
- SiteSetting.ai_helper_proofreader_persona,
+ SiteSetting.ai_helper_proofreader_agent,
"#{I18n.t("js.discourse_ai.features.ai_helper.title_suggestions")}" =>
- SiteSetting.ai_helper_title_suggestions_persona,
+ SiteSetting.ai_helper_title_suggestions_agent,
"#{I18n.t("js.discourse_ai.features.ai_helper.explain")}" =>
- SiteSetting.ai_helper_explain_persona,
+ SiteSetting.ai_helper_explain_agent,
"#{I18n.t("js.discourse_ai.features.ai_helper.illustrate_post")}" =>
- SiteSetting.ai_helper_post_illustrator_persona,
+ SiteSetting.ai_helper_post_illustrator_agent,
"#{I18n.t("js.discourse_ai.features.ai_helper.smart_dates")}" =>
- SiteSetting.ai_helper_smart_dates_persona,
+ SiteSetting.ai_helper_smart_dates_agent,
"#{I18n.t("js.discourse_ai.features.ai_helper.translator")}" =>
- SiteSetting.ai_helper_translator_persona,
+ SiteSetting.ai_helper_translator_agent,
"#{I18n.t("js.discourse_ai.features.ai_helper.markdown_tables")}" =>
- SiteSetting.ai_helper_markdown_tables_persona,
+ SiteSetting.ai_helper_markdown_tables_agent,
"#{I18n.t("js.discourse_ai.features.ai_helper.custom_prompt")}" =>
- SiteSetting.ai_helper_custom_prompt_persona,
- }.each do |helper_type, persona_id|
- next if persona_id.blank?
+ SiteSetting.ai_helper_custom_prompt_agent,
+ }.each do |helper_type, agent_id|
+ next if agent_id.blank?
- persona = AiPersona.find_by(id: persona_id)
- next if persona.blank? || persona.default_llm_id.blank?
+ agent = AiAgent.find_by(id: agent_id)
+ next if agent.blank? || agent.default_llm_id.blank?
- model_id = persona.default_llm_id || SiteSetting.ai_default_llm_model.to_i
+ model_id = agent.default_llm_id || SiteSetting.ai_default_llm_model.to_i
rval[model_id] << { type: :ai_helper, name: helper_type }
end
end
if SiteSetting.ai_helper_enabled_features.split("|").include?("image_caption")
- image_caption_persona = AiPersona.find_by(id: SiteSetting.ai_helper_image_caption_persona)
- model_id = image_caption_persona.default_llm_id || SiteSetting.ai_default_llm_model.to_i
+ image_caption_agent = AiAgent.find_by(id: SiteSetting.ai_helper_image_caption_agent)
+ model_id = image_caption_agent.default_llm_id || SiteSetting.ai_default_llm_model.to_i
rval[model_id] << { type: :ai_helper_image_caption }
end
if SiteSetting.ai_summarization_enabled
- summarization_persona = AiPersona.find_by(id: SiteSetting.ai_summarization_persona)
- model_id = summarization_persona.default_llm_id || SiteSetting.ai_default_llm_model.to_i
+ summarization_agent = AiAgent.find_by(id: SiteSetting.ai_summarization_agent)
+ model_id = summarization_agent.default_llm_id || SiteSetting.ai_default_llm_model.to_i
rval[model_id] << { type: :ai_summarization }
end
if SiteSetting.ai_embeddings_semantic_search_enabled
- search_persona =
- AiPersona.find_by(id: SiteSetting.ai_embeddings_semantic_search_hyde_persona)
- model_id = search_persona.default_llm_id || SiteSetting.ai_default_llm_model.to_i
+ search_agent = AiAgent.find_by(id: SiteSetting.ai_embeddings_semantic_search_hyde_agent)
+ model_id = search_agent.default_llm_id || SiteSetting.ai_default_llm_model.to_i
rval[model_id] << { type: :ai_embeddings_semantic_search }
end
diff --git a/plugins/discourse-ai/lib/configuration/llm_validator.rb b/plugins/discourse-ai/lib/configuration/llm_validator.rb
index 34db3a94b0b..800cabc2adc 100644
--- a/plugins/discourse-ai/lib/configuration/llm_validator.rb
+++ b/plugins/discourse-ai/lib/configuration/llm_validator.rb
@@ -44,7 +44,7 @@ module DiscourseAi
end
def is_using(llm_model)
- in_use_by = AiPersona.where(default_llm_id: llm_model.id).pluck(:name)
+ in_use_by = AiAgent.where(default_llm_id: llm_model.id).pluck(:name)
in_use_by << "ai_default_llm_model" if SiteSetting.ai_default_llm_model.to_i == llm_model.id
diff --git a/plugins/discourse-ai/lib/configuration/module.rb b/plugins/discourse-ai/lib/configuration/module.rb
index a2e2f705ed5..03862c86698 100644
--- a/plugins/discourse-ai/lib/configuration/module.rb
+++ b/plugins/discourse-ai/lib/configuration/module.rb
@@ -114,7 +114,7 @@ module DiscourseAi
AUTOMATION_TRIAGE,
enabled_by_setting: "discourse_automation_enabled",
features: DiscourseAi::Configuration::Feature.ai_automation_triage_scripts,
- extra_check: -> { has_scripts?(%w[llm_triage llm_persona_triage]) },
+ extra_check: -> { has_scripts?(%w[llm_triage llm_agent_triage]) },
)
end
diff --git a/plugins/discourse-ai/lib/discord/bot/persona_replier.rb b/plugins/discourse-ai/lib/discord/bot/agent_replier.rb
similarity index 74%
rename from plugins/discourse-ai/lib/discord/bot/persona_replier.rb
rename to plugins/discourse-ai/lib/discord/bot/agent_replier.rb
index ab1f92f2e2a..c5199c7cdd5 100644
--- a/plugins/discourse-ai/lib/discord/bot/persona_replier.rb
+++ b/plugins/discourse-ai/lib/discord/bot/agent_replier.rb
@@ -2,18 +2,18 @@
module DiscourseAi
module Discord::Bot
- class PersonaReplier < Base
+ class AgentReplier < Base
def initialize(body)
- @persona =
- AiPersona
- .all_personas(enabled_only: false)
- .find { |p| p.id == SiteSetting.ai_discord_search_persona.to_i }
+ @agent =
+ AiAgent
+ .all_agents(enabled_only: false)
+ .find { |p| p.id == SiteSetting.ai_discord_search_agent.to_i }
.new
@bot =
- DiscourseAi::Personas::Bot.as(
+ DiscourseAi::Agents::Bot.as(
Discourse.system_user,
- persona: @persona,
- model: LlmModel.find(@persona.class.default_llm_id || SiteSetting.ai_default_llm_model),
+ agent: @agent,
+ model: LlmModel.find(@agent.class.default_llm_id || SiteSetting.ai_default_llm_model),
)
super(body)
end
@@ -23,7 +23,7 @@ module DiscourseAi
reply = +""
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
messages: [{ type: :user, content: @query }],
skip_show_thinking: true,
)
diff --git a/plugins/discourse-ai/lib/discord/bot/search.rb b/plugins/discourse-ai/lib/discord/bot/search.rb
index e33e35e7320..e214f0026a0 100644
--- a/plugins/discourse-ai/lib/discord/bot/search.rb
+++ b/plugins/discourse-ai/lib/discord/bot/search.rb
@@ -4,7 +4,7 @@ module DiscourseAi
module Discord::Bot
class Search < Base
def initialize(body)
- @search = DiscourseAi::Personas::Tools::Search
+ @search = DiscourseAi::Agents::Tools::Search
super(body)
end
@@ -12,7 +12,7 @@ module DiscourseAi
results =
@search.new(
{ search_query: @query },
- persona_options: {
+ agent_options: {
"max_results" => 10,
},
bot_user: nil,
diff --git a/plugins/discourse-ai/lib/discover/entry_point.rb b/plugins/discourse-ai/lib/discover/entry_point.rb
index c804d84cd23..e54b21e99e3 100644
--- a/plugins/discourse-ai/lib/discover/entry_point.rb
+++ b/plugins/discourse-ai/lib/discover/entry_point.rb
@@ -6,16 +6,30 @@ module DiscourseAi
def inject_into(plugin)
plugin.add_to_serializer(
:current_user,
- :can_use_ai_discover_persona,
+ :can_use_ai_discover_agent,
include_condition: -> do
SiteSetting.ai_discover_enabled && scope.authenticated? &&
- SiteSetting.ai_discover_persona.present?
+ SiteSetting.ai_discover_agent.present?
end,
) do
- persona_allowed_groups =
- AiPersona.find_by(id: SiteSetting.ai_discover_persona)&.allowed_group_ids.to_a
+ agent_allowed_groups =
+ AiAgent.find_by(id: SiteSetting.ai_discover_agent)&.allowed_group_ids.to_a
- scope.user.in_any_groups?(persona_allowed_groups)
+ scope.user.in_any_groups?(agent_allowed_groups)
+ end
+
+ plugin.add_to_serializer(
+ :current_user,
+ :can_use_ai_discover_agent,
+ include_condition: -> do
+ SiteSetting.ai_discover_enabled && scope.authenticated? &&
+ SiteSetting.ai_discover_agent.present?
+ end,
+ ) do
+ agent_allowed_groups =
+ AiAgent.find_by(id: SiteSetting.ai_discover_agent)&.allowed_group_ids.to_a
+
+ scope.user.in_any_groups?(agent_allowed_groups)
end
UserUpdater::OPTION_ATTR.push(:ai_search_discoveries)
@@ -23,7 +37,7 @@ module DiscourseAi
:user_option,
:ai_search_discoveries,
include_condition: -> do
- SiteSetting.ai_discover_enabled && SiteSetting.ai_discover_persona.present? &&
+ SiteSetting.ai_discover_enabled && SiteSetting.ai_discover_agent.present? &&
scope.authenticated?
end,
) { object.ai_search_discoveries }
@@ -32,7 +46,7 @@ module DiscourseAi
:current_user_option,
:ai_search_discoveries,
include_condition: -> do
- SiteSetting.ai_discover_enabled && SiteSetting.ai_discover_persona.present? &&
+ SiteSetting.ai_discover_enabled && SiteSetting.ai_discover_agent.present? &&
scope.authenticated?
end,
) { object.ai_search_discoveries }
diff --git a/plugins/discourse-ai/lib/embeddings/semantic_search.rb b/plugins/discourse-ai/lib/embeddings/semantic_search.rb
index c93ae1a4066..56f2e5908a8 100644
--- a/plugins/discourse-ai/lib/embeddings/semantic_search.rb
+++ b/plugins/discourse-ai/lib/embeddings/semantic_search.rb
@@ -128,7 +128,7 @@ module DiscourseAi
def hypothetical_post_from(search_term)
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: @guardian.user,
skip_show_thinking: true,
feature_name: "semantic_search_hyde",
@@ -140,7 +140,7 @@ module DiscourseAi
structured_output = nil
raw_response = +""
- hyde_schema_key = bot.persona.response_format&.first.to_h
+ hyde_schema_key = bot.agent.response_format&.first.to_h
buffer_blk =
Proc.new do |partial, _, type|
@@ -158,21 +158,19 @@ module DiscourseAi
end
# Priorities are:
- # 1. Persona's default LLM
+ # 1. Agent's default LLM
# 2. SiteSetting.ai_default_llm_model (or newest LLM if not set)
- def find_ai_hyde_model(persona_klass)
- model_id = persona_klass.default_llm_id || SiteSetting.ai_default_llm_model
+ def find_ai_hyde_model(agent_klass)
+ model_id = agent_klass.default_llm_id || SiteSetting.ai_default_llm_model
model_id.present? ? LlmModel.find_by(id: model_id) : LlmModel.last
end
def self.find_ai_hyde_model_id
- persona_llm_id =
- AiPersona.find_by(
- id: SiteSetting.ai_embeddings_semantic_search_hyde_persona,
- )&.default_llm_id
+ agent_llm_id =
+ AiAgent.find_by(id: SiteSetting.ai_embeddings_semantic_search_hyde_agent)&.default_llm_id
- persona_llm_id.presence || SiteSetting.ai_default_llm_model.to_i || LlmModel.last&.id
+ agent_llm_id.presence || SiteSetting.ai_default_llm_model.to_i || LlmModel.last&.id
end
private
@@ -188,15 +186,15 @@ module DiscourseAi
end
def build_bot(user)
- persona_id = SiteSetting.ai_embeddings_semantic_search_hyde_persona
+ agent_id = SiteSetting.ai_embeddings_semantic_search_hyde_agent
- persona_klass = AiPersona.find_by(id: persona_id)&.class_instance
- return if persona_klass.nil?
+ agent_klass = AiAgent.find_by(id: agent_id)&.class_instance
+ return if agent_klass.nil?
- llm_model = find_ai_hyde_model(persona_klass)
+ llm_model = find_ai_hyde_model(agent_klass)
return if llm_model.nil?
- DiscourseAi::Personas::Bot.as(user, persona: persona_klass.new, model: llm_model)
+ DiscourseAi::Agents::Bot.as(user, agent: agent_klass.new, model: llm_model)
end
end
end
diff --git a/plugins/discourse-ai/lib/guardian_extensions.rb b/plugins/discourse-ai/lib/guardian_extensions.rb
index 7544cbc92f8..8dbdca15ff7 100644
--- a/plugins/discourse-ai/lib/guardian_extensions.rb
+++ b/plugins/discourse-ai/lib/guardian_extensions.rb
@@ -25,27 +25,27 @@ module DiscourseAi
return false if !SiteSetting.ai_summarization_enabled
return false if !SiteSetting.ai_summary_gists_enabled
- if (ai_persona = AiPersona.find_by_id_from_cache(SiteSetting.ai_summary_gists_persona)).blank?
+ if (ai_agent = AiAgent.find_by_id_from_cache(SiteSetting.ai_summary_gists_agent)).blank?
return false
end
- persona_groups = ai_persona.allowed_group_ids.to_a
- return true if persona_groups.include?(Group::AUTO_GROUPS[:everyone])
+ agent_groups = ai_agent.allowed_group_ids.to_a
+ return true if agent_groups.include?(Group::AUTO_GROUPS[:everyone])
return false if anonymous?
- persona_groups.any? { |group_id| user.group_ids.include?(group_id) }
+ agent_groups.any? { |group_id| user.group_ids.include?(group_id) }
end
def can_request_gists?
return false if !SiteSetting.ai_summarization_enabled
return false if !SiteSetting.ai_summary_gists_enabled
- return false if !AiPersona.exists?(id: SiteSetting.ai_summary_gists_persona)
+ return false if !AiAgent.exists?(id: SiteSetting.ai_summary_gists_agent)
is_staff?
end
def can_regenerate_summary?
return false if !SiteSetting.ai_summarization_enabled
- return false if !AiPersona.exists?(id: SiteSetting.ai_summarization_persona)
+ return false if !AiAgent.exists?(id: SiteSetting.ai_summarization_agent)
is_staff?
end
@@ -54,11 +54,11 @@ module DiscourseAi
return false if anonymous?
user_group_ids = user.group_ids
- if (ai_persona = AiPersona.find_by_id_from_cache(SiteSetting.ai_summarization_persona)).blank?
+ if (ai_agent = AiAgent.find_by_id_from_cache(SiteSetting.ai_summarization_agent)).blank?
return false
end
- ai_persona.allowed_group_ids.to_a.any? { |group_id| user.group_ids.include?(group_id) }
+ ai_agent.allowed_group_ids.to_a.any? { |group_id| user.group_ids.include?(group_id) }
end
def can_debug_ai_bot_conversation?(target)
diff --git a/plugins/discourse-ai/lib/inferred_concepts/applier.rb b/plugins/discourse-ai/lib/inferred_concepts/applier.rb
index e422e8cd35f..9c7270ca533 100644
--- a/plugins/discourse-ai/lib/inferred_concepts/applier.rb
+++ b/plugins/discourse-ai/lib/inferred_concepts/applier.rb
@@ -60,7 +60,7 @@ module DiscourseAi
existing_concepts = DiscourseAi::InferredConcepts::Manager.new.list_concepts
return [] if existing_concepts.empty?
- # Use the ConceptMatcher persona to match concepts
+ # Use the ConceptMatcher agent to match concepts
matched_concept_names = match_concepts_to_content(content, existing_concepts)
# Find concepts in the database
@@ -83,7 +83,7 @@ module DiscourseAi
existing_concepts = DiscourseAi::InferredConcepts::Manager.new.list_concepts
return [] if existing_concepts.empty?
- # Use the ConceptMatcher persona to match concepts
+ # Use the ConceptMatcher agent to match concepts
matched_concept_names = match_concepts_to_content(content, existing_concepts)
# Find concepts in the database
@@ -95,33 +95,33 @@ module DiscourseAi
matched_concepts
end
- # Use ConceptMatcher persona to match content against provided concepts
+ # Use ConceptMatcher agent to match content against provided concepts
def match_concepts_to_content(content, concept_list)
return [] if content.blank? || concept_list.blank?
# Prepare user message with only the content
user_message = content
- # Use the ConceptMatcher persona to match concepts
+ # Use the ConceptMatcher agent to match concepts
- persona =
- AiPersona
- .all_personas(enabled_only: false)
- .find { |p| p.id == SiteSetting.inferred_concepts_match_persona.to_i }
+ agent =
+ AiAgent
+ .all_agents(enabled_only: false)
+ .find { |p| p.id == SiteSetting.inferred_concepts_match_agent.to_i }
.new
- llm = LlmModel.find(persona.class.default_llm_id || SiteSetting.ai_default_llm_model)
+ llm = LlmModel.find(agent.class.default_llm_id || SiteSetting.ai_default_llm_model)
input = { type: :user, content: content }
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
messages: [input],
user: Discourse.system_user,
inferred_concepts: concept_list,
)
- bot = DiscourseAi::Personas::Bot.as(Discourse.system_user, persona: persona, model: llm)
+ bot = DiscourseAi::Agents::Bot.as(Discourse.system_user, agent: agent, model: llm)
structured_output = nil
bot.reply(context) do |partial, _, type|
diff --git a/plugins/discourse-ai/lib/inferred_concepts/finder.rb b/plugins/discourse-ai/lib/inferred_concepts/finder.rb
index 0f5db803677..fb5f412756f 100644
--- a/plugins/discourse-ai/lib/inferred_concepts/finder.rb
+++ b/plugins/discourse-ai/lib/inferred_concepts/finder.rb
@@ -8,22 +8,22 @@ module DiscourseAi
def identify_concepts(content)
return [] if content.blank?
- # Use the ConceptFinder persona to identify concepts
- persona =
- AiPersona
- .all_personas(enabled_only: false)
- .find { |p| p.id == SiteSetting.inferred_concepts_generate_persona.to_i }
+ # Use the ConceptFinder agent to identify concepts
+ agent =
+ AiAgent
+ .all_agents(enabled_only: false)
+ .find { |p| p.id == SiteSetting.inferred_concepts_generate_agent.to_i }
.new
- llm = LlmModel.find(persona.class.default_llm_id || SiteSetting.ai_default_llm_model)
+ llm = LlmModel.find(agent.class.default_llm_id || SiteSetting.ai_default_llm_model)
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
messages: [{ type: :user, content: content }],
user: Discourse.system_user,
inferred_concepts: DiscourseAi::InferredConcepts::Manager.new.list_concepts,
)
- bot = DiscourseAi::Personas::Bot.as(Discourse.system_user, persona: persona, model: llm)
+ bot = DiscourseAi::Agents::Bot.as(Discourse.system_user, agent: agent, model: llm)
structured_output = nil
bot.reply(context) do |partial, _, type|
@@ -147,22 +147,22 @@ module DiscourseAi
def deduplicate_concepts(concept_names)
return { deduplicated_concepts: [], mapping: {} } if concept_names.blank?
- # Use the ConceptDeduplicator persona to deduplicate concepts
- persona =
- AiPersona
- .all_personas(enabled_only: false)
- .find { |p| p.id == SiteSetting.inferred_concepts_deduplicate_persona.to_i }
+ # Use the ConceptDeduplicator agent to deduplicate concepts
+ agent =
+ AiAgent
+ .all_agents(enabled_only: false)
+ .find { |p| p.id == SiteSetting.inferred_concepts_deduplicate_agent.to_i }
.new
- llm = LlmModel.find(persona.class.default_llm_id || SiteSetting.ai_default_llm_model)
+ llm = LlmModel.find(agent.class.default_llm_id || SiteSetting.ai_default_llm_model)
# Create the input for the deduplicator
input = { type: :user, content: concept_names.join(", ") }
context =
- DiscourseAi::Personas::BotContext.new(messages: [input], user: Discourse.system_user)
+ DiscourseAi::Agents::BotContext.new(messages: [input], user: Discourse.system_user)
- bot = DiscourseAi::Personas::Bot.as(Discourse.system_user, persona: persona, model: llm)
+ bot = DiscourseAi::Agents::Bot.as(Discourse.system_user, agent: agent, model: llm)
structured_output = nil
bot.reply(context) do |partial, _, type|
diff --git a/plugins/discourse-ai/lib/summarization.rb b/plugins/discourse-ai/lib/summarization.rb
index 174d32261b2..9cb27e6906b 100644
--- a/plugins/discourse-ai/lib/summarization.rb
+++ b/plugins/discourse-ai/lib/summarization.rb
@@ -5,64 +5,58 @@ module DiscourseAi
class << self
def topic_summary(topic, llm_model: nil)
return nil if !SiteSetting.ai_summarization_enabled
- if (
- ai_persona = AiPersona.find_by_id_from_cache(SiteSetting.ai_summarization_persona)
- ).blank?
+ if (ai_agent = AiAgent.find_by_id_from_cache(SiteSetting.ai_summarization_agent)).blank?
return nil
end
- persona_klass = ai_persona.class_instance
- llm_model ||= find_summarization_model(persona_klass)
+ agent_klass = ai_agent.class_instance
+ llm_model ||= find_summarization_model(agent_klass)
return nil if llm_model.blank?
DiscourseAi::Summarization::FoldContent.new(
- build_bot(persona_klass, llm_model),
+ build_bot(agent_klass, llm_model),
DiscourseAi::Summarization::Strategies::TopicSummary.new(topic),
)
end
def topic_gist(topic, llm_model: nil)
return nil if !SiteSetting.ai_summarization_enabled
- if (
- ai_persona = AiPersona.find_by_id_from_cache(SiteSetting.ai_summary_gists_persona)
- ).blank?
+ if (ai_agent = AiAgent.find_by_id_from_cache(SiteSetting.ai_summary_gists_agent)).blank?
return nil
end
- persona_klass = ai_persona.class_instance
- llm_model ||= find_summarization_model(persona_klass)
+ agent_klass = ai_agent.class_instance
+ llm_model ||= find_summarization_model(agent_klass)
return nil if llm_model.blank?
DiscourseAi::Summarization::FoldContent.new(
- build_bot(persona_klass, llm_model),
+ build_bot(agent_klass, llm_model),
DiscourseAi::Summarization::Strategies::HotTopicGists.new(topic),
)
end
def chat_channel_summary(channel, time_window_in_hours, llm_model: nil)
return nil if !SiteSetting.ai_summarization_enabled
- if (
- ai_persona = AiPersona.find_by_id_from_cache(SiteSetting.ai_summarization_persona)
- ).blank?
+ if (ai_agent = AiAgent.find_by_id_from_cache(SiteSetting.ai_summarization_agent)).blank?
return nil
end
- persona_klass = ai_persona.class_instance
- llm_model ||= find_summarization_model(persona_klass)
+ agent_klass = ai_agent.class_instance
+ llm_model ||= find_summarization_model(agent_klass)
return nil if llm_model.blank?
DiscourseAi::Summarization::FoldContent.new(
- build_bot(persona_klass, llm_model),
+ build_bot(agent_klass, llm_model),
DiscourseAi::Summarization::Strategies::ChatMessages.new(channel, time_window_in_hours),
persist_summaries: false,
)
end
# Priorities are:
- # 1. Persona's default LLM
+ # 1. Agent's default LLM
# 2. SiteSetting.ai_default_llm_model (or newest LLM if not set)
- def find_summarization_model(persona_klass)
- model_id = persona_klass.default_llm_id || SiteSetting.ai_default_llm_model
+ def find_summarization_model(agent_klass)
+ model_id = agent_klass.default_llm_id || SiteSetting.ai_default_llm_model
if model_id.present?
LlmModel.find_by(id: model_id)
@@ -73,11 +67,11 @@ module DiscourseAi
### Private
- def build_bot(persona_klass, llm_model)
- persona = persona_klass.new
- user = User.find_by(id: persona_klass.user_id) || Discourse.system_user
+ def build_bot(agent_klass, llm_model)
+ agent = agent_klass.new
+ user = User.find_by(id: agent_klass.user_id) || Discourse.system_user
- DiscourseAi::Personas::Bot.as(user, persona: persona, model: llm_model)
+ DiscourseAi::Agents::Bot.as(user, agent: agent, model: llm_model)
end
end
end
diff --git a/plugins/discourse-ai/lib/summarization/entry_point.rb b/plugins/discourse-ai/lib/summarization/entry_point.rb
index 69a05a16ec5..96e70b415a9 100644
--- a/plugins/discourse-ai/lib/summarization/entry_point.rb
+++ b/plugins/discourse-ai/lib/summarization/entry_point.rb
@@ -9,12 +9,10 @@ module DiscourseAi
plugin.add_to_serializer(:current_user, :can_summarize) do
return false if !SiteSetting.ai_summarization_enabled
- if (
- ai_persona = AiPersona.find_by_id_from_cache(SiteSetting.ai_summarization_persona)
- ).blank?
+ if (ai_agent = AiAgent.find_by_id_from_cache(SiteSetting.ai_summarization_agent)).blank?
return false
end
- scope.user.in_any_groups?(ai_persona.allowed_group_ids.to_a)
+ scope.user.in_any_groups?(ai_agent.allowed_group_ids.to_a)
end
plugin.add_to_serializer(:topic_view, :summarizable) do
diff --git a/plugins/discourse-ai/lib/summarization/fold_content.rb b/plugins/discourse-ai/lib/summarization/fold_content.rb
index 9feff7b60fc..a246e37f1c7 100644
--- a/plugins/discourse-ai/lib/summarization/fold_content.rb
+++ b/plugins/discourse-ai/lib/summarization/fold_content.rb
@@ -142,7 +142,7 @@ module DiscourseAi
end
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: user,
skip_show_thinking: true,
feature_name: strategy.feature,
@@ -155,7 +155,7 @@ module DiscourseAi
buffer_blk =
Proc.new do |partial, _, type|
if type == :structured_output
- json_summary_schema_key = bot.persona.response_format&.first.to_h
+ json_summary_schema_key = bot.agent.response_format&.first.to_h
partial_summary =
partial.read_buffered_property(json_summary_schema_key["key"]&.to_sym)
diff --git a/plugins/discourse-ai/lib/translation.rb b/plugins/discourse-ai/lib/translation.rb
index 650d023397d..6d6d1fba544 100644
--- a/plugins/discourse-ai/lib/translation.rb
+++ b/plugins/discourse-ai/lib/translation.rb
@@ -12,21 +12,21 @@ module DiscourseAi
end
def self.has_llm_model?
- persona_ids = [
- SiteSetting.ai_translation_locale_detector_persona,
- SiteSetting.ai_translation_post_raw_translator_persona,
- SiteSetting.ai_translation_topic_title_translator_persona,
- SiteSetting.ai_translation_short_text_translator_persona,
+ agent_ids = [
+ SiteSetting.ai_translation_locale_detector_agent,
+ SiteSetting.ai_translation_post_raw_translator_agent,
+ SiteSetting.ai_translation_topic_title_translator_agent,
+ SiteSetting.ai_translation_short_text_translator_agent,
]
- persona_default_llms =
- AiPersona
- .all_personas(enabled_only: false)
- .select { |p| persona_ids.include?(p.id) }
+ agent_default_llms =
+ AiAgent
+ .all_agents(enabled_only: false)
+ .select { |p| agent_ids.include?(p.id) }
.map(&:default_llm_id)
default_llm_model = SiteSetting.ai_default_llm_model
- if persona_default_llms.any?(&:blank?) && default_llm_model.blank?
+ if agent_default_llms.any?(&:blank?) && default_llm_model.blank?
false
else
true
@@ -38,20 +38,20 @@ module DiscourseAi
SiteSetting.ai_translation_backfill_max_age_days > 0
end
- def self.llm_model_for_persona(persona_id)
- return nil if persona_id.blank?
+ def self.llm_model_for_agent(agent_id)
+ return nil if agent_id.blank?
- ai_persona = AiPersona.find_by_id_from_cache(persona_id)
- return nil if ai_persona.blank?
+ ai_agent = AiAgent.find_by_id_from_cache(agent_id)
+ return nil if ai_agent.blank?
- persona_klass = ai_persona.class_instance
- BaseTranslator.preferred_llm_model(persona_klass)
+ agent_klass = ai_agent.class_instance
+ BaseTranslator.preferred_llm_model(agent_klass)
end
- def self.credits_available_for_persona_ids?(persona_ids)
- return true if persona_ids.blank?
+ def self.credits_available_for_agent_ids?(agent_ids)
+ return true if agent_ids.blank?
- models = persona_ids.map { |persona_id| llm_model_for_persona(persona_id) }.compact.uniq
+ models = agent_ids.map { |agent_id| llm_model_for_agent(agent_id) }.compact.uniq
return true if models.empty?
@@ -59,48 +59,48 @@ module DiscourseAi
end
def self.credits_available_for_post_detection?
- credits_available_for_persona_ids?(
+ credits_available_for_agent_ids?(
[
- SiteSetting.ai_translation_locale_detector_persona,
- SiteSetting.ai_translation_post_raw_translator_persona,
+ SiteSetting.ai_translation_locale_detector_agent,
+ SiteSetting.ai_translation_post_raw_translator_agent,
],
)
end
def self.credits_available_for_topic_detection?
- credits_available_for_persona_ids?(
+ credits_available_for_agent_ids?(
[
- SiteSetting.ai_translation_locale_detector_persona,
- SiteSetting.ai_translation_topic_title_translator_persona,
- SiteSetting.ai_translation_post_raw_translator_persona,
+ SiteSetting.ai_translation_locale_detector_agent,
+ SiteSetting.ai_translation_topic_title_translator_agent,
+ SiteSetting.ai_translation_post_raw_translator_agent,
],
)
end
def self.credits_available_for_post_localization?
- credits_available_for_persona_ids?([SiteSetting.ai_translation_post_raw_translator_persona])
+ credits_available_for_agent_ids?([SiteSetting.ai_translation_post_raw_translator_agent])
end
def self.credits_available_for_topic_localization?
- credits_available_for_persona_ids?(
+ credits_available_for_agent_ids?(
[
- SiteSetting.ai_translation_topic_title_translator_persona,
- SiteSetting.ai_translation_post_raw_translator_persona,
+ SiteSetting.ai_translation_topic_title_translator_agent,
+ SiteSetting.ai_translation_post_raw_translator_agent,
],
)
end
def self.credits_available_for_category_localization?
- credits_available_for_persona_ids?(
+ credits_available_for_agent_ids?(
[
- SiteSetting.ai_translation_short_text_translator_persona,
- SiteSetting.ai_translation_post_raw_translator_persona,
+ SiteSetting.ai_translation_short_text_translator_agent,
+ SiteSetting.ai_translation_post_raw_translator_agent,
],
)
end
def self.credits_available_for_tag_localization?
- credits_available_for_persona_ids?([SiteSetting.ai_translation_short_text_translator_persona])
+ credits_available_for_agent_ids?([SiteSetting.ai_translation_short_text_translator_agent])
end
end
end
diff --git a/plugins/discourse-ai/lib/translation/base_translator.rb b/plugins/discourse-ai/lib/translation/base_translator.rb
index eb708c86f54..7ca71f4cf89 100644
--- a/plugins/discourse-ai/lib/translation/base_translator.rb
+++ b/plugins/discourse-ai/lib/translation/base_translator.rb
@@ -14,17 +14,17 @@ module DiscourseAi
def translate
return nil if @text.blank?
return nil if !SiteSetting.ai_translation_enabled
- if (ai_persona = AiPersona.find_by_id_from_cache(persona_setting)).blank?
+ if (ai_agent = AiAgent.find_by_id_from_cache(agent_setting)).blank?
return nil
end
- translation_user = ai_persona.user || Discourse.system_user
- persona_klass = ai_persona.class_instance
- persona = persona_klass.new
+ translation_user = ai_agent.user || Discourse.system_user
+ agent_klass = ai_agent.class_instance
+ agent = agent_klass.new
- model = @llm_model || self.class.preferred_llm_model(persona_klass)
+ model = @llm_model || self.class.preferred_llm_model(agent_klass)
return nil if model.blank?
- bot = DiscourseAi::Personas::Bot.as(translation_user, persona:, model:)
+ bot = DiscourseAi::Agents::Bot.as(translation_user, agent:, model:)
ContentSplitter
.split(content: @text, chunk_size: model.max_output_tokens)
@@ -40,7 +40,7 @@ module DiscourseAi
def get_translation(text:, bot:, translation_user:)
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
user: translation_user,
skip_show_thinking: true,
feature_name: "translation",
@@ -74,12 +74,12 @@ module DiscourseAi
multiplier > 0 ? multiplier : 1.0
end
- def persona_setting
+ def agent_setting
raise NotImplementedError
end
- def self.preferred_llm_model(persona_klass)
- model_id = persona_klass.default_llm_id || SiteSetting.ai_default_llm_model
+ def self.preferred_llm_model(agent_klass)
+ model_id = agent_klass.default_llm_id || SiteSetting.ai_default_llm_model
if model_id.present?
LlmModel.find_by(id: model_id)
diff --git a/plugins/discourse-ai/lib/translation/language_detector.rb b/plugins/discourse-ai/lib/translation/language_detector.rb
index 8a675ee0ec7..517f42581e7 100644
--- a/plugins/discourse-ai/lib/translation/language_detector.rb
+++ b/plugins/discourse-ai/lib/translation/language_detector.rb
@@ -18,28 +18,28 @@ module DiscourseAi
return nil if !SiteSetting.ai_translation_enabled
return nil if @text.blank?
if (
- ai_persona =
- AiPersona.find_by_id_from_cache(SiteSetting.ai_translation_locale_detector_persona)
+ ai_agent =
+ AiAgent.find_by_id_from_cache(SiteSetting.ai_translation_locale_detector_agent)
).blank?
return nil
end
- persona_klass = ai_persona.class_instance
- persona = persona_klass.new
+ agent_klass = ai_agent.class_instance
+ agent = agent_klass.new
- llm_model = DiscourseAi::Translation::BaseTranslator.preferred_llm_model(persona_klass)
+ llm_model = DiscourseAi::Translation::BaseTranslator.preferred_llm_model(agent_klass)
return nil if llm_model.blank?
bot =
- DiscourseAi::Personas::Bot.as(
- ai_persona.user || Discourse.system_user,
- persona: persona,
+ DiscourseAi::Agents::Bot.as(
+ ai_agent.user || Discourse.system_user,
+ agent: agent,
model: llm_model,
)
context =
- DiscourseAi::Personas::BotContext.new(
- user: ai_persona.user || Discourse.system_user,
+ DiscourseAi::Agents::BotContext.new(
+ user: ai_agent.user || Discourse.system_user,
skip_show_thinking: true,
feature_name: "translation",
messages: [{ type: :user, content: @text }],
diff --git a/plugins/discourse-ai/lib/translation/post_raw_translator.rb b/plugins/discourse-ai/lib/translation/post_raw_translator.rb
index 9c742b8e5f6..e34301f2edc 100644
--- a/plugins/discourse-ai/lib/translation/post_raw_translator.rb
+++ b/plugins/discourse-ai/lib/translation/post_raw_translator.rb
@@ -5,8 +5,8 @@ module DiscourseAi
class PostRawTranslator < BaseTranslator
private
- def persona_setting
- SiteSetting.ai_translation_post_raw_translator_persona
+ def agent_setting
+ SiteSetting.ai_translation_post_raw_translator_agent
end
end
end
diff --git a/plugins/discourse-ai/lib/translation/short_text_translator.rb b/plugins/discourse-ai/lib/translation/short_text_translator.rb
index 99a71c1c97f..2ac962d0603 100644
--- a/plugins/discourse-ai/lib/translation/short_text_translator.rb
+++ b/plugins/discourse-ai/lib/translation/short_text_translator.rb
@@ -5,8 +5,8 @@ module DiscourseAi
class ShortTextTranslator < BaseTranslator
private
- def persona_setting
- SiteSetting.ai_translation_short_text_translator_persona
+ def agent_setting
+ SiteSetting.ai_translation_short_text_translator_agent
end
end
end
diff --git a/plugins/discourse-ai/lib/translation/topic_title_translator.rb b/plugins/discourse-ai/lib/translation/topic_title_translator.rb
index c611f066b21..be148de2442 100644
--- a/plugins/discourse-ai/lib/translation/topic_title_translator.rb
+++ b/plugins/discourse-ai/lib/translation/topic_title_translator.rb
@@ -5,8 +5,8 @@ module DiscourseAi
class TopicTitleTranslator < BaseTranslator
private
- def persona_setting
- SiteSetting.ai_translation_topic_title_translator_persona
+ def agent_setting
+ SiteSetting.ai_translation_topic_title_translator_agent
end
end
end
diff --git a/plugins/discourse-ai/lib/utils/ai_staff_action_logger.rb b/plugins/discourse-ai/lib/utils/ai_staff_action_logger.rb
index f6ff42131ee..92de7e08183 100644
--- a/plugins/discourse-ai/lib/utils/ai_staff_action_logger.rb
+++ b/plugins/discourse-ai/lib/utils/ai_staff_action_logger.rb
@@ -11,7 +11,7 @@ module DiscourseAi
@staff_logger = ::StaffActionLogger.new(current_user)
end
- ## Logs the creation of an AI entity (LLM model or persona)
+ ## Logs the creation of an AI entity (LLM model or agent)
## @param entity_type [Symbol] The type of AI entity being created
## @param entity [Object] The entity object being created
## @param field_config [Hash] Configuration for how to handle different entity fields
diff --git a/plugins/discourse-ai/plugin.rb b/plugins/discourse-ai/plugin.rb
index 4df32a2b83a..b6afe4f5314 100644
--- a/plugins/discourse-ai/plugin.rb
+++ b/plugins/discourse-ai/plugin.rb
@@ -33,9 +33,9 @@ register_asset "stylesheets/modules/summarization/desktop/ai-summary.scss", :des
register_asset "stylesheets/modules/summarization/common/ai-gists.scss"
register_asset "stylesheets/modules/ai-bot/common/bot-replies.scss"
-register_asset "stylesheets/modules/ai-bot/common/ai-persona.scss"
+register_asset "stylesheets/modules/ai-bot/common/ai-agent.scss"
register_asset "stylesheets/modules/ai-bot/common/ai-discobot-discoveries.scss"
-register_asset "stylesheets/modules/ai-bot/mobile/ai-persona.scss", :mobile
+register_asset "stylesheets/modules/ai-bot/mobile/ai-agent.scss", :mobile
register_asset "stylesheets/modules/ai-bot-conversations/common.scss"
@@ -83,12 +83,12 @@ after_initialize do
require_relative "discourse_automation/llm_triage"
require_relative "discourse_automation/llm_report"
require_relative "discourse_automation/ai_tool_action"
- require_relative "discourse_automation/llm_persona_triage"
+ require_relative "discourse_automation/llm_agent_triage"
require_relative "discourse_automation/llm_tagger"
add_admin_route("discourse_ai.title", "discourse-ai", { use_new_show_route: true })
- register_seedfu_fixtures(Rails.root.join("plugins", "discourse-ai", "db", "fixtures", "personas"))
+ register_seedfu_fixtures(Rails.root.join("plugins", "discourse-ai", "db", "fixtures", "agents"))
[
DiscourseAi::Embeddings::EntryPoint.new,
@@ -135,7 +135,7 @@ after_initialize do
add_api_key_scope(
:discourse_ai,
- { update_personas: { actions: %w[discourse_ai/admin/ai_personas#update] } },
+ { update_agents: { actions: %w[discourse_ai/admin/ai_agents#update] } },
)
add_api_key_scope(
diff --git a/plugins/discourse-ai/public/ai-share/share.css b/plugins/discourse-ai/public/ai-share/share.css
index e36d0460789..5255106d0b8 100644
--- a/plugins/discourse-ai/public/ai-share/share.css
+++ b/plugins/discourse-ai/public/ai-share/share.css
@@ -295,11 +295,11 @@ h1 h2 h3 h4 h5 h6 {
color: var(--primary);
}
-.post__date, .post__persona {
+.post__date, .post__agent {
font-size: 0.8em;
}
-.post__persona {
+.post__agent {
color: var(--primary-600);
}
diff --git a/plugins/discourse-ai/spec/configuration/feature_spec.rb b/plugins/discourse-ai/spec/configuration/feature_spec.rb
index e1a7facde46..3cb25796a8a 100644
--- a/plugins/discourse-ai/spec/configuration/feature_spec.rb
+++ b/plugins/discourse-ai/spec/configuration/feature_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe DiscourseAi::Configuration::Feature do
fab!(:llm_model)
- fab!(:ai_persona) { Fabricate(:ai_persona, default_llm_id: llm_model.id) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, default_llm_id: llm_model.id) }
before { assign_fake_provider_to(:ai_default_llm_model) }
@@ -13,17 +13,17 @@ RSpec.describe DiscourseAi::Configuration::Feature do
before { enable_current_plugin }
describe "#llm_model" do
- context "when persona is not found" do
- it "returns nil when persona_id is invalid" do
+ context "when agent is not found" do
+ it "returns nil when agent_id is invalid" do
ai_feature =
described_class.new(
"topic_summaries",
- "ai_summarization_persona",
+ "ai_summarization_agent",
DiscourseAi::Configuration::Module::SUMMARIZATION_ID,
DiscourseAi::Configuration::Module::SUMMARIZATION,
)
- SiteSetting.ai_summarization_persona = 999_999
+ SiteSetting.ai_summarization_agent = 999_999
expect(ai_feature.llm_models).to eq([])
end
end
@@ -32,14 +32,14 @@ RSpec.describe DiscourseAi::Configuration::Feature do
let(:ai_feature) do
described_class.new(
"topic_summaries",
- "ai_summarization_persona",
+ "ai_summarization_agent",
DiscourseAi::Configuration::Module::SUMMARIZATION_ID,
DiscourseAi::Configuration::Module::SUMMARIZATION,
)
end
it "returns the configured llm model" do
- SiteSetting.ai_summarization_persona = ai_persona.id
+ SiteSetting.ai_summarization_agent = ai_agent.id
expect(ai_feature.llm_models).to eq([llm_model])
end
end
@@ -48,14 +48,14 @@ RSpec.describe DiscourseAi::Configuration::Feature do
let(:ai_feature) do
described_class.new(
"proofread",
- "ai_helper_proofreader_persona",
+ "ai_helper_proofreader_agent",
DiscourseAi::Configuration::Module::AI_HELPER_ID,
DiscourseAi::Configuration::Module::AI_HELPER,
)
end
- it "returns the persona's default llm when no specific helper model is set" do
- SiteSetting.ai_helper_proofreader_persona = ai_persona.id
+ it "returns the agent's default llm when no specific helper model is set" do
+ SiteSetting.ai_helper_proofreader_agent = ai_agent.id
expect(ai_feature.llm_models).to eq([llm_model])
end
end
@@ -66,15 +66,15 @@ RSpec.describe DiscourseAi::Configuration::Feature do
let(:ai_feature) do
described_class.new(
"locale_detector",
- "ai_translation_locale_detector_persona",
+ "ai_translation_locale_detector_agent",
DiscourseAi::Configuration::Module::TRANSLATION_ID,
DiscourseAi::Configuration::Module::TRANSLATION,
)
end
it "uses translation model when configured" do
- SiteSetting.ai_translation_locale_detector_persona = ai_persona.id
- ai_persona.update!(default_llm_id: translation_model.id)
+ SiteSetting.ai_translation_locale_detector_agent = ai_agent.id
+ ai_agent.update!(default_llm_id: translation_model.id)
expect(ai_feature.llm_models).to eq([translation_model])
end
end
@@ -85,7 +85,7 @@ RSpec.describe DiscourseAi::Configuration::Feature do
ai_feature =
described_class.new(
"topic_summaries",
- "ai_summarization_persona",
+ "ai_summarization_agent",
DiscourseAi::Configuration::Module::SUMMARIZATION_ID,
DiscourseAi::Configuration::Module::SUMMARIZATION,
)
@@ -97,7 +97,7 @@ RSpec.describe DiscourseAi::Configuration::Feature do
ai_feature =
described_class.new(
"gists",
- "ai_summary_gists_persona",
+ "ai_summary_gists_agent",
DiscourseAi::Configuration::Module::SUMMARIZATION_ID,
DiscourseAi::Configuration::Module::SUMMARIZATION,
enabled_by_setting: "ai_summary_gists_enabled",
@@ -117,36 +117,36 @@ RSpec.describe DiscourseAi::Configuration::Feature do
before { SiteSetting.ai_bot_enabled_llms = bot_llm.id.to_s }
- fab!(:chat_persona) do
+ fab!(:chat_agent) do
Fabricate(
- :ai_persona,
+ :ai_agent,
default_llm_id: bot_llm.id,
allow_chat_channel_mentions: true,
allow_chat_direct_messages: false,
)
end
- fab!(:dm_persona) do
+ fab!(:dm_agent) do
Fabricate(
- :ai_persona,
+ :ai_agent,
default_llm_id: bot_llm.id,
allow_chat_channel_mentions: false,
allow_chat_direct_messages: true,
)
end
- fab!(:topic_persona) do
+ fab!(:topic_agent) do
Fabricate(
- :ai_persona,
+ :ai_agent,
default_llm_id: bot_llm.id,
allow_topic_mentions: true,
allow_personal_messages: false,
)
end
- fab!(:pm_persona) do
- Fabricate(:ai_persona, allow_topic_mentions: false, allow_personal_messages: true)
+ fab!(:pm_agent) do
+ Fabricate(:ai_agent, allow_topic_mentions: false, allow_personal_messages: true)
end
- fab!(:inactive_persona) do
+ fab!(:inactive_agent) do
Fabricate(
- :ai_persona,
+ :ai_agent,
enabled: false,
allow_chat_channel_mentions: false,
allow_chat_direct_messages: false,
@@ -159,31 +159,31 @@ RSpec.describe DiscourseAi::Configuration::Feature do
it "returns bot features with correct configuration" do
expect(bot_feature.name).to eq("bot")
- expect(bot_feature.persona_setting).to be_nil
+ expect(bot_feature.agent_setting).to be_nil
expect(bot_feature.module_id).to eq(DiscourseAi::Configuration::Module::BOT_ID)
expect(bot_feature.module_name).to eq(DiscourseAi::Configuration::Module::BOT)
end
it "returns only LLMs enabled in ai_bot_enabled_llms setting" do
- # Disable all other personas to ensure only test personas are active
- expected_persona_ids = [chat_persona.id, dm_persona.id, topic_persona.id, pm_persona.id]
- AiPersona.where.not(id: expected_persona_ids).update_all(enabled: false)
+ # Disable all other agents to ensure only test agents are active
+ expected_agent_ids = [chat_agent.id, dm_agent.id, topic_agent.id, pm_agent.id]
+ AiAgent.where.not(id: expected_agent_ids).update_all(enabled: false)
expect(bot_feature.llm_models).to contain_exactly(bot_llm)
expect(bot_feature.llm_models).not_to include(non_bot_llm)
end
- it "returns only personas with at least one bot permission enabled" do
- expected_ids = [chat_persona.id, dm_persona.id, topic_persona.id, pm_persona.id]
- AiPersona.where.not(id: expected_ids).update_all(enabled: false)
- expect(bot_feature.persona_ids).to match_array(expected_ids)
- expect(bot_feature.persona_ids).not_to include(inactive_persona.id)
+ it "returns only agents with at least one bot permission enabled" do
+ expected_ids = [chat_agent.id, dm_agent.id, topic_agent.id, pm_agent.id]
+ AiAgent.where.not(id: expected_ids).update_all(enabled: false)
+ expect(bot_feature.agent_ids).to match_array(expected_ids)
+ expect(bot_feature.agent_ids).not_to include(inactive_agent.id)
end
- it "includes personas with multiple permissions enabled" do
- multi_permission_persona =
+ it "includes agents with multiple permissions enabled" do
+ multi_permission_agent =
Fabricate(
- :ai_persona,
+ :ai_agent,
enabled: true,
default_llm_id: bot_llm.id,
allow_chat_channel_mentions: true,
@@ -192,32 +192,32 @@ RSpec.describe DiscourseAi::Configuration::Feature do
allow_personal_messages: true,
)
- expect(bot_feature.persona_ids).to include(multi_permission_persona.id)
+ expect(bot_feature.agent_ids).to include(multi_permission_agent.id)
end
end
- describe "#persona_ids" do
- it "returns the persona id from site settings" do
+ describe "#agent_ids" do
+ it "returns the agent id from site settings" do
ai_feature =
described_class.new(
"topic_summaries",
- "ai_summarization_persona",
+ "ai_summarization_agent",
DiscourseAi::Configuration::Module::SUMMARIZATION_ID,
DiscourseAi::Configuration::Module::SUMMARIZATION,
)
- SiteSetting.ai_summarization_persona = ai_persona.id
- expect(ai_feature.persona_ids).to eq([ai_persona.id])
+ SiteSetting.ai_summarization_agent = ai_agent.id
+ expect(ai_feature.agent_ids).to eq([ai_agent.id])
end
end
describe ".find_features_using" do
- it "returns all features using a specific persona" do
- SiteSetting.ai_summarization_persona = ai_persona.id
- SiteSetting.ai_helper_proofreader_persona = ai_persona.id
- SiteSetting.ai_translation_locale_detector_persona = 999
+ it "returns all features using a specific agent" do
+ SiteSetting.ai_summarization_agent = ai_agent.id
+ SiteSetting.ai_helper_proofreader_agent = ai_agent.id
+ SiteSetting.ai_translation_locale_detector_agent = 999
- features = described_class.find_features_using(persona_id: ai_persona.id)
+ features = described_class.find_features_using(agent_id: ai_agent.id)
expect(features.map(&:name)).to include("topic_summaries", "proofread")
expect(features.map(&:name)).not_to include("locale_detector")
diff --git a/plugins/discourse-ai/spec/configuration/llm_enumerator_spec.rb b/plugins/discourse-ai/spec/configuration/llm_enumerator_spec.rb
index 82689d85c10..0657153e5d2 100644
--- a/plugins/discourse-ai/spec/configuration/llm_enumerator_spec.rb
+++ b/plugins/discourse-ai/spec/configuration/llm_enumerator_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe DiscourseAi::Configuration::LlmEnumerator do
fab!(:fake_model)
- fab!(:ai_persona) { Fabricate(:ai_persona, default_llm_id: fake_model.id) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, default_llm_id: fake_model.id) }
fab!(:llm_model)
fab!(:seeded_model)
fab!(:automation) do
@@ -33,12 +33,12 @@ RSpec.describe DiscourseAi::Configuration::LlmEnumerator do
describe "#global_usage" do
it "returns a hash of Llm models in use globally" do
assign_fake_provider_to(:ai_default_llm_model)
- SiteSetting.ai_helper_proofreader_persona = ai_persona.id
+ SiteSetting.ai_helper_proofreader_agent = ai_agent.id
SiteSetting.ai_helper_enabled = true
expect(described_class.global_usage).to eq(
fake_model.id => [{ type: :ai_helper }],
fake_model.id => [
- { id: ai_persona.id, name: ai_persona.name, type: :ai_persona },
+ { id: ai_agent.id, name: ai_agent.name, type: :ai_agent },
{ name: "Proofread text", type: :ai_helper },
],
)
@@ -57,7 +57,7 @@ RSpec.describe DiscourseAi::Configuration::LlmEnumerator do
usage = described_class.global_usage
expect(usage).to eq(
- fake_model.id => [{ id: ai_persona.id, name: ai_persona.name, type: :ai_persona }],
+ fake_model.id => [{ id: ai_agent.id, name: ai_agent.name, type: :ai_agent }],
llm_model.id => [{ id: automation.id, name: automation.name, type: :automation }],
)
end
diff --git a/plugins/discourse-ai/spec/evals/persona_prompt_loader_spec.rb b/plugins/discourse-ai/spec/evals/agent_prompt_loader_spec.rb
similarity index 62%
rename from plugins/discourse-ai/spec/evals/persona_prompt_loader_spec.rb
rename to plugins/discourse-ai/spec/evals/agent_prompt_loader_spec.rb
index b9794976ec6..ec43f099426 100644
--- a/plugins/discourse-ai/spec/evals/persona_prompt_loader_spec.rb
+++ b/plugins/discourse-ai/spec/evals/agent_prompt_loader_spec.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative "../../evals/lib/persona_prompt_loader"
+require_relative "../../evals/lib/agent_prompt_loader"
-RSpec.describe DiscourseAi::Evals::PersonaPromptLoader do
+RSpec.describe DiscourseAi::Evals::AgentPromptLoader do
subject(:loader) { described_class.new }
let(:tmpdir) { Dir.mktmpdir }
@@ -10,7 +10,7 @@ RSpec.describe DiscourseAi::Evals::PersonaPromptLoader do
before do
File.write(yaml_path, <<~YAML)
- key: custom_eval_persona
+ key: custom_eval_agent
description: Custom prompt for evals
system_prompt: "Always summarize in one sentence."
YAML
@@ -20,12 +20,12 @@ RSpec.describe DiscourseAi::Evals::PersonaPromptLoader do
after { FileUtils.remove_entry(tmpdir) }
- it "lists persona keys" do
- expect(loader.list).to eq([["custom_eval_persona", "Custom prompt for evals"]])
+ it "lists agent keys" do
+ expect(loader.list).to eq([["custom_eval_agent", "Custom prompt for evals"]])
end
it "returns the system prompt for a key" do
- expect(loader.find_prompt("custom_eval_persona")).to eq("Always summarize in one sentence.")
+ expect(loader.find_prompt("custom_eval_agent")).to eq("Always summarize in one sentence.")
end
it "returns nil when the key is missing" do
diff --git a/plugins/discourse-ai/spec/evals/console_formatter_spec.rb b/plugins/discourse-ai/spec/evals/console_formatter_spec.rb
index e77970c1cda..f1a512db1ea 100644
--- a/plugins/discourse-ai/spec/evals/console_formatter_spec.rb
+++ b/plugins/discourse-ai/spec/evals/console_formatter_spec.rb
@@ -7,12 +7,7 @@ RSpec.describe DiscourseAi::Evals::ConsoleFormatter do
it "prints a progress bar and a table summarizing results" do
formatter =
- described_class.new(
- label: "eval-123",
- output: output,
- total_targets: 2,
- persona_key: "default",
- )
+ described_class.new(label: "eval-123", output: output, total_targets: 2, agent_key: "default")
formatter.announce_start
@@ -63,12 +58,7 @@ RSpec.describe DiscourseAi::Evals::ConsoleFormatter do
it "renders judged comparison outcomes in the table" do
formatter =
- described_class.new(
- label: "eval-123",
- output: output,
- total_targets: 2,
- persona_key: "default",
- )
+ described_class.new(label: "eval-123", output: output, total_targets: 2, agent_key: "default")
formatter.record_comparison_judged(
row_prefix: "eval-123",
@@ -102,12 +92,7 @@ RSpec.describe DiscourseAi::Evals::ConsoleFormatter do
it "marks ties with ratings and judge reason" do
formatter =
- described_class.new(
- label: "eval-999",
- output: output,
- total_targets: 2,
- persona_key: "default",
- )
+ described_class.new(label: "eval-999", output: output, total_targets: 2, agent_key: "default")
formatter.record_comparison_judged(
row_prefix: "eval-999",
diff --git a/plugins/discourse-ai/spec/evals/features_spec.rb b/plugins/discourse-ai/spec/evals/features_spec.rb
index 4fb7ed01b45..dbf8637e8ce 100644
--- a/plugins/discourse-ai/spec/evals/features_spec.rb
+++ b/plugins/discourse-ai/spec/evals/features_spec.rb
@@ -13,17 +13,13 @@ RSpec.describe DiscourseAi::Evals::Features do
1,
"module-1",
enabled_by_setting: "setting-1",
- features: [
- DiscourseAi::Configuration::Feature.new("feature-1", "persona-1", 1, "module-1"),
- ],
+ features: [DiscourseAi::Configuration::Feature.new("feature-1", "agent-1", 1, "module-1")],
),
DiscourseAi::Configuration::Module.new(
2,
"module-2",
enabled_by_setting: "setting-2",
- features: [
- DiscourseAi::Configuration::Feature.new("feature-2", "persona-2", 2, "module-2"),
- ],
+ features: [DiscourseAi::Configuration::Feature.new("feature-2", "agent-2", 2, "module-2")],
),
]
end
diff --git a/plugins/discourse-ai/spec/evals/recorder_spec.rb b/plugins/discourse-ai/spec/evals/recorder_spec.rb
index dd4bceff2fb..e6054a2ff7b 100644
--- a/plugins/discourse-ai/spec/evals/recorder_spec.rb
+++ b/plugins/discourse-ai/spec/evals/recorder_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe DiscourseAi::Evals::Recorder do
"/tmp/example.json",
structured_logger,
total_targets: 1,
- persona_key: persona_key,
+ agent_key: agent_key,
output: output,
)
end
@@ -21,7 +21,7 @@ RSpec.describe DiscourseAi::Evals::Recorder do
instance_double("DiscourseAi::Evals::Eval", id: "example-eval", to_json: { foo: "bar" })
end
let(:logger) { instance_double(Logger, info: nil, error: nil) }
- let(:persona_key) { "default" }
+ let(:agent_key) { "default" }
let(:formatter) do
instance_double(
DiscourseAi::Evals::ConsoleFormatter,
@@ -66,14 +66,14 @@ RSpec.describe DiscourseAi::Evals::Recorder do
recorder.running
expect(structured_logger).to have_received(:start_root).with(
- name: "Evaluating example-eval (persona: default)",
+ name: "Evaluating example-eval (agent: default)",
args: {
foo: "bar",
- persona_key: "default",
+ agent_key: "default",
},
)
expect(logger).to have_received(:info).with(
- "Starting evaluation 'example-eval' (persona: default)",
+ "Starting evaluation 'example-eval' (agent: default)",
)
end
end
diff --git a/plugins/discourse-ai/spec/evals/runners/ai_helper_spec.rb b/plugins/discourse-ai/spec/evals/runners/ai_helper_spec.rb
index 2916c3bb6cc..4a9d0f03f29 100644
--- a/plugins/discourse-ai/spec/evals/runners/ai_helper_spec.rb
+++ b/plugins/discourse-ai/spec/evals/runners/ai_helper_spec.rb
@@ -8,11 +8,11 @@ RSpec.describe DiscourseAi::Evals::Runners::AiHelper do
let(:llm) { Fabricate.build(:fake_model) }
let(:execution_context) { DiscourseAi::Completions::ExecutionContext.new }
let(:eval_case) { OpenStruct.new(args: { input: "We need new titles." }) }
- let(:titles_persona) { DiscourseAi::Personas::TitlesGenerator.new }
+ let(:titles_agent) { DiscourseAi::Agents::TitlesGenerator.new }
let(:runner) { described_class.new("title_suggestions") }
before do
- stub_runner_bot(persona: titles_persona) do |blk|
+ stub_runner_bot(agent: titles_agent) do |blk|
structured_output =
instance_double(
DiscourseAi::Completions::StructuredOutput,
diff --git a/plugins/discourse-ai/spec/evals/runners/inference_spec.rb b/plugins/discourse-ai/spec/evals/runners/inference_spec.rb
index fe3cb4ade78..5b5cd8d8ad8 100644
--- a/plugins/discourse-ai/spec/evals/runners/inference_spec.rb
+++ b/plugins/discourse-ai/spec/evals/runners/inference_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe DiscourseAi::Evals::Runners::Inference do
)
end
before do
- stub_runner_bot(persona: DiscourseAi::Personas::ConceptFinder.new) do |blk|
+ stub_runner_bot(agent: DiscourseAi::Agents::ConceptFinder.new) do |blk|
blk.call(structured_output, nil, :structured_output)
end
end
diff --git a/plugins/discourse-ai/spec/evals/support/runner_helper.rb b/plugins/discourse-ai/spec/evals/support/runner_helper.rb
index 1f796bf406f..7da0209265f 100644
--- a/plugins/discourse-ai/spec/evals/support/runner_helper.rb
+++ b/plugins/discourse-ai/spec/evals/support/runner_helper.rb
@@ -4,14 +4,14 @@ module DiscourseAi
module Evals
module RunnerSpecHelper
def stub_runner_bot(
- persona: instance_double(DiscourseAi::Personas::Persona, response_format: nil),
+ agent: instance_double(DiscourseAi::Agents::Agent, response_format: nil),
response: "ok",
&custom_block
)
- bot_double = instance_double(DiscourseAi::Personas::Bot, persona: persona)
+ bot_double = instance_double(DiscourseAi::Agents::Bot, agent: agent)
- allow(AiPersona).to receive(:find_by_id_from_cache).and_return(nil)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(bot_double)
+ allow(AiAgent).to receive(:find_by_id_from_cache).and_return(nil)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(bot_double)
if block_given?
allow(bot_double).to receive(:reply) { |*_, &blk| custom_block.call(blk) }
diff --git a/plugins/discourse-ai/spec/evals/workbench_compare_spec.rb b/plugins/discourse-ai/spec/evals/workbench_compare_spec.rb
index e0037597f8f..358ff8c111f 100644
--- a/plugins/discourse-ai/spec/evals/workbench_compare_spec.rb
+++ b/plugins/discourse-ai/spec/evals/workbench_compare_spec.rb
@@ -19,12 +19,12 @@ RSpec.describe DiscourseAi::Evals::Workbench do
end
let(:llm_one) { Fabricate(:fake_model, display_name: "LLM One") }
let(:llm_two) { Fabricate(:fake_model, display_name: "LLM Two") }
- let(:persona_variants) { [{ key: "default", prompt: nil }, { key: "custom", prompt: "prompt" }] }
+ let(:agent_variants) { [{ key: "default", prompt: nil }, { key: "custom", prompt: "prompt" }] }
let(:formatter) do
instance_double(DiscourseAi::Evals::ConsoleFormatter, announce_start: nil, finalize: nil)
end
- describe "#compare with judge in persona mode" do
+ describe "#compare with judge in agent mode" do
let(:judge_llm) { Fabricate(:fake_model) }
let(:workbench) { described_class.new(output: output, judge_llm: judge_llm, comparison: true) }
let(:recorder) do
@@ -62,14 +62,14 @@ RSpec.describe DiscourseAi::Evals::Workbench do
workbench.compare(
eval_cases: [eval_case],
llms: [llm_one],
- persona_variants: persona_variants,
+ agent_variants: agent_variants,
formatter: formatter,
)
expect(recorder).to have_received(:announce_comparison_judged).with(
eval_case_id: "topic-summary",
- mode_label: "personas",
- persona_key: "default",
+ mode_label: "agents",
+ agent_key: "default",
result:
a_hash_including(
winner: "custom",
@@ -127,14 +127,14 @@ RSpec.describe DiscourseAi::Evals::Workbench do
workbench.compare(
eval_cases: [eval_case],
llms: [llm_one, llm_two],
- persona_variants: [{ key: "default", prompt: nil }],
+ agent_variants: [{ key: "default", prompt: nil }],
formatter: formatter,
)
expect(recorder).to have_received(:announce_comparison_expected).with(
eval_case_id: "spam_eval",
mode_label: "LLMs",
- persona_key: "default",
+ agent_key: "default",
winner: "LLM One",
status_line: "LLM One 🟢 -- LLM Two 🔴",
failures: [{ label: "LLM Two", expected: "true", actual: "false" }],
@@ -146,7 +146,7 @@ RSpec.describe DiscourseAi::Evals::Workbench do
)
expect(recorder).to have_received(:announce_comparison_aggregate).with(
mode_label: "LLMs",
- persona_key: "default",
+ agent_key: "default",
aggregate_scores: {
"LLM One" => {
evals: 1,
diff --git a/plugins/discourse-ai/spec/evals/workbench_spec.rb b/plugins/discourse-ai/spec/evals/workbench_spec.rb
index 208f42cadd0..9b366bdf612 100644
--- a/plugins/discourse-ai/spec/evals/workbench_spec.rb
+++ b/plugins/discourse-ai/spec/evals/workbench_spec.rb
@@ -65,7 +65,7 @@ RSpec.describe DiscourseAi::Evals::Workbench do
eval_case,
output: output,
total_targets: 1,
- persona_key: :default,
+ agent_key: :default,
formatter: formatter,
announce_formatter: false,
finalize_formatter: false,
@@ -141,10 +141,10 @@ RSpec.describe DiscourseAi::Evals::Workbench do
before do
enable_current_plugin
- ensure_system_persona(DiscourseAi::Personas::Summarizer)
- ensure_system_persona(DiscourseAi::Personas::ShortSummarizer)
- ensure_system_persona(DiscourseAi::Personas::SpamDetector)
- AiPersona.persona_cache.flush!
+ ensure_system_agent(DiscourseAi::Agents::Summarizer)
+ ensure_system_agent(DiscourseAi::Agents::ShortSummarizer)
+ ensure_system_agent(DiscourseAi::Agents::SpamDetector)
+ AiAgent.agent_cache.flush!
end
it "generates topic summaries using the summarization eval feature" do
@@ -185,7 +185,7 @@ RSpec.describe DiscourseAi::Evals::Workbench do
)
captured_context = nil
- allow(DiscourseAi::Personas::Bot).to receive(
+ allow(DiscourseAi::Agents::Bot).to receive(
:as,
).and_wrap_original do |original, *args, **kwargs|
original
@@ -231,27 +231,27 @@ RSpec.describe DiscourseAi::Evals::Workbench do
end
end
- def ensure_system_persona(persona_class)
- persona_id = DiscourseAi::Personas::Persona.system_personas[persona_class]
- base = persona_class.new
-
- AiPersona
- .find_or_initialize_by(id: persona_id)
- .tap do |persona|
- persona.system = true
- persona.enabled = true
- persona.priority ||= false
- persona.name ||= persona_class.name
- persona.description ||= persona_class.description
- persona.system_prompt = base.system_prompt
- persona.allowed_group_ids = [Group::AUTO_GROUPS[:everyone]]
- persona.response_format = base.response_format
- persona.examples = base.examples
- persona.temperature = base.respond_to?(:temperature) ? base.temperature : nil
- persona.top_p = base.respond_to?(:top_p) ? base.top_p : nil
- persona.show_thinking = true
- persona.tools ||= []
- persona.save!(validate: false)
+ def ensure_system_agent(agent_class)
+ agent_id = DiscourseAi::Agents::Agent.system_agents[agent_class]
+ base = agent_class.new
+
+ AiAgent
+ .find_or_initialize_by(id: agent_id)
+ .tap do |agent|
+ agent.system = true
+ agent.enabled = true
+ agent.priority ||= false
+ agent.name ||= agent_class.name
+ agent.description ||= agent_class.description
+ agent.system_prompt = base.system_prompt
+ agent.allowed_group_ids = [Group::AUTO_GROUPS[:everyone]]
+ agent.response_format = base.response_format
+ agent.examples = base.examples
+ agent.temperature = base.respond_to?(:temperature) ? base.temperature : nil
+ agent.top_p = base.respond_to?(:top_p) ? base.top_p : nil
+ agent.show_thinking = true
+ agent.tools ||= []
+ agent.save!(validate: false)
end
end
diff --git a/plugins/discourse-ai/spec/fabricators/ai_persona_fabricator.rb b/plugins/discourse-ai/spec/fabricators/ai_agent_fabricator.rb
similarity index 61%
rename from plugins/discourse-ai/spec/fabricators/ai_persona_fabricator.rb
rename to plugins/discourse-ai/spec/fabricators/ai_agent_fabricator.rb
index f299fdfb63c..bfbfc06db57 100644
--- a/plugins/discourse-ai/spec/fabricators/ai_persona_fabricator.rb
+++ b/plugins/discourse-ai/spec/fabricators/ai_agent_fabricator.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-Fabricator(:ai_persona) do
- name { sequence(:name) { |i| "persona_#{i}" } }
+Fabricator(:ai_agent) do
+ name { sequence(:name) { |i| "agent_#{i}" } }
description "I am a test bot"
system_prompt "You are a test bot"
show_thinking false
diff --git a/plugins/discourse-ai/spec/fixtures/search_meta/site.json b/plugins/discourse-ai/spec/fixtures/search_meta/site.json
index 9651e0ce8c9..f7f3f6fb10e 100644
--- a/plugins/discourse-ai/spec/fixtures/search_meta/site.json
+++ b/plugins/discourse-ai/spec/fixtures/search_meta/site.json
@@ -1 +1 @@
-{"default_archetype":"regular","notification_types":{"mentioned":1,"replied":2,"quoted":3,"edited":4,"liked":5,"private_message":6,"invited_to_private_message":7,"invitee_accepted":8,"posted":9,"moved_post":10,"linked":11,"granted_badge":12,"invited_to_topic":13,"custom":14,"group_mentioned":15,"group_message_summary":16,"watching_first_post":17,"topic_reminder":18,"liked_consolidated":19,"post_approved":20,"code_review_commit_approved":21,"membership_request_accepted":22,"membership_request_consolidated":23,"bookmark_reminder":24,"reaction":25,"votes_released":26,"event_reminder":27,"event_invitation":28,"chat_mention":29,"chat_message":30,"chat_invitation":31,"chat_group_mention":32,"chat_quoted":33,"assigned":34,"question_answer_user_commented":35,"watching_category_or_tag":36,"new_features":37,"admin_problems":38,"following":800,"following_created_topic":801,"following_replied":802,"circles_activity":900},"post_types":{"regular":1,"moderator_action":2,"small_action":3,"whisper":4},"user_tips":{"first_notification":1,"topic_timeline":2,"post_menu":3,"topic_notification_levels":4,"suggested_topics":5,"admin_guide":6},"trust_levels":{"newuser":0,"basic":1,"member":2,"regular":3,"leader":4},"groups":[{"id":183,"name":"ai-personas","flair_url":null,"flair_bg_color":"","flair_color":""},{"id":160,"name":"community-moderators","flair_url":null,"flair_bg_color":"","flair_color":""},{"id":184,"name":"glimmer-search-menu","flair_url":null,"flair_bg_color":"","flair_color":""},{"id":157,"name":"new-new-testers","flair_url":null,"flair_bg_color":"","flair_color":""},{"id":48,"name":"plugin_authors","flair_url":"fa-plug","flair_bg_color":"dddddd","flair_color":"111111"},{"id":148,"name":"support-advocates","flair_url":"https://d11a6trkgmumsb.cloudfront.net/original/3X/e/4/e4038d4d9848de2eabab38e17b8bdb69da154024.svg","flair_bg_color":"FFFFFF","flair_color":""},{"id":151,"name":"support-enthusiasts","flair_url":"https://d11a6trkgmumsb.cloudfront.net/original/3X/1/3/13f5d8d7e56be8a6a1ea3de009b985a548aec8d4.svg","flair_bg_color":"FFFFFF","flair_color":""},{"id":142,"name":"support-experts","flair_url":"https://d11a6trkgmumsb.cloudfront.net/original/3X/e/2/e250ec403580530d19e6a9ed42d0d525a51a9dbe.svg","flair_bg_color":"FFFFFF","flair_color":""},{"id":118,"name":"support-explorers","flair_url":"https://d11a6trkgmumsb.cloudfront.net/original/4X/d/1/b/d1ba0acf09b9d01f87f9e05bbee1dc5b0e316d5f.png","flair_bg_color":"dddddd","flair_color":"111111"},{"id":47,"name":"team","flair_url":"https://d11a6trkgmumsb.cloudfront.net/original/3X/e/b/ebee30bd98aef20357e4a177a5a1e45b877ce088.svg","flair_bg_color":"","flair_color":"111"},{"id":73,"name":"theme_authors","flair_url":"fa-paint-brush","flair_bg_color":"ddd","flair_color":"111"},{"id":84,"name":"theme_creator","flair_url":"fa-palette","flair_bg_color":"ddd","flair_color":"111"},{"id":50,"name":"translators","flair_url":"fa-globe","flair_bg_color":"ddd","flair_color":"111"}],"filters":["latest","unread","new","unseen","top","read","posted","bookmarks","hot"],"periods":["all","yearly","quarterly","monthly","weekly","daily"],"top_menu_items":["latest","unread","new","unseen","top","read","posted","bookmarks","hot","categories"],"anonymous_top_menu_items":["latest","top","categories","hot","categories","top"],"uncategorized_category_id":17,"user_field_max_length":2048,"post_action_types":[{"id":2,"name_key":"like","name":"Like","description":"Like this post","short_description":"Like this post","is_flag":false,"is_custom_flag":false},{"id":3,"name_key":"off_topic","name":"Off-Topic","description":"This post is not relevant to the current discussion as defined by the title and first post, and should probably be moved elsewhere.","short_description":"Not relevant to the discussion","is_flag":true,"is_custom_flag":false},{"id":4,"name_key":"inappropriate","name":"Inappropriate","description":"This post contains content that a reasonable person would consider offensive, abusive, to be hateful conduct or a violation of \u003ca href=\"/guidelines\"\u003eour community guidelines\u003c/a\u003e.","short_description":"A violation of \u003ca href=\"/guidelines\"\u003eour community guidelines\u003c/a\u003e","is_flag":true,"is_custom_flag":false},{"id":8,"name_key":"spam","name":"Spam","description":"This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.","short_description":"This is an advertisement or vandalism","is_flag":true,"is_custom_flag":false},{"id":6,"name_key":"notify_user","name":"Send @%{username} a message","description":"I want to talk to this person directly and personally about their post.","short_description":"I want to talk to this person directly and personally about their post.","is_flag":true,"is_custom_flag":true},{"id":10,"name_key":"illegal","name":"Illegal","description":"This post requires staff attention because I believe it contains content that is illegal.","short_description":"This is illegal","is_flag":true,"is_custom_flag":true},{"id":null,"name_key":null,"name":"Translation missing: en.post_action_types..title","description":"Translation missing: en.post_action_types.description","short_description":"Translation missing: en.post_action_types.short_description","is_flag":false,"is_custom_flag":false},{"id":7,"name_key":"notify_moderators","name":"Something Else","description":"This post requires staff attention for another reason not listed above.","short_description":"Requires staff attention for another reason","is_flag":true,"is_custom_flag":true}],"topic_flag_types":[{"id":4,"name_key":"inappropriate","name":"Inappropriate","description":"This topic contains content that a reasonable person would consider offensive, abusive, to be hateful conduct or a violation of \u003ca href=\"/guidelines\"\u003eour community guidelines\u003c/a\u003e.","short_description":"A violation of \u003ca href=\"/guidelines\"\u003eour community guidelines\u003c/a\u003e","is_flag":true,"is_custom_flag":false},{"id":8,"name_key":"spam","name":"Spam","description":"This topic is an advertisement. It is not useful or relevant to this site, but promotional in nature.","short_description":"This is an advertisement","is_flag":true,"is_custom_flag":false},{"id":10,"name_key":"illegal","name":"Illegal","description":"This topic requires staff attention because I believe it contains content that is illegal.","short_description":"This is illegal","is_flag":true,"is_custom_flag":true},{"id":null,"name_key":null,"name":"Translation missing: en.topic_flag_types..title","description":"Translation missing: en.topic_flag_types.description","short_description":"Translation missing: en.topic_flag_types.short_description","is_flag":false,"is_custom_flag":false},{"id":7,"name_key":"notify_moderators","name":"Something Else","description":"This topic requires general staff attention based on the \u003ca href=\"/guidelines\"\u003eguidelines\u003c/a\u003e, \u003ca href=\"/tos\"\u003eTOS\u003c/a\u003e, or for another reason not listed above.","short_description":"Requires staff attention for another reason","is_flag":true,"is_custom_flag":true}],"can_create_tag":false,"can_tag_topics":false,"can_tag_pms":false,"tags_filter_regexp":"[/\\?#\\[\\]@!\\$\u0026'\\(\\)\\*\\+,;=\\.%\\\\`^\\s|\\{\\}\"\u003c\u003e]+","top_tags":["how-to","chat","rest-api","sql-query","unsupported-install","email","pr-welcome","completed","ai","activity-summary","official","solved","sidebar","release-notes","server-resources","calendar-and-event","badges","topic-voting","docker","tags","advertising","invites","search","sql-triggered-badge","subscriptions","new-feature","chat-integration","wordpress","groups","themes","css"],"navigation_menu_site_top_tags":[{"name":"how-to","description":"How to guides contain steps to follow to solve a specific problem","pm_only":false},{"name":"chat","description":null,"pm_only":false},{"name":"rest-api","description":"Topics about making an external request to Discourse","pm_only":false},{"name":"sql-query","description":"SQL queries for the data-explorer","pm_only":false},{"name":"unsupported-install","description":null,"pm_only":false}],"topic_featured_link_allowed_category_ids":[149,120,122,157,121,153,127,9,136,138,61,83,96,56,132,123,144,104,10,27,137,25,124,22,134,24,110,105,143,119,145,135,129,7,30,89,131,150,6,155,31,20,133,55,102,148,147,95,152,151,128,154,21,139,108,69,3,14,125,63,2,126,115,106,1,118,117,17,53,13,5,65,8,67,35],"user_themes":[{"theme_id":272,"name":"Accessible contrast (dark)","default":false,"color_scheme_id":85},{"theme_id":271,"name":"Accessible contrast (light)","default":false,"color_scheme_id":84},{"theme_id":242,"name":"Air Theme","default":false,"color_scheme_id":82},{"theme_id":337,"name":"Central","default":false,"color_scheme_id":100},{"theme_id":335,"name":"CentralStaffOnly","default":false,"color_scheme_id":96},{"theme_id":31,"name":"Dark","default":false,"color_scheme_id":86},{"theme_id":140,"name":"Default","default":false,"color_scheme_id":34},{"theme_id":281,"name":"Default (full-width)","default":false,"color_scheme_id":34},{"theme_id":51,"name":"Discourse-classic","default":false,"color_scheme_id":34},{"theme_id":296,"name":"Fully","default":false,"color_scheme_id":null},{"theme_id":131,"name":"Ghost","default":false,"color_scheme_id":66},{"theme_id":80,"name":"Graceful","default":false,"color_scheme_id":54},{"theme_id":83,"name":"Grey Amber","default":false,"color_scheme_id":57},{"theme_id":232,"name":"Hidden Whispers","default":false,"color_scheme_id":null},{"theme_id":34,"name":"Material Design","default":false,"color_scheme_id":37},{"theme_id":331,"name":"Meta Branded","default":true,"color_scheme_id":34},{"theme_id":125,"name":"Minima Dark","default":false,"color_scheme_id":43},{"theme_id":299,"name":"redditish","default":false,"color_scheme_id":null},{"theme_id":30,"name":"Sam's Simple Theme","default":false,"color_scheme_id":null}],"user_color_schemes":[{"id":93,"name":"Central Dark","is_dark":true},{"id":95,"name":"Central Dark","is_dark":true},{"id":100,"name":"Central Light","is_dark":false},{"id":96,"name":"Central Light","is_dark":false},{"id":86,"name":"Dark","is_dark":true},{"id":34,"name":"Default Light","is_dark":false},{"id":87,"name":"Solarized Light","is_dark":false},{"id":85,"name":"WCAG Dark","is_dark":true},{"id":84,"name":"WCAG Light","is_dark":false}],"default_dark_color_scheme":null,"censored_regexp":[{"(?:\\P{L}|^)(EICARTESTCENSOR)(?=\\P{L}|$)":{"case_sensitive":false}}],"custom_emoji_translation":{},"watched_words_replace":{"(?:\\P{L}|^)(¯_\\(ツ\\)_/¯)(?=\\P{L}|$)":{"word":"¯_(ツ)_/¯","replacement":"¯\\_(ツ)_/¯","case_sensitive":false}},"watched_words_link":{"(?:\\P{L}|^)(Data Explorer)(?=\\P{L}|$)":{"word":"Data Explorer","replacement":"https://meta.discourse.org/t/32566?silent=true","case_sensitive":false},"(?:\\P{L}|^)(discourseconnect)(?=\\P{L}|$)":{"word":"discourseconnect","replacement":"https://meta.discourse.org/t/13045?silent=true","case_sensitive":false},"(?:\\P{L}|^)(discourse connect)(?=\\P{L}|$)":{"word":"discourse connect","replacement":"https://meta.discourse.org/t/13045?silent=true","case_sensitive":false},"(?:\\P{L}|^)(discourse sso)(?=\\P{L}|$)":{"word":"discourse sso","replacement":"https://meta.discourse.org/t/13045?silent=true","case_sensitive":false},"(?:\\P{L}|^)(official install)(?=\\P{L}|$)":{"word":"official install","replacement":"https://meta.discourse.org/t/142537?silent=true","case_sensitive":false},"(?:\\P{L}|^)(standard install)(?=\\P{L}|$)":{"word":"standard install","replacement":"https://meta.discourse.org/t/142537?silent=true","case_sensitive":false},"(?:\\P{L}|^)(safe mode)(?=\\P{L}|$)":{"word":"safe mode","replacement":"https://meta.discourse.org/t/53504?silent=true","case_sensitive":false}},"categories":[{"id":67,"name":"announcements","color":"ED207B","text_color":"FFFFFF","slug":"announcements","topic_count":312,"post_count":3973,"position":0,"description":"The place for all Discourse announcements.","description_text":"The place for all Discourse announcements.","description_excerpt":"The place for all Discourse announcements.","topic_url":"/t/about-the-announcements-category/68629","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":true,"sort_order":null,"sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_ready":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_enabled":true,"activity_pub_username":"announcements","activity_pub_name":"Announcements","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":["new-feature","security"],"allowed_tag_groups":[],"allow_global_tags":true,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":true,"activity_pub_ready":true,"activity_pub_actor":{"id":2,"handle":"[email protected]","name":"Announcements"},"activity_pub_username":"announcements","activity_pub_name":"Announcements","activity_pub_default_visibility":"public","activity_pub_publication_type":"first_post","activity_pub_post_object_type":"Note","uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":13,"name":"blog","color":"8080ff","text_color":"FFFFFF","slug":"blog","topic_count":170,"post_count":1477,"position":1,"description":"Discussion topics generated from the official Discourse Blog. These topics are linked from the bottom of each blog entry where the blog comments would normally be.","description_text":"Discussion topics generated from the official Discourse Blog. These topics are linked from the bottom of each blog entry where the blog comments would normally be.","description_excerpt":"Discussion topics generated from the official Discourse Blog. These topics are linked from the bottom of each blog entry where the blog comments would normally be.","topic_url":"/t/about-the-blog-category/5250","read_restricted":false,"permission":null,"parent_category_id":67,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"created","sort_ascending":false,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":10,"name":"documentation","color":"00A94F","text_color":"FFFFFF","slug":"documentation","topic_count":2,"post_count":2,"position":2,"description":"Documentation for how to use Discourse, install and configure sites, and troubleshoot common issues. Includes topics for tutorials, how-tos, general reference and troubleshooting. Topics need to be created in one of the subcategories, and may only be created by trust level 2 and up.","description_text":"Documentation for how to use Discourse, install and configure sites, and troubleshoot common issues. Includes topics for tutorials, how-tos, general reference and troubleshooting. Topics need to be created in one of the subcategories, and may only be created by trust level 2 and up.","description_excerpt":"Documentation for how to use Discourse, install and configure sites, and troubleshoot common issues. Includes topics for tutorials, how-tos, general reference and troubleshooting. Topics need to be created in one of the subcategories, and may only be created by trust level 2 and up.","topic_url":"/t/about-the-documentation-category/2629","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":true,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"top","subcategory_list_style":"boxes","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_ready":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Article","activity_pub_publication_type":"full_topic","activity_pub_username":"documentation","activity_pub_enabled":true,"activity_pub_name":"Documentation"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":true,"activity_pub_ready":true,"activity_pub_actor":{"id":31769,"handle":"[email protected]","name":"Documentation"},"activity_pub_username":"documentation","activity_pub_name":"Documentation","activity_pub_default_visibility":"public","activity_pub_publication_type":"full_topic","activity_pub_post_object_type":"Article","uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":53,"name":"admins","color":"F15D22","text_color":"FFFFFF","slug":"admins","topic_count":222,"post_count":1703,"position":3,"description":"Guides for Discourse admins and community managers with admin access.","description_text":"Guides for Discourse admins and community managers with admin access.","description_excerpt":"Guides for Discourse admins and community managers with admin access.","topic_url":"/t/about-the-admins-category/56207","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":["hosted-support","migrations"],"allowed_tag_groups":[],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":125,"name":"moderators","color":"40d0e2","text_color":"FFFFFF","slug":"moderators","topic_count":16,"post_count":71,"position":4,"description":"Documentation for moderators and community managers using Discourse.","description_text":"Documentation for moderators and community managers using Discourse.","description_excerpt":"Documentation for moderators and community managers using Discourse.","topic_url":"/t/about-the-moderators-category/238588","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":126,"name":"users","color":"0088CC","text_color":"FFFFFF","slug":"users","topic_count":53,"post_count":184,"position":5,"description":"Documentation for all members of communities running Discourse.","description_text":"Documentation for all members of communities running Discourse.","description_excerpt":"Documentation for all members of communities running Discourse.","topic_url":"/t/about-the-users-category/238917","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":55,"name":"sysadmin","color":"E9DD00","text_color":"FFFFFF","slug":"sysadmin","topic_count":175,"post_count":2803,"position":6,"description":"Documentation for self-hosters and Discourse system administrators.","description_text":"Documentation for self-hosters and Discourse system administrators.","description_excerpt":"Documentation for self-hosters and Discourse system administrators.","topic_url":"/t/about-the-sysadmin-category/56209","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":["migrations"],"allowed_tag_groups":[],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":127,"name":"theme developers","color":"92278F","text_color":"FFFFFF","slug":"theme-developers","topic_count":41,"post_count":215,"position":7,"description":"Documentation for developing themes and components that can be installed by admins.","description_text":"Documentation for developing themes and components that can be installed by admins.","description_excerpt":"Documentation for developing themes and components that can be installed by admins.","topic_url":"/t/about-the-theme-developers-category/239285","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":56,"name":"developers","color":"00A94F","text_color":"FFFFFF","slug":"devs","topic_count":96,"post_count":1185,"position":8,"description":"Documentation for developing features, plugins, or integrations with Discourse.","description_text":"Documentation for developing features, plugins, or integrations with Discourse.","description_excerpt":"Documentation for developing features, plugins, or integrations with Discourse.","topic_url":"/t/about-the-developers-category/56210","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_ready":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Article","activity_pub_enabled":true,"activity_pub_username":"developer-docs","activity_pub_name":"Developer Documentation","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":true,"activity_pub_ready":true,"activity_pub_actor":{"id":35545,"handle":"[email protected]","name":"Developer Documentation"},"activity_pub_username":"developer-docs","activity_pub_name":"Developer Documentation","activity_pub_default_visibility":"public","activity_pub_publication_type":"first_post","activity_pub_post_object_type":"Article","uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":6,"name":"support","color":"CEA9A9","text_color":"FFFFFF","slug":"support","topic_count":15841,"post_count":103687,"position":9,"description":"The category for general support questions on using your Discourse site.","description_text":"The category for general support questions on using your Discourse site.","description_excerpt":"The category for general support questions on using your Discourse site.","topic_url":"/t/about-the-support-category/389","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"\u003e Before asking, did you search first? Press 🔍 at the upper right to search.","has_children":true,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_accepted_answers":"true","enable_unassigned_filter":"false","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":21,"name":"wordpress","color":"F9CFCF","text_color":"FFFFFF","slug":"wordpress","topic_count":732,"post_count":5110,"position":10,"description":"Support for the official Discourse WordPress plugin at \u003ca href=\"https://github.com/discourse/wp-discourse\" class=\"inline-onebox\"\u003eGitHub - discourse/wp-discourse: WordPress plugin that lets you use Discourse as the community engine for a WordPress blog\u003c/a\u003e","description_text":"Support for the official Discourse WordPress plugin at GitHub - discourse/wp-discourse: WordPress plugin that lets you use Discourse as the community engine for a WordPress blog","description_excerpt":"Support for the official Discourse WordPress plugin at \u003ca href=\"https://github.com/discourse/wp-discourse\" class=\"inline-onebox\"\u003eGitHub - discourse/wp-discourse: WordPress plugin that lets you use Discourse as the community engine for a WordPress blog\u003c/a\u003e","topic_url":"/t/about-the-wordpress-category/12282","read_restricted":false,"permission":null,"parent_category_id":6,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":1,"name":"bug","color":"e9dd00","text_color":"000000","slug":"bug","topic_count":5153,"post_count":35973,"position":11,"description":"A bug report means \u003cstrong\u003esomething is broken, preventing normal/typical use of Discourse\u003c/strong\u003e. Do be sure to search prior to submitting bugs. \u003ca href=\"https://meta.discourse.org/t/how-to-write-a-good-bug-report/183671/\"\u003eInclude repro steps\u003c/a\u003e, and only describe one bug per topic please.","description_text":"A bug report means something is broken, preventing normal/typical use of Discourse. Do be sure to search prior to submitting bugs. Include repro steps, and only describe one bug per topic please.","description_excerpt":"A bug report means something is broken, preventing normal/typical use of Discourse. Do be sure to search prior to submitting bugs. \u003ca href=\"https://meta.discourse.org/t/how-to-write-a-good-bug-report/183671/\"\u003eInclude repro steps\u003c/a\u003e, and only describe one bug per topic please.","topic_url":"/t/about-the-bug-category/2","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_accepted_answers":null,"enable_unassigned_filter":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":9,"name":"ux","color":"5F497A","text_color":"FFFFFF","slug":"ux","topic_count":2700,"post_count":18225,"position":12,"description":"Discussion about the user interface of Discourse and how features are presented (including language and UI elements).","description_text":"Discussion about the user interface of Discourse and how features are presented (including language and UI elements).","description_excerpt":"Discussion about the user interface of Discourse and how features are presented (including language and UI elements).","topic_url":"/t/about-the-ux-category/2628","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":2,"name":"feature","color":"0E76BD","text_color":"FFFFFF","slug":"feature","topic_count":6997,"post_count":58067,"position":13,"description":"Discussion about existing Discourse features, how they can be improved or enhanced, and how proposed new features could work.","description_text":"Discussion about existing Discourse features, how they can be improved or enhanced, and how proposed new features could work.","description_excerpt":"Discussion about existing Discourse features, how they can be improved or enhanced, and how proposed new features could work.","topic_url":"/t/about-the-feature-category/11","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_ready":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_username":"feature","activity_pub_name":"Feature Requests","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post","activity_pub_enabled":true},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":true,"activity_pub_ready":true,"activity_pub_actor":{"id":1,"handle":"[email protected]","name":"Feature Requests"},"activity_pub_username":"feature","activity_pub_name":"Feature Requests","activity_pub_default_visibility":"public","activity_pub_publication_type":"first_post","activity_pub_post_object_type":"Note","uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":148,"name":"data \u0026 reporting","color":"D24899","text_color":"FFFFFF","slug":"data-reporting","topic_count":631,"post_count":3056,"position":14,"description":"This is the category for everything related to Discourse data and reporting. Here, you can discuss dashboard reports, custom badge queries, data-explorer queries and any other analytic add-ons.","description_text":"This is the category for everything related to Discourse data and reporting. Here, you can discuss dashboard reports, custom badge queries, data-explorer queries and any other analytic add-ons.","description_excerpt":"This is the category for everything related to Discourse data and reporting. Here, you can discuss dashboard reports, custom badge queries, data-explorer queries and any other analytic add-ons.","topic_url":"/t/about-the-data-reporting-category/274664","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","enable_accepted_answers":"true","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":24,"name":"sso","color":"d47711","text_color":"FFFFFF","slug":"sso","topic_count":493,"post_count":2546,"position":15,"description":"For queries specifically about SSO (single sign-on) and login using third-party providers (Google, Facebook, GitHub etc). See the \u003ca href=\"https://meta.discourse.org/t/discourseconnect-official-single-sign-on-for-discourse-sso/13045\"\u003eofficial documentation on DiscourseConnect SSO\u003c/a\u003e.","description_text":"For queries specifically about SSO (single sign-on) and login using third-party providers (Google, Facebook, GitHub etc). See the official documentation on DiscourseConnect SSO.","description_excerpt":"For queries specifically about SSO (single sign-on) and login using third-party providers (Google, Facebook, GitHub etc). See the \u003ca href=\"https://meta.discourse.org/t/discourseconnect-official-single-sign-on-for-discourse-sso/13045\"\u003eofficial documentation on DiscourseConnect SSO\u003c/a\u003e.","topic_url":"/t/about-the-sso-category/13110","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":65,"name":"community","color":"12A89D","text_color":"FFFFFF","slug":"community","topic_count":866,"post_count":8844,"position":16,"description":"A great platform doesn’t guarantee success. Community building is a science. This category is for discussions about launching, building, growing and managing a thriving community.","description_text":"A great platform doesn’t guarantee success. Community building is a science. This category is for discussions about launching, building, growing and managing a thriving community.","description_excerpt":"A great platform doesn’t guarantee success. Community building is a science. This category is for discussions about launching, building, growing and managing a thriving community.","topic_url":"/t/about-the-community-category/67750","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":7,"name":"dev","color":"292929","text_color":"fff","slug":"dev","topic_count":3467,"post_count":20210,"position":17,"description":"The category for all things Discourse Development. Building a customization for yourself or the community? Then this is the category for you!","description_text":"The category for all things Discourse Development. Building a customization for yourself or the community? Then this is the category for you!","description_excerpt":"The category for all things Discourse Development. Building a customization for yourself or the community? Then this is the category for you!","topic_url":"/t/about-the-dev-category/1026","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":true,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"boxes","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":27,"name":"translations","color":"808281","text_color":"FFFFFF","slug":"translations","topic_count":297,"post_count":1832,"position":18,"description":"This category is for discussion about localizing Discourse.","description_text":"This category is for discussion about localizing Discourse.","description_excerpt":"This category is for discussion about localizing Discourse.","topic_url":"/t/about-the-translations-category/14549","read_restricted":false,"permission":null,"parent_category_id":7,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":14,"name":"marketplace","color":"8C6238","text_color":"FFFFFF","slug":"marketplace","topic_count":1162,"post_count":5865,"position":19,"description":"This is your hub for all Discourse-related commerce: jobs, gigs, plugins, themes, hosting, and more.","description_text":"This is your hub for all Discourse-related commerce: jobs, gigs, plugins, themes, hosting, and more.","description_excerpt":"This is your hub for all Discourse-related commerce: jobs, gigs, plugins, themes, hosting, and more.","topic_url":"/t/about-the-marketplace-category/5425","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"What would you like done?\n\nWhen do you need it done?\n\nWhat is your budget, in $ USD that you can offer for this task?\n\n\u003c!-- We encourage caution and due diligence when engaging with potential contractors or clients. Verify their credentials, check previous work, and ensure a transparent and legitimate transaction. Always remember, your safety and security in the marketplace is your responsibility. --\u003e","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":["delivered"],"allowed_tag_groups":[],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":22,"name":"plugin","color":"F7941D","text_color":"FFFFFF","slug":"plugin","topic_count":315,"post_count":10429,"position":20,"description":"A directory of Discourse plugins, both official and third-party.","description_text":"A directory of Discourse plugins, both official and third-party.","description_excerpt":"A directory of Discourse plugins, both official and third-party.","topic_url":"/t/about-the-plugin-category/12648","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"| | | |\n| - | - | - |\n| :information_source: | **Summary** | In a few words, what does this plugin do? |\n| :hammer_and_wrench: | **Repository Link** | \u003c\u003e |\n| :open_book: | **Install Guide** | [How to install plugins in Discourse](https://meta.discourse.org/t/install-plugins-in-discourse/19157) |\n\n\u003cbr\u003e \n\n### Features\n \nDescribe the major features of the plugin\n \n### Configuration\n \nInclude detailed steps on how to configure the plugin (include screenshots where necessary)\n \n### CHANGELOG\n- Add new bullets when major features are committed here\n \n### TODO\n- Add any #pr-welcome TODO tasks here","has_children":true,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"boxes","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":["Resource Status"],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":5,"name":"extras","color":"25AAE2","text_color":"FFFFFF","slug":"extras","topic_count":90,"post_count":985,"position":21,"description":"A directory of all extensions \u0026amp; integrations for Discourse which are \u003cem\u003enot\u003c/em\u003e Discourse plugins, i.e. a CMS plugin, a browser extension or a native application.","description_text":"A directory of all extensions \u0026amp; integrations for Discourse which are not Discourse plugins, i.e. a CMS plugin, a browser extension or a native application.","description_excerpt":"A directory of all extensions \u0026amp; integrations for Discourse which are not Discourse plugins, i.e. a CMS plugin, a browser extension or a native application.","topic_url":"/t/about-the-extras-category/28","read_restricted":false,"permission":null,"parent_category_id":22,"notification_level":1,"topic_template":"","has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":["Resource Status"],"allow_global_tags":true,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":61,"name":"theme","color":"E43D30","text_color":"FFFFFF","slug":"theme","topic_count":66,"post_count":2138,"position":22,"description":"Themes are expansive customizations that change multiple elements of the style of your forum design, and often also include additional front-end features.","description_text":"Themes are expansive customizations that change multiple elements of the style of your forum design, and often also include additional front-end features.","description_excerpt":"Themes are expansive customizations that change multiple elements of the style of your forum design, and often also include additional front-end features.","topic_url":"/t/about-the-theme-category/60925","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"||||\n|-|-|-|\n| :information_source: | **Summary** | ADD SHORT SUMMARY \n| :eyeglasses:|**Preview**| PREVIEW_LINK |\n| :hammer_and_wrench:|**Repository**| REPOSITORY_LINK |\n| :question:|**Install Guide**|[How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682)|\n| :open_book:|**New to Discourse Themes?**| [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966)\n\n\u003c!-- Describe this theme in one or two sentences --\u003e\n\nShort description...\n\n\u003c!-- Add screenshots (if applicable) --\u003e\n\nScreenshots...\n\n\u003c!-- Add more details and explain the settings (if applicable) --\u003e\n\nDetailed description...\n","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"none","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":["color-palette"],"allowed_tag_groups":["Resource Status"],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":120,"name":"theme-component","color":"1dedf8","text_color":"FFFFFF","slug":"theme-component","topic_count":300,"post_count":7516,"position":23,"description":"Theme components are customizations that change surface elements of your forum design, or add extra front-end features.","description_text":"Theme components are customizations that change surface elements of your forum design, or add extra front-end features.","description_excerpt":"Theme components are customizations that change surface elements of your forum design, or add extra front-end features.","topic_url":"/t/about-the-theme-component-category/232731","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"| | | |\n| - | - | - |\n| :information_source: | **Summary** | ADD SHORT SUMMARY |\n| :eyeglasses: |**Preview**| PREVIEW_LINK |\n| :hammer_and_wrench: | **Repository**| REPOSITORY_LINK |\n| :question: | **Install Guide** | [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |\n| :open_book: | **New to Discourse Themes?** | [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |\n\n\u003c!-- Fill in \"repoName\" and \"repoURL\" for the automatic install button --\u003e\n\n[wrap=theme-install-button repoName=\"Component's name\" repoUrl=\"GitHub repository link\"]\nInstall this theme component\n[/wrap]\n\n\u003c!-- Describe this theme/component in one or two sentences --\u003e\n\nShort description...\n\n\u003c!-- Add screenshots (if applicable) --\u003e\n\nScreenshots...\n\n\u003c!-- Add more details and explain the settings (if applicable) --\u003e\n\nDetailed description...","has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"none","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":["Resource Status"],"allow_global_tags":true,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":31,"name":"installation","color":"997E7E","text_color":"FFFFFF","slug":"installation","topic_count":3426,"post_count":29611,"position":24,"description":"Getting Discourse up and running, keeping it going, upgrading, and any other general sysadmin maintenance.","description_text":"Getting Discourse up and running, keeping it going, upgrading, and any other general sysadmin maintenance.","description_excerpt":"Getting Discourse up and running, keeping it going, upgrading, and any other general sysadmin maintenance.","topic_url":"/t/about-the-installation-category/21019","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":106,"name":"migration","color":"652D90","text_color":"FFFFFF","slug":"migration","topic_count":215,"post_count":1558,"position":25,"description":"You want to migrate your community to Discourse? Awesome! This is the category where you can ask questions, get help, and document your Discourse migration journey.","description_text":"You want to migrate your community to Discourse? Awesome! This is the category where you can ask questions, get help, and document your Discourse migration journey.","description_excerpt":"You want to migrate your community to Discourse? Awesome! This is the category where you can ask questions, get help, and document your Discourse migration journey.","topic_url":"/t/about-the-migration-category/196969","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":["Migration"],"allow_global_tags":true,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":8,"name":"hosting","color":"00AEEF","text_color":"FFFFFF","slug":"hosting","topic_count":501,"post_count":4117,"position":26,"description":"Topics about hosting Discourse, either on your own servers, in the cloud, or with specific hosting services.","description_text":"Topics about hosting Discourse, either on your own servers, in the cloud, or with specific hosting services.","description_excerpt":"Topics about hosting Discourse, either on your own servers, in the cloud, or with specific hosting services.","topic_url":"/t/about-the-hosting-category/2626","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post","enable_accepted_answers":"true"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":30,"name":"releases","color":"BF1E2E","text_color":"FFFFFF","slug":"releases","topic_count":23,"post_count":104,"position":27,"description":"Outlining each official release of Discourse, and plans for future releases.","description_text":"Outlining each official release of Discourse, and plans for future releases.","description_excerpt":"Outlining each official release of Discourse, and plans for future releases.","topic_url":"/t/about-the-releases-category/20857","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"created","sort_ascending":false,"show_subcategory_list":true,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":3,"name":"site feedback","color":"888","text_color":"FFFFFF","slug":"site-feedback","topic_count":417,"post_count":3220,"position":28,"description":"Discussion about \u003ca href=\"http://meta.discourse.org\"\u003emeta.discourse.org\u003c/a\u003e itself - the organization of this forum, how it works, and how we can improve this site.","description_text":"Discussion about meta.discourse.org itself - the organization of this forum, how it works, and how we can improve this site.","description_excerpt":"Discussion about \u003ca href=\"http://meta.discourse.org\"\u003emeta.discourse.org\u003c/a\u003e itself - the organization of this forum, how it works, and how we can improve this site.","topic_url":"/t/about-the-site-feedback-category/24","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":true,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":152,"name":"theme feedback","color":"ED207B","text_color":"FFFFFF","slug":"theme-feedback","topic_count":11,"post_count":44,"position":29,"description":"This is the category to gather all the UX reports for \u003ca href=\"https://meta.discourse.org/t/we-have-a-new-default-theme-here-on-meta/284692\"\u003eour new theme on meta\u003c/a\u003e. It also uses the new Form Templates feature that I’ve been wanting to try out.","description_text":"This is the category to gather all the UX reports for our new theme on meta. It also uses the new Form Templates feature that I’ve been wanting to try out.","description_excerpt":"This is the category to gather all the UX reports for \u003ca href=\"https://meta.discourse.org/t/we-have-a-new-default-theme-here-on-meta/284692\"\u003eour new theme on meta\u003c/a\u003e. It also uses the new Form Templates feature that I’ve been wanting to try out.","topic_url":"/t/about-the-theme-feedback-category/284904","read_restricted":false,"permission":null,"parent_category_id":3,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[1],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":157,"name":"forum summaries","color":"72e9a7","text_color":"FFFFFF","slug":"forum-summaries","topic_count":4,"post_count":36,"position":30,"description":"Stay up-to-date with the pulse of our community through AI-crafted summaries. This category harnesses the power of artificial intelligence to collate and condense forum activities, providing you with comprehensive yet succinct overviews. From emerging discussions to trending topics, our AI summaries deliver the essence of the Discourse community’s heartbeat, right at your fingertips.","description_text":"Stay up-to-date with the pulse of our community through AI-crafted summaries. This category harnesses the power of artificial intelligence to collate and condense forum activities, providing you with comprehensive yet succinct overviews. From emerging discussions to trending topics, our AI summaries deliver the essence of the Discourse community’s heartbeat, right at your fingertips.","description_excerpt":"Stay up-to-date with the pulse of our community through AI-crafted summaries. This category harnesses the power of artificial intelligence to collate and condense forum activities, providing you with comprehensive yet succinct overviews. From emerging discussions to trending topics, our AI summarie\u0026hellip;","topic_url":"/t/about-the-forum-summaries-category/291765","read_restricted":false,"permission":null,"parent_category_id":3,"notification_level":0,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":35,"name":"praise","color":"9EB83B","text_color":"FFFFFF","slug":"praise","topic_count":294,"post_count":1091,"position":31,"description":"Have something nice to say about Discourse?","description_text":"Have something nice to say about Discourse?","description_excerpt":"Have something nice to say about Discourse?","topic_url":"/t/about-the-praise-category/30010","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":true,"sort_order":null,"sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":63,"name":"comparison","color":"F1592A","text_color":"FFFFFF","slug":"comparison","topic_count":11,"post_count":137,"position":32,"description":"Topics comparing Discourse to other platforms.","description_text":"Topics comparing Discourse to other platforms.","description_excerpt":"Topics comparing Discourse to other platforms.","topic_url":"/t/about-the-comparison-category/65736","read_restricted":false,"permission":null,"parent_category_id":35,"notification_level":1,"topic_template":"### About PLATFORM_NAME\n\nA blurb about the platform being compared to Discourse. \n\nhttp://link.to.website\n\n ### Previous discussions:\n\nlinks to previous discussions related\n\n### Importer status\n\nIs there an official Discourse importer? Where is it? ","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":105,"name":"community support program","color":"92278F","text_color":"FFFFFF","slug":"support-program","topic_count":4,"post_count":27,"position":33,"description":"Get recognition for your work in helping and supporting Discourse communities by joining our Community Support Program.","description_text":"Get recognition for your work in helping and supporting Discourse communities by joining our Community Support Program.","description_excerpt":"Get recognition for your work in helping and supporting Discourse communities by joining our Community Support Program.","topic_url":"/t/about-the-community-support-program-category/193906","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":124,"name":"General","color":"25AAE2","text_color":"FFFFFF","slug":"general","topic_count":155,"post_count":1408,"position":35,"description":"Create topics here that don’t fit into any other existing category.","description_text":"Create topics here that don’t fit into any other existing category.","description_excerpt":"Create topics here that don’t fit into any other existing category.","topic_url":"/t/about-the-general-category/237517","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":17,"name":"Uncategorized","color":"AB9364","text_color":"FFFFFF","slug":"uncategorized","topic_count":0,"post_count":0,"position":77,"description":"Topics that don't need a category, or don't fit into any other existing category.","description_text":"Topics that don't need a category, or don't fit into any other existing category.","description_excerpt":"Topics that don't need a category, or don't fit into any other existing category.","topic_url":"/t/","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false}],"markdown_additional_options":{"chat":{"limited_pretty_text_features":["anchor","bbcode-block","bbcode-inline","code","category-hashtag","censored","chat-transcript","discourse-local-dates","emoji","emojiShortcuts","inlineEmoji","html-img","hashtag-autocomplete","mentions","unicodeUsernames","onebox","quotes","spoiler-alert","table","text-post-process","upload-protocol","watched-words"],"limited_pretty_text_markdown_rules":["autolink","list","backticks","newline","code","fence","image","table","linkify","link","strikethrough","blockquote","emphasis","replacements"],"hashtag_configurations":{"topic-composer":["category","tag","channel"],"chat-composer":["channel","category","tag"]}}},"hashtag_configurations":{"topic-composer":["category","tag","channel"],"chat-composer":["channel","category","tag"]},"hashtag_icons":{"category":"folder","tag":"tag","channel":"comment"},"displayed_about_plugin_stat_groups":["chat_messages"],"anonymous_default_navigation_menu_tags":[{"name":"official","description":"This is a theme or plugin built by the Discourse team","pm_only":false},{"name":"release-notes","description":"Release notes for Discourse beta and stable branches. See https://meta.discourse.org/t/198215 for more details on the Discourse release process.","pm_only":false}],"anonymous_sidebar_sections":[{"id":56,"title":"Community","links":[{"id":274,"name":"Topics","value":"/latest","icon":"layer-group","external":false,"full_reload":false,"segment":"primary"},{"id":275,"name":"My Posts","value":"/my/activity","icon":"user","external":false,"full_reload":true,"segment":"primary"},{"id":276,"name":"Review","value":"/review","icon":"flag","external":false,"full_reload":false,"segment":"primary"},{"id":277,"name":"Admin","value":"/admin","icon":"wrench","external":false,"full_reload":false,"segment":"primary"},{"id":279,"name":"Users","value":"/u","icon":"users","external":false,"full_reload":false,"segment":"secondary"},{"id":280,"name":"About","value":"/about","icon":"info-circle","external":false,"full_reload":false,"segment":"secondary"},{"id":281,"name":"FAQ","value":"/faq","icon":"question-circle","external":false,"full_reload":false,"segment":"secondary"},{"id":282,"name":"Groups","value":"/g","icon":"user-friends","external":false,"full_reload":false,"segment":"secondary"},{"id":283,"name":"Badges","value":"/badges","icon":"certificate","external":false,"full_reload":false,"segment":"secondary"},{"id":287,"name":"Leaderboard","value":"/leaderboard/7","icon":"trophy","external":false,"full_reload":false,"segment":"secondary"},{"id":290,"name":"Global Leaderboard","value":"/leaderboard","icon":"trophy","external":false,"full_reload":false,"segment":"secondary"},{"id":291,"name":"Topic Filter","value":"/filter","icon":"filter","external":false,"full_reload":false,"segment":"secondary"}],"slug":"community","public":true,"section_type":"community"}],"tos_url":"/tos","privacy_policy_url":"https://www.discourse.org/privacy","activity_pub_enabled":true,"activity_pub_publishing_enabled":true,"activity_pub_host":"meta.discourse.org","docs_path":"docs","default_gamification_leaderboard_id":1,"hosting_tier":"enterprise","archetypes":[{"id":"regular","name":"Regular Topic","options":[]},{"id":"banner","name":"Banner Topic","options":[]}],"user_fields":[{"id":2,"name":"Pronouns","description":"Gender Pronouns (he/him, she/her, they/them, etc.)","field_type":"text","editable":true,"required":false,"show_on_profile":true,"show_on_user_card":true,"searchable":false,"position":1}],"auth_providers":[{"name":"facebook","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":580,"frame_height":400,"can_connect":true,"can_revoke":true,"icon":"fab-facebook"},{"name":"google_oauth2","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":850,"frame_height":500,"can_connect":true,"can_revoke":true,"icon":null},{"name":"github","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":null,"frame_height":null,"can_connect":true,"can_revoke":true,"icon":"fab-github"},{"name":"twitter","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":null,"frame_height":null,"can_connect":true,"can_revoke":true,"icon":"fab-twitter"},{"name":"discord","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":null,"frame_height":null,"can_connect":true,"can_revoke":true,"icon":"fab-discord"},{"name":"apple","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":null,"frame_height":null,"can_connect":true,"can_revoke":true,"icon":"fab-apple"}]}
\ No newline at end of file
+{"default_archetype":"regular","notification_types":{"mentioned":1,"replied":2,"quoted":3,"edited":4,"liked":5,"private_message":6,"invited_to_private_message":7,"invitee_accepted":8,"posted":9,"moved_post":10,"linked":11,"granted_badge":12,"invited_to_topic":13,"custom":14,"group_mentioned":15,"group_message_summary":16,"watching_first_post":17,"topic_reminder":18,"liked_consolidated":19,"post_approved":20,"code_review_commit_approved":21,"membership_request_accepted":22,"membership_request_consolidated":23,"bookmark_reminder":24,"reaction":25,"votes_released":26,"event_reminder":27,"event_invitation":28,"chat_mention":29,"chat_message":30,"chat_invitation":31,"chat_group_mention":32,"chat_quoted":33,"assigned":34,"question_answer_user_commented":35,"watching_category_or_tag":36,"new_features":37,"admin_problems":38,"following":800,"following_created_topic":801,"following_replied":802,"circles_activity":900},"post_types":{"regular":1,"moderator_action":2,"small_action":3,"whisper":4},"user_tips":{"first_notification":1,"topic_timeline":2,"post_menu":3,"topic_notification_levels":4,"suggested_topics":5,"admin_guide":6},"trust_levels":{"newuser":0,"basic":1,"member":2,"regular":3,"leader":4},"groups":[{"id":183,"name":"ai-agents","flair_url":null,"flair_bg_color":"","flair_color":""},{"id":160,"name":"community-moderators","flair_url":null,"flair_bg_color":"","flair_color":""},{"id":184,"name":"glimmer-search-menu","flair_url":null,"flair_bg_color":"","flair_color":""},{"id":157,"name":"new-new-testers","flair_url":null,"flair_bg_color":"","flair_color":""},{"id":48,"name":"plugin_authors","flair_url":"fa-plug","flair_bg_color":"dddddd","flair_color":"111111"},{"id":148,"name":"support-advocates","flair_url":"https://d11a6trkgmumsb.cloudfront.net/original/3X/e/4/e4038d4d9848de2eabab38e17b8bdb69da154024.svg","flair_bg_color":"FFFFFF","flair_color":""},{"id":151,"name":"support-enthusiasts","flair_url":"https://d11a6trkgmumsb.cloudfront.net/original/3X/1/3/13f5d8d7e56be8a6a1ea3de009b985a548aec8d4.svg","flair_bg_color":"FFFFFF","flair_color":""},{"id":142,"name":"support-experts","flair_url":"https://d11a6trkgmumsb.cloudfront.net/original/3X/e/2/e250ec403580530d19e6a9ed42d0d525a51a9dbe.svg","flair_bg_color":"FFFFFF","flair_color":""},{"id":118,"name":"support-explorers","flair_url":"https://d11a6trkgmumsb.cloudfront.net/original/4X/d/1/b/d1ba0acf09b9d01f87f9e05bbee1dc5b0e316d5f.png","flair_bg_color":"dddddd","flair_color":"111111"},{"id":47,"name":"team","flair_url":"https://d11a6trkgmumsb.cloudfront.net/original/3X/e/b/ebee30bd98aef20357e4a177a5a1e45b877ce088.svg","flair_bg_color":"","flair_color":"111"},{"id":73,"name":"theme_authors","flair_url":"fa-paint-brush","flair_bg_color":"ddd","flair_color":"111"},{"id":84,"name":"theme_creator","flair_url":"fa-palette","flair_bg_color":"ddd","flair_color":"111"},{"id":50,"name":"translators","flair_url":"fa-globe","flair_bg_color":"ddd","flair_color":"111"}],"filters":["latest","unread","new","unseen","top","read","posted","bookmarks","hot"],"periods":["all","yearly","quarterly","monthly","weekly","daily"],"top_menu_items":["latest","unread","new","unseen","top","read","posted","bookmarks","hot","categories"],"anonymous_top_menu_items":["latest","top","categories","hot","categories","top"],"uncategorized_category_id":17,"user_field_max_length":2048,"post_action_types":[{"id":2,"name_key":"like","name":"Like","description":"Like this post","short_description":"Like this post","is_flag":false,"is_custom_flag":false},{"id":3,"name_key":"off_topic","name":"Off-Topic","description":"This post is not relevant to the current discussion as defined by the title and first post, and should probably be moved elsewhere.","short_description":"Not relevant to the discussion","is_flag":true,"is_custom_flag":false},{"id":4,"name_key":"inappropriate","name":"Inappropriate","description":"This post contains content that a reasonable person would consider offensive, abusive, to be hateful conduct or a violation of \u003ca href=\"/guidelines\"\u003eour community guidelines\u003c/a\u003e.","short_description":"A violation of \u003ca href=\"/guidelines\"\u003eour community guidelines\u003c/a\u003e","is_flag":true,"is_custom_flag":false},{"id":8,"name_key":"spam","name":"Spam","description":"This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.","short_description":"This is an advertisement or vandalism","is_flag":true,"is_custom_flag":false},{"id":6,"name_key":"notify_user","name":"Send @%{username} a message","description":"I want to talk to this person directly and personally about their post.","short_description":"I want to talk to this person directly and personally about their post.","is_flag":true,"is_custom_flag":true},{"id":10,"name_key":"illegal","name":"Illegal","description":"This post requires staff attention because I believe it contains content that is illegal.","short_description":"This is illegal","is_flag":true,"is_custom_flag":true},{"id":null,"name_key":null,"name":"Translation missing: en.post_action_types..title","description":"Translation missing: en.post_action_types.description","short_description":"Translation missing: en.post_action_types.short_description","is_flag":false,"is_custom_flag":false},{"id":7,"name_key":"notify_moderators","name":"Something Else","description":"This post requires staff attention for another reason not listed above.","short_description":"Requires staff attention for another reason","is_flag":true,"is_custom_flag":true}],"topic_flag_types":[{"id":4,"name_key":"inappropriate","name":"Inappropriate","description":"This topic contains content that a reasonable person would consider offensive, abusive, to be hateful conduct or a violation of \u003ca href=\"/guidelines\"\u003eour community guidelines\u003c/a\u003e.","short_description":"A violation of \u003ca href=\"/guidelines\"\u003eour community guidelines\u003c/a\u003e","is_flag":true,"is_custom_flag":false},{"id":8,"name_key":"spam","name":"Spam","description":"This topic is an advertisement. It is not useful or relevant to this site, but promotional in nature.","short_description":"This is an advertisement","is_flag":true,"is_custom_flag":false},{"id":10,"name_key":"illegal","name":"Illegal","description":"This topic requires staff attention because I believe it contains content that is illegal.","short_description":"This is illegal","is_flag":true,"is_custom_flag":true},{"id":null,"name_key":null,"name":"Translation missing: en.topic_flag_types..title","description":"Translation missing: en.topic_flag_types.description","short_description":"Translation missing: en.topic_flag_types.short_description","is_flag":false,"is_custom_flag":false},{"id":7,"name_key":"notify_moderators","name":"Something Else","description":"This topic requires general staff attention based on the \u003ca href=\"/guidelines\"\u003eguidelines\u003c/a\u003e, \u003ca href=\"/tos\"\u003eTOS\u003c/a\u003e, or for another reason not listed above.","short_description":"Requires staff attention for another reason","is_flag":true,"is_custom_flag":true}],"can_create_tag":false,"can_tag_topics":false,"can_tag_pms":false,"tags_filter_regexp":"[/\\?#\\[\\]@!\\$\u0026'\\(\\)\\*\\+,;=\\.%\\\\`^\\s|\\{\\}\"\u003c\u003e]+","top_tags":["how-to","chat","rest-api","sql-query","unsupported-install","email","pr-welcome","completed","ai","activity-summary","official","solved","sidebar","release-notes","server-resources","calendar-and-event","badges","topic-voting","docker","tags","advertising","invites","search","sql-triggered-badge","subscriptions","new-feature","chat-integration","wordpress","groups","themes","css"],"navigation_menu_site_top_tags":[{"name":"how-to","description":"How to guides contain steps to follow to solve a specific problem","pm_only":false},{"name":"chat","description":null,"pm_only":false},{"name":"rest-api","description":"Topics about making an external request to Discourse","pm_only":false},{"name":"sql-query","description":"SQL queries for the data-explorer","pm_only":false},{"name":"unsupported-install","description":null,"pm_only":false}],"topic_featured_link_allowed_category_ids":[149,120,122,157,121,153,127,9,136,138,61,83,96,56,132,123,144,104,10,27,137,25,124,22,134,24,110,105,143,119,145,135,129,7,30,89,131,150,6,155,31,20,133,55,102,148,147,95,152,151,128,154,21,139,108,69,3,14,125,63,2,126,115,106,1,118,117,17,53,13,5,65,8,67,35],"user_themes":[{"theme_id":272,"name":"Accessible contrast (dark)","default":false,"color_scheme_id":85},{"theme_id":271,"name":"Accessible contrast (light)","default":false,"color_scheme_id":84},{"theme_id":242,"name":"Air Theme","default":false,"color_scheme_id":82},{"theme_id":337,"name":"Central","default":false,"color_scheme_id":100},{"theme_id":335,"name":"CentralStaffOnly","default":false,"color_scheme_id":96},{"theme_id":31,"name":"Dark","default":false,"color_scheme_id":86},{"theme_id":140,"name":"Default","default":false,"color_scheme_id":34},{"theme_id":281,"name":"Default (full-width)","default":false,"color_scheme_id":34},{"theme_id":51,"name":"Discourse-classic","default":false,"color_scheme_id":34},{"theme_id":296,"name":"Fully","default":false,"color_scheme_id":null},{"theme_id":131,"name":"Ghost","default":false,"color_scheme_id":66},{"theme_id":80,"name":"Graceful","default":false,"color_scheme_id":54},{"theme_id":83,"name":"Grey Amber","default":false,"color_scheme_id":57},{"theme_id":232,"name":"Hidden Whispers","default":false,"color_scheme_id":null},{"theme_id":34,"name":"Material Design","default":false,"color_scheme_id":37},{"theme_id":331,"name":"Meta Branded","default":true,"color_scheme_id":34},{"theme_id":125,"name":"Minima Dark","default":false,"color_scheme_id":43},{"theme_id":299,"name":"redditish","default":false,"color_scheme_id":null},{"theme_id":30,"name":"Sam's Simple Theme","default":false,"color_scheme_id":null}],"user_color_schemes":[{"id":93,"name":"Central Dark","is_dark":true},{"id":95,"name":"Central Dark","is_dark":true},{"id":100,"name":"Central Light","is_dark":false},{"id":96,"name":"Central Light","is_dark":false},{"id":86,"name":"Dark","is_dark":true},{"id":34,"name":"Default Light","is_dark":false},{"id":87,"name":"Solarized Light","is_dark":false},{"id":85,"name":"WCAG Dark","is_dark":true},{"id":84,"name":"WCAG Light","is_dark":false}],"default_dark_color_scheme":null,"censored_regexp":[{"(?:\\P{L}|^)(EICARTESTCENSOR)(?=\\P{L}|$)":{"case_sensitive":false}}],"custom_emoji_translation":{},"watched_words_replace":{"(?:\\P{L}|^)(¯_\\(ツ\\)_/¯)(?=\\P{L}|$)":{"word":"¯_(ツ)_/¯","replacement":"¯\\_(ツ)_/¯","case_sensitive":false}},"watched_words_link":{"(?:\\P{L}|^)(Data Explorer)(?=\\P{L}|$)":{"word":"Data Explorer","replacement":"https://meta.discourse.org/t/32566?silent=true","case_sensitive":false},"(?:\\P{L}|^)(discourseconnect)(?=\\P{L}|$)":{"word":"discourseconnect","replacement":"https://meta.discourse.org/t/13045?silent=true","case_sensitive":false},"(?:\\P{L}|^)(discourse connect)(?=\\P{L}|$)":{"word":"discourse connect","replacement":"https://meta.discourse.org/t/13045?silent=true","case_sensitive":false},"(?:\\P{L}|^)(discourse sso)(?=\\P{L}|$)":{"word":"discourse sso","replacement":"https://meta.discourse.org/t/13045?silent=true","case_sensitive":false},"(?:\\P{L}|^)(official install)(?=\\P{L}|$)":{"word":"official install","replacement":"https://meta.discourse.org/t/142537?silent=true","case_sensitive":false},"(?:\\P{L}|^)(standard install)(?=\\P{L}|$)":{"word":"standard install","replacement":"https://meta.discourse.org/t/142537?silent=true","case_sensitive":false},"(?:\\P{L}|^)(safe mode)(?=\\P{L}|$)":{"word":"safe mode","replacement":"https://meta.discourse.org/t/53504?silent=true","case_sensitive":false}},"categories":[{"id":67,"name":"announcements","color":"ED207B","text_color":"FFFFFF","slug":"announcements","topic_count":312,"post_count":3973,"position":0,"description":"The place for all Discourse announcements.","description_text":"The place for all Discourse announcements.","description_excerpt":"The place for all Discourse announcements.","topic_url":"/t/about-the-announcements-category/68629","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":true,"sort_order":null,"sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_ready":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_enabled":true,"activity_pub_username":"announcements","activity_pub_name":"Announcements","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":["new-feature","security"],"allowed_tag_groups":[],"allow_global_tags":true,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":true,"activity_pub_ready":true,"activity_pub_actor":{"id":2,"handle":"[email protected]","name":"Announcements"},"activity_pub_username":"announcements","activity_pub_name":"Announcements","activity_pub_default_visibility":"public","activity_pub_publication_type":"first_post","activity_pub_post_object_type":"Note","uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":13,"name":"blog","color":"8080ff","text_color":"FFFFFF","slug":"blog","topic_count":170,"post_count":1477,"position":1,"description":"Discussion topics generated from the official Discourse Blog. These topics are linked from the bottom of each blog entry where the blog comments would normally be.","description_text":"Discussion topics generated from the official Discourse Blog. These topics are linked from the bottom of each blog entry where the blog comments would normally be.","description_excerpt":"Discussion topics generated from the official Discourse Blog. These topics are linked from the bottom of each blog entry where the blog comments would normally be.","topic_url":"/t/about-the-blog-category/5250","read_restricted":false,"permission":null,"parent_category_id":67,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"created","sort_ascending":false,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":10,"name":"documentation","color":"00A94F","text_color":"FFFFFF","slug":"documentation","topic_count":2,"post_count":2,"position":2,"description":"Documentation for how to use Discourse, install and configure sites, and troubleshoot common issues. Includes topics for tutorials, how-tos, general reference and troubleshooting. Topics need to be created in one of the subcategories, and may only be created by trust level 2 and up.","description_text":"Documentation for how to use Discourse, install and configure sites, and troubleshoot common issues. Includes topics for tutorials, how-tos, general reference and troubleshooting. Topics need to be created in one of the subcategories, and may only be created by trust level 2 and up.","description_excerpt":"Documentation for how to use Discourse, install and configure sites, and troubleshoot common issues. Includes topics for tutorials, how-tos, general reference and troubleshooting. Topics need to be created in one of the subcategories, and may only be created by trust level 2 and up.","topic_url":"/t/about-the-documentation-category/2629","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":true,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"top","subcategory_list_style":"boxes","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_ready":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Article","activity_pub_publication_type":"full_topic","activity_pub_username":"documentation","activity_pub_enabled":true,"activity_pub_name":"Documentation"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":true,"activity_pub_ready":true,"activity_pub_actor":{"id":31769,"handle":"[email protected]","name":"Documentation"},"activity_pub_username":"documentation","activity_pub_name":"Documentation","activity_pub_default_visibility":"public","activity_pub_publication_type":"full_topic","activity_pub_post_object_type":"Article","uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":53,"name":"admins","color":"F15D22","text_color":"FFFFFF","slug":"admins","topic_count":222,"post_count":1703,"position":3,"description":"Guides for Discourse admins and community managers with admin access.","description_text":"Guides for Discourse admins and community managers with admin access.","description_excerpt":"Guides for Discourse admins and community managers with admin access.","topic_url":"/t/about-the-admins-category/56207","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":["hosted-support","migrations"],"allowed_tag_groups":[],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":125,"name":"moderators","color":"40d0e2","text_color":"FFFFFF","slug":"moderators","topic_count":16,"post_count":71,"position":4,"description":"Documentation for moderators and community managers using Discourse.","description_text":"Documentation for moderators and community managers using Discourse.","description_excerpt":"Documentation for moderators and community managers using Discourse.","topic_url":"/t/about-the-moderators-category/238588","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":126,"name":"users","color":"0088CC","text_color":"FFFFFF","slug":"users","topic_count":53,"post_count":184,"position":5,"description":"Documentation for all members of communities running Discourse.","description_text":"Documentation for all members of communities running Discourse.","description_excerpt":"Documentation for all members of communities running Discourse.","topic_url":"/t/about-the-users-category/238917","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":55,"name":"sysadmin","color":"E9DD00","text_color":"FFFFFF","slug":"sysadmin","topic_count":175,"post_count":2803,"position":6,"description":"Documentation for self-hosters and Discourse system administrators.","description_text":"Documentation for self-hosters and Discourse system administrators.","description_excerpt":"Documentation for self-hosters and Discourse system administrators.","topic_url":"/t/about-the-sysadmin-category/56209","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":["migrations"],"allowed_tag_groups":[],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":127,"name":"theme developers","color":"92278F","text_color":"FFFFFF","slug":"theme-developers","topic_count":41,"post_count":215,"position":7,"description":"Documentation for developing themes and components that can be installed by admins.","description_text":"Documentation for developing themes and components that can be installed by admins.","description_excerpt":"Documentation for developing themes and components that can be installed by admins.","topic_url":"/t/about-the-theme-developers-category/239285","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":56,"name":"developers","color":"00A94F","text_color":"FFFFFF","slug":"devs","topic_count":96,"post_count":1185,"position":8,"description":"Documentation for developing features, plugins, or integrations with Discourse.","description_text":"Documentation for developing features, plugins, or integrations with Discourse.","description_excerpt":"Documentation for developing features, plugins, or integrations with Discourse.","topic_url":"/t/about-the-developers-category/56210","read_restricted":false,"permission":null,"parent_category_id":10,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_ready":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Article","activity_pub_enabled":true,"activity_pub_username":"developer-docs","activity_pub_name":"Developer Documentation","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":true,"activity_pub_ready":true,"activity_pub_actor":{"id":35545,"handle":"[email protected]","name":"Developer Documentation"},"activity_pub_username":"developer-docs","activity_pub_name":"Developer Documentation","activity_pub_default_visibility":"public","activity_pub_publication_type":"first_post","activity_pub_post_object_type":"Article","uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":6,"name":"support","color":"CEA9A9","text_color":"FFFFFF","slug":"support","topic_count":15841,"post_count":103687,"position":9,"description":"The category for general support questions on using your Discourse site.","description_text":"The category for general support questions on using your Discourse site.","description_excerpt":"The category for general support questions on using your Discourse site.","topic_url":"/t/about-the-support-category/389","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"\u003e Before asking, did you search first? Press 🔍 at the upper right to search.","has_children":true,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_accepted_answers":"true","enable_unassigned_filter":"false","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":21,"name":"wordpress","color":"F9CFCF","text_color":"FFFFFF","slug":"wordpress","topic_count":732,"post_count":5110,"position":10,"description":"Support for the official Discourse WordPress plugin at \u003ca href=\"https://github.com/discourse/wp-discourse\" class=\"inline-onebox\"\u003eGitHub - discourse/wp-discourse: WordPress plugin that lets you use Discourse as the community engine for a WordPress blog\u003c/a\u003e","description_text":"Support for the official Discourse WordPress plugin at GitHub - discourse/wp-discourse: WordPress plugin that lets you use Discourse as the community engine for a WordPress blog","description_excerpt":"Support for the official Discourse WordPress plugin at \u003ca href=\"https://github.com/discourse/wp-discourse\" class=\"inline-onebox\"\u003eGitHub - discourse/wp-discourse: WordPress plugin that lets you use Discourse as the community engine for a WordPress blog\u003c/a\u003e","topic_url":"/t/about-the-wordpress-category/12282","read_restricted":false,"permission":null,"parent_category_id":6,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":1,"name":"bug","color":"e9dd00","text_color":"000000","slug":"bug","topic_count":5153,"post_count":35973,"position":11,"description":"A bug report means \u003cstrong\u003esomething is broken, preventing normal/typical use of Discourse\u003c/strong\u003e. Do be sure to search prior to submitting bugs. \u003ca href=\"https://meta.discourse.org/t/how-to-write-a-good-bug-report/183671/\"\u003eInclude repro steps\u003c/a\u003e, and only describe one bug per topic please.","description_text":"A bug report means something is broken, preventing normal/typical use of Discourse. Do be sure to search prior to submitting bugs. Include repro steps, and only describe one bug per topic please.","description_excerpt":"A bug report means something is broken, preventing normal/typical use of Discourse. Do be sure to search prior to submitting bugs. \u003ca href=\"https://meta.discourse.org/t/how-to-write-a-good-bug-report/183671/\"\u003eInclude repro steps\u003c/a\u003e, and only describe one bug per topic please.","topic_url":"/t/about-the-bug-category/2","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_accepted_answers":null,"enable_unassigned_filter":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":9,"name":"ux","color":"5F497A","text_color":"FFFFFF","slug":"ux","topic_count":2700,"post_count":18225,"position":12,"description":"Discussion about the user interface of Discourse and how features are presented (including language and UI elements).","description_text":"Discussion about the user interface of Discourse and how features are presented (including language and UI elements).","description_excerpt":"Discussion about the user interface of Discourse and how features are presented (including language and UI elements).","topic_url":"/t/about-the-ux-category/2628","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":2,"name":"feature","color":"0E76BD","text_color":"FFFFFF","slug":"feature","topic_count":6997,"post_count":58067,"position":13,"description":"Discussion about existing Discourse features, how they can be improved or enhanced, and how proposed new features could work.","description_text":"Discussion about existing Discourse features, how they can be improved or enhanced, and how proposed new features could work.","description_excerpt":"Discussion about existing Discourse features, how they can be improved or enhanced, and how proposed new features could work.","topic_url":"/t/about-the-feature-category/11","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_ready":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_username":"feature","activity_pub_name":"Feature Requests","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post","activity_pub_enabled":true},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":true,"activity_pub_ready":true,"activity_pub_actor":{"id":1,"handle":"[email protected]","name":"Feature Requests"},"activity_pub_username":"feature","activity_pub_name":"Feature Requests","activity_pub_default_visibility":"public","activity_pub_publication_type":"first_post","activity_pub_post_object_type":"Note","uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":148,"name":"data \u0026 reporting","color":"D24899","text_color":"FFFFFF","slug":"data-reporting","topic_count":631,"post_count":3056,"position":14,"description":"This is the category for everything related to Discourse data and reporting. Here, you can discuss dashboard reports, custom badge queries, data-explorer queries and any other analytic add-ons.","description_text":"This is the category for everything related to Discourse data and reporting. Here, you can discuss dashboard reports, custom badge queries, data-explorer queries and any other analytic add-ons.","description_excerpt":"This is the category for everything related to Discourse data and reporting. Here, you can discuss dashboard reports, custom badge queries, data-explorer queries and any other analytic add-ons.","topic_url":"/t/about-the-data-reporting-category/274664","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","enable_accepted_answers":"true","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":24,"name":"sso","color":"d47711","text_color":"FFFFFF","slug":"sso","topic_count":493,"post_count":2546,"position":15,"description":"For queries specifically about SSO (single sign-on) and login using third-party providers (Google, Facebook, GitHub etc). See the \u003ca href=\"https://meta.discourse.org/t/discourseconnect-official-single-sign-on-for-discourse-sso/13045\"\u003eofficial documentation on DiscourseConnect SSO\u003c/a\u003e.","description_text":"For queries specifically about SSO (single sign-on) and login using third-party providers (Google, Facebook, GitHub etc). See the official documentation on DiscourseConnect SSO.","description_excerpt":"For queries specifically about SSO (single sign-on) and login using third-party providers (Google, Facebook, GitHub etc). See the \u003ca href=\"https://meta.discourse.org/t/discourseconnect-official-single-sign-on-for-discourse-sso/13045\"\u003eofficial documentation on DiscourseConnect SSO\u003c/a\u003e.","topic_url":"/t/about-the-sso-category/13110","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":65,"name":"community","color":"12A89D","text_color":"FFFFFF","slug":"community","topic_count":866,"post_count":8844,"position":16,"description":"A great platform doesn’t guarantee success. Community building is a science. This category is for discussions about launching, building, growing and managing a thriving community.","description_text":"A great platform doesn’t guarantee success. Community building is a science. This category is for discussions about launching, building, growing and managing a thriving community.","description_excerpt":"A great platform doesn’t guarantee success. Community building is a science. This category is for discussions about launching, building, growing and managing a thriving community.","topic_url":"/t/about-the-community-category/67750","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":7,"name":"dev","color":"292929","text_color":"fff","slug":"dev","topic_count":3467,"post_count":20210,"position":17,"description":"The category for all things Discourse Development. Building a customization for yourself or the community? Then this is the category for you!","description_text":"The category for all things Discourse Development. Building a customization for yourself or the community? Then this is the category for you!","description_excerpt":"The category for all things Discourse Development. Building a customization for yourself or the community? Then this is the category for you!","topic_url":"/t/about-the-dev-category/1026","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":true,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"boxes","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":27,"name":"translations","color":"808281","text_color":"FFFFFF","slug":"translations","topic_count":297,"post_count":1832,"position":18,"description":"This category is for discussion about localizing Discourse.","description_text":"This category is for discussion about localizing Discourse.","description_excerpt":"This category is for discussion about localizing Discourse.","topic_url":"/t/about-the-translations-category/14549","read_restricted":false,"permission":null,"parent_category_id":7,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":14,"name":"marketplace","color":"8C6238","text_color":"FFFFFF","slug":"marketplace","topic_count":1162,"post_count":5865,"position":19,"description":"This is your hub for all Discourse-related commerce: jobs, gigs, plugins, themes, hosting, and more.","description_text":"This is your hub for all Discourse-related commerce: jobs, gigs, plugins, themes, hosting, and more.","description_excerpt":"This is your hub for all Discourse-related commerce: jobs, gigs, plugins, themes, hosting, and more.","topic_url":"/t/about-the-marketplace-category/5425","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"What would you like done?\n\nWhen do you need it done?\n\nWhat is your budget, in $ USD that you can offer for this task?\n\n\u003c!-- We encourage caution and due diligence when engaging with potential contractors or clients. Verify their credentials, check previous work, and ensure a transparent and legitimate transaction. Always remember, your safety and security in the marketplace is your responsibility. --\u003e","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":["delivered"],"allowed_tag_groups":[],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":22,"name":"plugin","color":"F7941D","text_color":"FFFFFF","slug":"plugin","topic_count":315,"post_count":10429,"position":20,"description":"A directory of Discourse plugins, both official and third-party.","description_text":"A directory of Discourse plugins, both official and third-party.","description_excerpt":"A directory of Discourse plugins, both official and third-party.","topic_url":"/t/about-the-plugin-category/12648","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"| | | |\n| - | - | - |\n| :information_source: | **Summary** | In a few words, what does this plugin do? |\n| :hammer_and_wrench: | **Repository Link** | \u003c\u003e |\n| :open_book: | **Install Guide** | [How to install plugins in Discourse](https://meta.discourse.org/t/install-plugins-in-discourse/19157) |\n\n\u003cbr\u003e \n\n### Features\n \nDescribe the major features of the plugin\n \n### Configuration\n \nInclude detailed steps on how to configure the plugin (include screenshots where necessary)\n \n### CHANGELOG\n- Add new bullets when major features are committed here\n \n### TODO\n- Add any #pr-welcome TODO tasks here","has_children":true,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"boxes","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":["Resource Status"],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":5,"name":"extras","color":"25AAE2","text_color":"FFFFFF","slug":"extras","topic_count":90,"post_count":985,"position":21,"description":"A directory of all extensions \u0026amp; integrations for Discourse which are \u003cem\u003enot\u003c/em\u003e Discourse plugins, i.e. a CMS plugin, a browser extension or a native application.","description_text":"A directory of all extensions \u0026amp; integrations for Discourse which are not Discourse plugins, i.e. a CMS plugin, a browser extension or a native application.","description_excerpt":"A directory of all extensions \u0026amp; integrations for Discourse which are not Discourse plugins, i.e. a CMS plugin, a browser extension or a native application.","topic_url":"/t/about-the-extras-category/28","read_restricted":false,"permission":null,"parent_category_id":22,"notification_level":1,"topic_template":"","has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":["Resource Status"],"allow_global_tags":true,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":61,"name":"theme","color":"E43D30","text_color":"FFFFFF","slug":"theme","topic_count":66,"post_count":2138,"position":22,"description":"Themes are expansive customizations that change multiple elements of the style of your forum design, and often also include additional front-end features.","description_text":"Themes are expansive customizations that change multiple elements of the style of your forum design, and often also include additional front-end features.","description_excerpt":"Themes are expansive customizations that change multiple elements of the style of your forum design, and often also include additional front-end features.","topic_url":"/t/about-the-theme-category/60925","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"||||\n|-|-|-|\n| :information_source: | **Summary** | ADD SHORT SUMMARY \n| :eyeglasses:|**Preview**| PREVIEW_LINK |\n| :hammer_and_wrench:|**Repository**| REPOSITORY_LINK |\n| :question:|**Install Guide**|[How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682)|\n| :open_book:|**New to Discourse Themes?**| [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966)\n\n\u003c!-- Describe this theme in one or two sentences --\u003e\n\nShort description...\n\n\u003c!-- Add screenshots (if applicable) --\u003e\n\nScreenshots...\n\n\u003c!-- Add more details and explain the settings (if applicable) --\u003e\n\nDetailed description...\n","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"none","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":["color-palette"],"allowed_tag_groups":["Resource Status"],"allow_global_tags":true,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":120,"name":"theme-component","color":"1dedf8","text_color":"FFFFFF","slug":"theme-component","topic_count":300,"post_count":7516,"position":23,"description":"Theme components are customizations that change surface elements of your forum design, or add extra front-end features.","description_text":"Theme components are customizations that change surface elements of your forum design, or add extra front-end features.","description_excerpt":"Theme components are customizations that change surface elements of your forum design, or add extra front-end features.","topic_url":"/t/about-the-theme-component-category/232731","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"| | | |\n| - | - | - |\n| :information_source: | **Summary** | ADD SHORT SUMMARY |\n| :eyeglasses: |**Preview**| PREVIEW_LINK |\n| :hammer_and_wrench: | **Repository**| REPOSITORY_LINK |\n| :question: | **Install Guide** | [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |\n| :open_book: | **New to Discourse Themes?** | [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |\n\n\u003c!-- Fill in \"repoName\" and \"repoURL\" for the automatic install button --\u003e\n\n[wrap=theme-install-button repoName=\"Component's name\" repoUrl=\"GitHub repository link\"]\nInstall this theme component\n[/wrap]\n\n\u003c!-- Describe this theme/component in one or two sentences --\u003e\n\nShort description...\n\n\u003c!-- Add screenshots (if applicable) --\u003e\n\nScreenshots...\n\n\u003c!-- Add more details and explain the settings (if applicable) --\u003e\n\nDetailed description...","has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"none","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":["Resource Status"],"allow_global_tags":true,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":31,"name":"installation","color":"997E7E","text_color":"FFFFFF","slug":"installation","topic_count":3426,"post_count":29611,"position":24,"description":"Getting Discourse up and running, keeping it going, upgrading, and any other general sysadmin maintenance.","description_text":"Getting Discourse up and running, keeping it going, upgrading, and any other general sysadmin maintenance.","description_excerpt":"Getting Discourse up and running, keeping it going, upgrading, and any other general sysadmin maintenance.","topic_url":"/t/about-the-installation-category/21019","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":106,"name":"migration","color":"652D90","text_color":"FFFFFF","slug":"migration","topic_count":215,"post_count":1558,"position":25,"description":"You want to migrate your community to Discourse? Awesome! This is the category where you can ask questions, get help, and document your Discourse migration journey.","description_text":"You want to migrate your community to Discourse? Awesome! This is the category where you can ask questions, get help, and document your Discourse migration journey.","description_excerpt":"You want to migrate your community to Discourse? Awesome! This is the category where you can ask questions, get help, and document your Discourse migration journey.","topic_url":"/t/about-the-migration-category/196969","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":"true","activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":["Migration"],"allow_global_tags":true,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":8,"name":"hosting","color":"00AEEF","text_color":"FFFFFF","slug":"hosting","topic_count":501,"post_count":4117,"position":26,"description":"Topics about hosting Discourse, either on your own servers, in the cloud, or with specific hosting services.","description_text":"Topics about hosting Discourse, either on your own servers, in the cloud, or with specific hosting services.","description_excerpt":"Topics about hosting Discourse, either on your own servers, in the cloud, or with specific hosting services.","topic_url":"/t/about-the-hosting-category/2626","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post","enable_accepted_answers":"true"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":30,"name":"releases","color":"BF1E2E","text_color":"FFFFFF","slug":"releases","topic_count":23,"post_count":104,"position":27,"description":"Outlining each official release of Discourse, and plans for future releases.","description_text":"Outlining each official release of Discourse, and plans for future releases.","description_excerpt":"Outlining each official release of Discourse, and plans for future releases.","topic_url":"/t/about-the-releases-category/20857","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"created","sort_ascending":false,"show_subcategory_list":true,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":3,"name":"site feedback","color":"888","text_color":"FFFFFF","slug":"site-feedback","topic_count":417,"post_count":3220,"position":28,"description":"Discussion about \u003ca href=\"http://meta.discourse.org\"\u003emeta.discourse.org\u003c/a\u003e itself - the organization of this forum, how it works, and how we can improve this site.","description_text":"Discussion about meta.discourse.org itself - the organization of this forum, how it works, and how we can improve this site.","description_excerpt":"Discussion about \u003ca href=\"http://meta.discourse.org\"\u003emeta.discourse.org\u003c/a\u003e itself - the organization of this forum, how it works, and how we can improve this site.","topic_url":"/t/about-the-site-feedback-category/24","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":true,"sort_order":"","sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":152,"name":"theme feedback","color":"ED207B","text_color":"FFFFFF","slug":"theme-feedback","topic_count":11,"post_count":44,"position":29,"description":"This is the category to gather all the UX reports for \u003ca href=\"https://meta.discourse.org/t/we-have-a-new-default-theme-here-on-meta/284692\"\u003eour new theme on meta\u003c/a\u003e. It also uses the new Form Templates feature that I’ve been wanting to try out.","description_text":"This is the category to gather all the UX reports for our new theme on meta. It also uses the new Form Templates feature that I’ve been wanting to try out.","description_excerpt":"This is the category to gather all the UX reports for \u003ca href=\"https://meta.discourse.org/t/we-have-a-new-default-theme-here-on-meta/284692\"\u003eour new theme on meta\u003c/a\u003e. It also uses the new Form Templates feature that I’ve been wanting to try out.","topic_url":"/t/about-the-theme-feedback-category/284904","read_restricted":false,"permission":null,"parent_category_id":3,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[1],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":157,"name":"forum summaries","color":"72e9a7","text_color":"FFFFFF","slug":"forum-summaries","topic_count":4,"post_count":36,"position":30,"description":"Stay up-to-date with the pulse of our community through AI-crafted summaries. This category harnesses the power of artificial intelligence to collate and condense forum activities, providing you with comprehensive yet succinct overviews. From emerging discussions to trending topics, our AI summaries deliver the essence of the Discourse community’s heartbeat, right at your fingertips.","description_text":"Stay up-to-date with the pulse of our community through AI-crafted summaries. This category harnesses the power of artificial intelligence to collate and condense forum activities, providing you with comprehensive yet succinct overviews. From emerging discussions to trending topics, our AI summaries deliver the essence of the Discourse community’s heartbeat, right at your fingertips.","description_excerpt":"Stay up-to-date with the pulse of our community through AI-crafted summaries. This category harnesses the power of artificial intelligence to collate and condense forum activities, providing you with comprehensive yet succinct overviews. From emerging discussions to trending topics, our AI summarie\u0026hellip;","topic_url":"/t/about-the-forum-summaries-category/291765","read_restricted":false,"permission":null,"parent_category_id":3,"notification_level":0,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":35,"name":"praise","color":"9EB83B","text_color":"FFFFFF","slug":"praise","topic_count":294,"post_count":1091,"position":31,"description":"Have something nice to say about Discourse?","description_text":"Have something nice to say about Discourse?","description_excerpt":"Have something nice to say about Discourse?","topic_url":"/t/about-the-praise-category/30010","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":true,"sort_order":null,"sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":63,"name":"comparison","color":"F1592A","text_color":"FFFFFF","slug":"comparison","topic_count":11,"post_count":137,"position":32,"description":"Topics comparing Discourse to other platforms.","description_text":"Topics comparing Discourse to other platforms.","description_excerpt":"Topics comparing Discourse to other platforms.","topic_url":"/t/about-the-comparison-category/65736","read_restricted":false,"permission":null,"parent_category_id":35,"notification_level":1,"topic_template":"### About PLATFORM_NAME\n\nA blurb about the platform being compared to Discourse. \n\nhttp://link.to.website\n\n ### Previous discussions:\n\nlinks to previous discussions related\n\n### Importer status\n\nIs there an official Discourse importer? Where is it? ","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"latest","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":105,"name":"community support program","color":"92278F","text_color":"FFFFFF","slug":"support-program","topic_count":4,"post_count":27,"position":33,"description":"Get recognition for your work in helping and supporting Discourse communities by joining our Community Support Program.","description_text":"Get recognition for your work in helping and supporting Discourse communities by joining our Community Support Program.","description_excerpt":"Get recognition for your work in helping and supporting Discourse communities by joining our Community Support Program.","topic_url":"/t/about-the-community-support-program-category/193906","read_restricted":false,"permission":null,"notification_level":1,"topic_template":"","has_children":false,"sort_order":"","sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":"","subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":true,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":"","form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":124,"name":"General","color":"25AAE2","text_color":"FFFFFF","slug":"general","topic_count":155,"post_count":1408,"position":35,"description":"Create topics here that don’t fit into any other existing category.","description_text":"Create topics here that don’t fit into any other existing category.","description_excerpt":"Create topics here that don’t fit into any other existing category.","topic_url":"/t/about-the-general-category/237517","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":false,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows_with_featured_topics","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"enable_unassigned_filter":null,"enable_accepted_answers":null,"activity_pub_default_visibility":"public","activity_pub_post_object_type":"Note","activity_pub_publication_type":"first_post"},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false},{"id":17,"name":"Uncategorized","color":"AB9364","text_color":"FFFFFF","slug":"uncategorized","topic_count":0,"post_count":0,"position":77,"description":"Topics that don't need a category, or don't fit into any other existing category.","description_text":"Topics that don't need a category, or don't fit into any other existing category.","description_excerpt":"Topics that don't need a category, or don't fit into any other existing category.","topic_url":"/t/","read_restricted":false,"permission":null,"notification_level":1,"topic_template":null,"has_children":false,"sort_order":null,"sort_ascending":null,"show_subcategory_list":true,"num_featured_topics":3,"default_view":null,"subcategory_list_style":"rows","default_top_period":"all","default_list_filter":"all","minimum_required_tags":0,"navigate_to_first_post_after_read":false,"custom_fields":{"has_chat_enabled":null,"activity_pub_enabled":null,"activity_pub_ready":null,"activity_pub_username":null,"activity_pub_name":null,"activity_pub_default_visibility":null,"activity_pub_publication_type":null,"activity_pub_post_object_type":null,"enable_unassigned_filter":null,"enable_accepted_answers":null},"allowed_tags":[],"allowed_tag_groups":[],"allow_global_tags":false,"read_only_banner":null,"form_template_ids":[],"activity_pub_enabled":false,"uploaded_logo":null,"uploaded_logo_dark":null,"uploaded_background":null,"uploaded_background_dark":null,"required_tag_groups":[],"can_edit":false}],"markdown_additional_options":{"chat":{"limited_pretty_text_features":["anchor","bbcode-block","bbcode-inline","code","category-hashtag","censored","chat-transcript","discourse-local-dates","emoji","emojiShortcuts","inlineEmoji","html-img","hashtag-autocomplete","mentions","unicodeUsernames","onebox","quotes","spoiler-alert","table","text-post-process","upload-protocol","watched-words"],"limited_pretty_text_markdown_rules":["autolink","list","backticks","newline","code","fence","image","table","linkify","link","strikethrough","blockquote","emphasis","replacements"],"hashtag_configurations":{"topic-composer":["category","tag","channel"],"chat-composer":["channel","category","tag"]}}},"hashtag_configurations":{"topic-composer":["category","tag","channel"],"chat-composer":["channel","category","tag"]},"hashtag_icons":{"category":"folder","tag":"tag","channel":"comment"},"displayed_about_plugin_stat_groups":["chat_messages"],"anonymous_default_navigation_menu_tags":[{"name":"official","description":"This is a theme or plugin built by the Discourse team","pm_only":false},{"name":"release-notes","description":"Release notes for Discourse beta and stable branches. See https://meta.discourse.org/t/198215 for more details on the Discourse release process.","pm_only":false}],"anonymous_sidebar_sections":[{"id":56,"title":"Community","links":[{"id":274,"name":"Topics","value":"/latest","icon":"layer-group","external":false,"full_reload":false,"segment":"primary"},{"id":275,"name":"My Posts","value":"/my/activity","icon":"user","external":false,"full_reload":true,"segment":"primary"},{"id":276,"name":"Review","value":"/review","icon":"flag","external":false,"full_reload":false,"segment":"primary"},{"id":277,"name":"Admin","value":"/admin","icon":"wrench","external":false,"full_reload":false,"segment":"primary"},{"id":279,"name":"Users","value":"/u","icon":"users","external":false,"full_reload":false,"segment":"secondary"},{"id":280,"name":"About","value":"/about","icon":"info-circle","external":false,"full_reload":false,"segment":"secondary"},{"id":281,"name":"FAQ","value":"/faq","icon":"question-circle","external":false,"full_reload":false,"segment":"secondary"},{"id":282,"name":"Groups","value":"/g","icon":"user-friends","external":false,"full_reload":false,"segment":"secondary"},{"id":283,"name":"Badges","value":"/badges","icon":"certificate","external":false,"full_reload":false,"segment":"secondary"},{"id":287,"name":"Leaderboard","value":"/leaderboard/7","icon":"trophy","external":false,"full_reload":false,"segment":"secondary"},{"id":290,"name":"Global Leaderboard","value":"/leaderboard","icon":"trophy","external":false,"full_reload":false,"segment":"secondary"},{"id":291,"name":"Topic Filter","value":"/filter","icon":"filter","external":false,"full_reload":false,"segment":"secondary"}],"slug":"community","public":true,"section_type":"community"}],"tos_url":"/tos","privacy_policy_url":"https://www.discourse.org/privacy","activity_pub_enabled":true,"activity_pub_publishing_enabled":true,"activity_pub_host":"meta.discourse.org","docs_path":"docs","default_gamification_leaderboard_id":1,"hosting_tier":"enterprise","archetypes":[{"id":"regular","name":"Regular Topic","options":[]},{"id":"banner","name":"Banner Topic","options":[]}],"user_fields":[{"id":2,"name":"Pronouns","description":"Gender Pronouns (he/him, she/her, they/them, etc.)","field_type":"text","editable":true,"required":false,"show_on_profile":true,"show_on_user_card":true,"searchable":false,"position":1}],"auth_providers":[{"name":"facebook","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":580,"frame_height":400,"can_connect":true,"can_revoke":true,"icon":"fab-facebook"},{"name":"google_oauth2","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":850,"frame_height":500,"can_connect":true,"can_revoke":true,"icon":null},{"name":"github","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":null,"frame_height":null,"can_connect":true,"can_revoke":true,"icon":"fab-github"},{"name":"twitter","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":null,"frame_height":null,"can_connect":true,"can_revoke":true,"icon":"fab-twitter"},{"name":"discord","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":null,"frame_height":null,"can_connect":true,"can_revoke":true,"icon":"fab-discord"},{"name":"apple","custom_url":null,"pretty_name_override":null,"title_override":null,"frame_width":null,"frame_height":null,"can_connect":true,"can_revoke":true,"icon":"fab-apple"}]}
\ No newline at end of file
diff --git a/plugins/discourse-ai/spec/jobs/regular/digest_rag_upload_spec.rb b/plugins/discourse-ai/spec/jobs/regular/digest_rag_upload_spec.rb
index 9f08fde9b1d..9bad02e2ce0 100644
--- a/plugins/discourse-ai/spec/jobs/regular/digest_rag_upload_spec.rb
+++ b/plugins/discourse-ai/spec/jobs/regular/digest_rag_upload_spec.rb
@@ -3,7 +3,7 @@
RSpec.describe Jobs::DigestRagUpload do
subject(:job) { described_class.new }
- fab!(:persona, :ai_persona)
+ fab!(:agent, :ai_agent)
fab!(:upload) { Fabricate(:upload, extension: "txt") }
fab!(:image_upload) { Fabricate(:upload, extension: "png") }
let(:document_file) { StringIO.new("some text" * 200) }
@@ -42,8 +42,8 @@ RSpec.describe Jobs::DigestRagUpload do
expect {
described_class.new.execute(
upload_id: image_upload.id,
- target_id: persona.id,
- target_type: persona.class.to_s,
+ target_id: agent.id,
+ target_type: agent.class.to_s,
)
}.to raise_error(Discourse::InvalidAccess)
end
@@ -51,12 +51,12 @@ RSpec.describe Jobs::DigestRagUpload do
context "when processing an upload containing metadata" do
it "correctly splits on metadata boundary" do
# be explicit here about chunking strategy
- persona.update!(rag_chunk_tokens: 100, rag_chunk_overlap_tokens: 10)
+ agent.update!(rag_chunk_tokens: 100, rag_chunk_overlap_tokens: 10)
described_class.new.execute(
upload_id: upload_with_metadata.id,
- target_id: persona.id,
- target_type: persona.class.to_s,
+ target_id: agent.id,
+ target_type: agent.class.to_s,
)
parsed = +""
@@ -82,7 +82,7 @@ RSpec.describe Jobs::DigestRagUpload do
before { File.expects(:open).returns(document_file) }
it "splits an upload into chunks" do
- job.execute(upload_id: upload.id, target_id: persona.id, target_type: persona.class.to_s)
+ job.execute(upload_id: upload.id, target_id: agent.id, target_type: agent.class.to_s)
created_fragment = RagDocumentFragment.last
@@ -93,18 +93,18 @@ RSpec.describe Jobs::DigestRagUpload do
it "queue jobs to generate embeddings for each fragment" do
expect {
- job.execute(upload_id: upload.id, target_id: persona.id, target_type: persona.class.to_s)
+ job.execute(upload_id: upload.id, target_id: agent.id, target_type: agent.class.to_s)
}.to change(Jobs::GenerateRagEmbeddings.jobs, :size).by(1)
end
end
it "doesn't generate new fragments if we already processed the upload" do
- Fabricate(:rag_document_fragment, upload: upload, target: persona)
+ Fabricate(:rag_document_fragment, upload: upload, target: agent)
- previous_count = RagDocumentFragment.where(upload: upload, target: persona).count
+ previous_count = RagDocumentFragment.where(upload: upload, target: agent).count
- job.execute(upload_id: upload.id, target_id: persona.id, target_type: persona.class.to_s)
- updated_count = RagDocumentFragment.where(upload: upload, target: persona).count
+ job.execute(upload_id: upload.id, target_id: agent.id, target_type: agent.class.to_s)
+ updated_count = RagDocumentFragment.where(upload: upload, target: agent).count
expect(updated_count).to eq(previous_count)
end
diff --git a/plugins/discourse-ai/spec/jobs/regular/generate_rag_embeddings_spec.rb b/plugins/discourse-ai/spec/jobs/regular/generate_rag_embeddings_spec.rb
index 2c5fdd9fd2c..be58cfddefa 100644
--- a/plugins/discourse-ai/spec/jobs/regular/generate_rag_embeddings_spec.rb
+++ b/plugins/discourse-ai/spec/jobs/regular/generate_rag_embeddings_spec.rb
@@ -10,10 +10,10 @@ RSpec.describe Jobs::GenerateRagEmbeddings do
let(:expected_embedding) { [0.0038493] * vector_def.dimensions }
- fab!(:ai_persona)
+ fab!(:ai_agent)
- let(:rag_document_fragment_1) { Fabricate(:rag_document_fragment, target: ai_persona) }
- let(:rag_document_fragment_2) { Fabricate(:rag_document_fragment, target: ai_persona) }
+ let(:rag_document_fragment_1) { Fabricate(:rag_document_fragment, target: ai_agent) }
+ let(:rag_document_fragment_2) { Fabricate(:rag_document_fragment, target: ai_agent) }
before do
SiteSetting.ai_embeddings_selected_model = vector_def.id
diff --git a/plugins/discourse-ai/spec/jobs/regular/localize_posts_spec.rb b/plugins/discourse-ai/spec/jobs/regular/localize_posts_spec.rb
index b7dab83e1ae..11769e16547 100644
--- a/plugins/discourse-ai/spec/jobs/regular/localize_posts_spec.rb
+++ b/plugins/discourse-ai/spec/jobs/regular/localize_posts_spec.rb
@@ -326,7 +326,7 @@ describe Jobs::LocalizePosts do
# Should call LlmModel.find_by only twice for the entire batch:
# 1. Once in credits_available_for_post_localization? check
- # 2. Once in the job's find_llm_model_for_persona for caching
+ # 2. Once in the job's find_llm_model_for_agent for caching
# Without caching, it would be called 2 + (number of posts) times
expect(find_by_call_count).to eq(2)
end
diff --git a/plugins/discourse-ai/spec/jobs/regular/stream_discord_reply_spec.rb b/plugins/discourse-ai/spec/jobs/regular/stream_discord_reply_spec.rb
index e6e0d51ed19..48b1cd48ada 100644
--- a/plugins/discourse-ai/spec/jobs/regular/stream_discord_reply_spec.rb
+++ b/plugins/discourse-ai/spec/jobs/regular/stream_discord_reply_spec.rb
@@ -12,23 +12,21 @@ RSpec.describe Jobs::StreamDiscordReply, type: :job do
end
fab!(:llm_model)
- fab!(:persona) { Fabricate(:ai_persona, default_llm_id: llm_model.id) }
+ fab!(:agent) { Fabricate(:ai_agent, default_llm_id: llm_model.id) }
before do
enable_current_plugin
SiteSetting.ai_discord_search_enabled = true
- SiteSetting.ai_discord_search_mode = "persona"
- SiteSetting.ai_discord_search_persona = persona.id
+ SiteSetting.ai_discord_search_mode = "agent"
+ SiteSetting.ai_discord_search_agent = agent.id
end
- it "calls PersonaReplier when search mode is persona" do
- expect_any_instance_of(DiscourseAi::Discord::Bot::PersonaReplier).to receive(
- :handle_interaction!,
- )
+ it "calls AgentReplier when search mode is agent" do
+ expect_any_instance_of(DiscourseAi::Discord::Bot::AgentReplier).to receive(:handle_interaction!)
described_class.new.execute(interaction: interaction)
end
- it "calls Search when search mode is not persona" do
+ it "calls Search when search mode is not agent" do
SiteSetting.ai_discord_search_mode = "search"
expect_any_instance_of(DiscourseAi::Discord::Bot::Search).to receive(:handle_interaction!)
described_class.new.execute(interaction: interaction)
diff --git a/plugins/discourse-ai/spec/jobs/regular/stream_discover_reply_spec.rb b/plugins/discourse-ai/spec/jobs/regular/stream_discover_reply_spec.rb
index 49cade68a2c..7da70697fab 100644
--- a/plugins/discourse-ai/spec/jobs/regular/stream_discover_reply_spec.rb
+++ b/plugins/discourse-ai/spec/jobs/regular/stream_discover_reply_spec.rb
@@ -9,13 +9,13 @@ RSpec.describe Jobs::StreamDiscoverReply do
fab!(:user)
fab!(:llm_model)
fab!(:group)
- fab!(:ai_persona) do
- Fabricate(:ai_persona, allowed_group_ids: [group.id], default_llm_id: llm_model.id)
+ fab!(:ai_agent) do
+ Fabricate(:ai_agent, allowed_group_ids: [group.id], default_llm_id: llm_model.id)
end
before do
SiteSetting.ai_discover_enabled = true
- SiteSetting.ai_discover_persona = ai_persona.id
+ SiteSetting.ai_discover_agent = ai_agent.id
group.add(user)
end
@@ -56,7 +56,7 @@ RSpec.describe Jobs::StreamDiscoverReply do
with_responses(["dummy"]) do
# Spy on BotContext creation to verify user is passed
context_spy = nil
- allow(DiscourseAi::Personas::BotContext).to receive(
+ allow(DiscourseAi::Agents::BotContext).to receive(
:new,
).and_wrap_original do |method, **args|
context_spy = args
diff --git a/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rb b/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rb
index edc54e49168..9b7c03df892 100644
--- a/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rb
+++ b/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rb
@@ -8,8 +8,8 @@ describe Jobs::PostsLocaleDetectionBackfill do
before do
fake_llm = assign_fake_provider_to(:ai_default_llm_model)
- # Update the locale detector persona (ID -27) with the fake LLM
- locale_detector = AiPersona.find_by(id: -27)
+ # Update the locale detector agent (ID -27) with the fake LLM
+ locale_detector = AiAgent.find_by(id: -27)
locale_detector.update!(default_llm_id: fake_llm.id) if locale_detector
enable_current_plugin
diff --git a/plugins/discourse-ai/spec/jobs/scheduled/tag_localization_backfill_spec.rb b/plugins/discourse-ai/spec/jobs/scheduled/tag_localization_backfill_spec.rb
index c25e63db899..ae48ec5ec27 100644
--- a/plugins/discourse-ai/spec/jobs/scheduled/tag_localization_backfill_spec.rb
+++ b/plugins/discourse-ai/spec/jobs/scheduled/tag_localization_backfill_spec.rb
@@ -42,9 +42,9 @@ describe Jobs::TagLocalizationBackfill do
it "does not enqueue when credits are unavailable" do
llm_model = Fabricate(:llm_model)
- short_text_persona = Fabricate(:ai_persona)
- short_text_persona.update!(default_llm_id: llm_model.id)
- SiteSetting.ai_translation_short_text_translator_persona = short_text_persona.id
+ short_text_agent = Fabricate(:ai_agent)
+ short_text_agent.update!(default_llm_id: llm_model.id)
+ SiteSetting.ai_translation_short_text_translator_agent = short_text_agent.id
LlmCreditAllocation.stubs(:credits_available?).with(llm_model).returns(false)
diff --git a/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rb b/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rb
index fadc228744f..0dce0daf8a6 100644
--- a/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rb
+++ b/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rb
@@ -8,8 +8,8 @@ describe Jobs::TopicsLocaleDetectionBackfill do
before do
fake_llm = assign_fake_provider_to(:ai_default_llm_model)
- # Update the locale detector persona (ID -27) with the fake LLM
- locale_detector = AiPersona.find_by(id: -27)
+ # Update the locale detector agent (ID -27) with the fake LLM
+ locale_detector = AiAgent.find_by(id: -27)
locale_detector.update!(default_llm_id: fake_llm.id) if locale_detector
enable_current_plugin
diff --git a/plugins/discourse-ai/spec/lib/personas/persona_spec.rb b/plugins/discourse-ai/spec/lib/agents/agent_spec.rb
similarity index 62%
rename from plugins/discourse-ai/spec/lib/personas/persona_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/agent_spec.rb
index 55da39b16e4..11ec95ffc06 100644
--- a/plugins/discourse-ai/spec/lib/personas/persona_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/agent_spec.rb
@@ -1,11 +1,11 @@
#frozen_string_literal: true
-class TestPersona < DiscourseAi::Personas::Persona
+class TestAgent < DiscourseAi::Agents::Agent
def tools
[
- DiscourseAi::Personas::Tools::ListTags,
- DiscourseAi::Personas::Tools::Search,
- DiscourseAi::Personas::Tools::Image,
+ DiscourseAi::Agents::Tools::ListTags,
+ DiscourseAi::Agents::Tools::Search,
+ DiscourseAi::Agents::Tools::Image,
]
end
@@ -23,8 +23,8 @@ class TestPersona < DiscourseAi::Personas::Persona
end
end
-RSpec.describe DiscourseAi::Personas::Persona do
- let(:persona) { TestPersona.new }
+RSpec.describe DiscourseAi::Agents::Agent do
+ let(:agent) { TestAgent.new }
let(:topic_with_users) do
topic = Topic.new
@@ -36,7 +36,7 @@ RSpec.describe DiscourseAi::Personas::Persona do
let(:inferred_concepts) { %w[bulbassaur charmander squirtle].join(", ") }
let(:context) do
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
site_url: Discourse.base_url,
site_title: "test site title",
site_description: "test site description",
@@ -55,13 +55,13 @@ RSpec.describe DiscourseAi::Personas::Persona do
after do
# we are rolling back transactions so we can create poison cache
- AiPersona.persona_cache.flush!
+ AiAgent.agent_cache.flush!
end
it "renders the system prompt" do
freeze_time
- rendered = persona.craft_prompt(context)
+ rendered = agent.craft_prompt(context)
system_message = rendered.messages.first[:content]
expect(system_message).to include(Discourse.base_url)
@@ -92,7 +92,7 @@ RSpec.describe DiscourseAi::Personas::Persona do
)
tool_instance =
- DiscourseAi::Personas::General.new.find_tool(tool_call, bot_user: nil, llm: nil, context: nil)
+ DiscourseAi::Agents::General.new.find_tool(tool_call, bot_user: nil, llm: nil, context: nil)
expect(tool_instance.parameters[:search_query]).to eq("quoted search term")
end
@@ -110,7 +110,7 @@ RSpec.describe DiscourseAi::Personas::Persona do
)
tool_instance =
- DiscourseAi::Personas::General.new.find_tool(tool_call, bot_user: nil, llm: nil, context: nil)
+ DiscourseAi::Agents::General.new.find_tool(tool_call, bot_user: nil, llm: nil, context: nil)
expect(tool_instance.parameters.key?(:status)).to eq(false)
@@ -126,7 +126,7 @@ RSpec.describe DiscourseAi::Personas::Persona do
)
tool_instance =
- DiscourseAi::Personas::General.new.find_tool(tool_call, bot_user: nil, llm: nil, context: nil)
+ DiscourseAi::Agents::General.new.find_tool(tool_call, bot_user: nil, llm: nil, context: nil)
expect(tool_instance.parameters[:status]).to eq("open")
end
@@ -144,20 +144,20 @@ RSpec.describe DiscourseAi::Personas::Persona do
)
search =
- DiscourseAi::Personas::General.new.find_tool(tool_call, bot_user: nil, llm: nil, context: nil)
+ DiscourseAi::Agents::General.new.find_tool(tool_call, bot_user: nil, llm: nil, context: nil)
expect(search.parameters[:max_posts]).to eq(3)
expect(search.parameters[:search_query]).to eq("hello world")
expect(search.parameters.key?(:foo)).to eq(false)
end
- describe "custom personas" do
- it "is able to find custom personas" do
+ describe "custom agents" do
+ it "is able to find custom agents" do
Group.refresh_automatic_groups!
- # define an ai persona everyone can see
- persona =
- AiPersona.create!(
+ # define an ai agent everyone can see
+ agent =
+ AiAgent.create!(
name: "zzzpun_bot",
description: "you write puns",
system_prompt: "you are pun bot",
@@ -165,122 +165,122 @@ RSpec.describe DiscourseAi::Personas::Persona do
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
)
- custom_persona = DiscourseAi::Personas::Persona.all(user: user).last
- expect(custom_persona.name).to eq("zzzpun_bot")
- expect(custom_persona.description).to eq("you write puns")
+ custom_agent = DiscourseAi::Agents::Agent.all(user: user).last
+ expect(custom_agent.name).to eq("zzzpun_bot")
+ expect(custom_agent.description).to eq("you write puns")
- instance = custom_persona.new
- expect(instance.tools).to eq([DiscourseAi::Personas::Tools::Image])
+ instance = custom_agent.new
+ expect(instance.tools).to eq([DiscourseAi::Agents::Tools::Image])
expect(instance.craft_prompt(context).messages.first[:content]).to eq("you are pun bot")
# should update
- persona.update!(name: "zzzpun_bot2")
- custom_persona = DiscourseAi::Personas::Persona.all(user: user).last
- expect(custom_persona.name).to eq("zzzpun_bot2")
+ agent.update!(name: "zzzpun_bot2")
+ custom_agent = DiscourseAi::Agents::Agent.all(user: user).last
+ expect(custom_agent.name).to eq("zzzpun_bot2")
# can be disabled
- persona.update!(enabled: false)
- last_persona = DiscourseAi::Personas::Persona.all(user: user).last
- expect(last_persona.name).not_to eq("zzzpun_bot2")
+ agent.update!(enabled: false)
+ last_agent = DiscourseAi::Agents::Agent.all(user: user).last
+ expect(last_agent.name).not_to eq("zzzpun_bot2")
- persona.update!(enabled: true)
+ agent.update!(enabled: true)
# no groups have access
- persona.update!(allowed_group_ids: [])
+ agent.update!(allowed_group_ids: [])
- last_persona = DiscourseAi::Personas::Persona.all(user: user).last
- expect(last_persona.name).not_to eq("zzzpun_bot2")
+ last_agent = DiscourseAi::Agents::Agent.all(user: user).last
+ expect(last_agent.name).not_to eq("zzzpun_bot2")
end
end
- describe "available personas" do
- it "includes all personas by default" do
+ describe "available agents" do
+ it "includes all agents by default" do
Group.refresh_automatic_groups!
SiteSetting.ai_google_custom_search_api_key = "abc"
SiteSetting.ai_google_custom_search_cx = "abc123"
- # Note: Artist and Designer personas require custom image generation tools
+ # Note: Artist and Designer agents require custom image generation tools
# configured via AiTool. Testing them would require creating tools within
# the test transaction, which causes query isolation issues. They are tested
# separately in their respective tool specs.
- # Filter to only system personas with specific classes (reject base Persona class)
- personas =
- DiscourseAi::Personas::Persona
+ # Filter to only system agents with specific classes (reject base Agent class)
+ agents =
+ DiscourseAi::Agents::Agent
.all(user: user)
.select(&:system)
.map(&:superclass)
- .reject { |klass| klass == DiscourseAi::Personas::Persona }
- expect(personas).to include(
- DiscourseAi::Personas::General,
- DiscourseAi::Personas::Creative,
- DiscourseAi::Personas::DiscourseHelper,
- DiscourseAi::Personas::Discover,
- DiscourseAi::Personas::GithubHelper,
- DiscourseAi::Personas::Researcher,
- DiscourseAi::Personas::SettingsExplorer,
- DiscourseAi::Personas::SqlHelper,
+ .reject { |klass| klass == DiscourseAi::Agents::Agent }
+ expect(agents).to include(
+ DiscourseAi::Agents::General,
+ DiscourseAi::Agents::Creative,
+ DiscourseAi::Agents::DiscourseHelper,
+ DiscourseAi::Agents::Discover,
+ DiscourseAi::Agents::GithubHelper,
+ DiscourseAi::Agents::Researcher,
+ DiscourseAi::Agents::SettingsExplorer,
+ DiscourseAi::Agents::SqlHelper,
)
# it should allow staff access to WebArtifactCreator
- admin_personas =
- DiscourseAi::Personas::Persona
+ admin_agents =
+ DiscourseAi::Agents::Agent
.all(user: admin)
.select(&:system)
.map(&:superclass)
- .reject { |klass| klass == DiscourseAi::Personas::Persona }
- expect(admin_personas).to include(
- DiscourseAi::Personas::General,
- DiscourseAi::Personas::Creative,
- DiscourseAi::Personas::DiscourseHelper,
- DiscourseAi::Personas::Discover,
- DiscourseAi::Personas::GithubHelper,
- DiscourseAi::Personas::Researcher,
- DiscourseAi::Personas::SettingsExplorer,
- DiscourseAi::Personas::SqlHelper,
- DiscourseAi::Personas::WebArtifactCreator,
+ .reject { |klass| klass == DiscourseAi::Agents::Agent }
+ expect(admin_agents).to include(
+ DiscourseAi::Agents::General,
+ DiscourseAi::Agents::Creative,
+ DiscourseAi::Agents::DiscourseHelper,
+ DiscourseAi::Agents::Discover,
+ DiscourseAi::Agents::GithubHelper,
+ DiscourseAi::Agents::Researcher,
+ DiscourseAi::Agents::SettingsExplorer,
+ DiscourseAi::Agents::SqlHelper,
+ DiscourseAi::Agents::WebArtifactCreator,
)
- # omits personas if key is missing
+ # omits agents if key is missing
SiteSetting.ai_google_custom_search_api_key = ""
SiteSetting.ai_artifact_security = "disabled"
- # Filter to only system personas with specific persona classes (not the base Persona class)
- # The base Persona class appears for personas that don't have required tools available
- system_persona_classes =
- DiscourseAi::Personas::Persona
+ # Filter to only system agents with specific agent classes (not the base Agent class)
+ # The base Agent class appears for agents that don't have required tools available
+ system_agent_classes =
+ DiscourseAi::Agents::Agent
.all(user: admin)
.select(&:system)
.map(&:superclass)
- .reject { |klass| klass == DiscourseAi::Personas::Persona }
-
- expect(system_persona_classes).to contain_exactly(
- DiscourseAi::Personas::General,
- DiscourseAi::Personas::SqlHelper,
- DiscourseAi::Personas::SettingsExplorer,
- DiscourseAi::Personas::Creative,
- DiscourseAi::Personas::DiscourseHelper,
- DiscourseAi::Personas::Discover,
- DiscourseAi::Personas::GithubHelper,
+ .reject { |klass| klass == DiscourseAi::Agents::Agent }
+
+ expect(system_agent_classes).to contain_exactly(
+ DiscourseAi::Agents::General,
+ DiscourseAi::Agents::SqlHelper,
+ DiscourseAi::Agents::SettingsExplorer,
+ DiscourseAi::Agents::Creative,
+ DiscourseAi::Agents::DiscourseHelper,
+ DiscourseAi::Agents::Discover,
+ DiscourseAi::Agents::GithubHelper,
)
- AiPersona.find(
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::General],
- ).update!(enabled: false)
+ AiAgent.find(DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::General]).update!(
+ enabled: false,
+ )
- system_persona_classes_after_disable =
- DiscourseAi::Personas::Persona
+ system_agent_classes_after_disable =
+ DiscourseAi::Agents::Agent
.all(user: user)
.select(&:system)
.map(&:superclass)
- .reject { |klass| klass == DiscourseAi::Personas::Persona }
-
- expect(system_persona_classes_after_disable).to contain_exactly(
- DiscourseAi::Personas::SqlHelper,
- DiscourseAi::Personas::SettingsExplorer,
- DiscourseAi::Personas::Creative,
- DiscourseAi::Personas::DiscourseHelper,
- DiscourseAi::Personas::Discover,
- DiscourseAi::Personas::GithubHelper,
+ .reject { |klass| klass == DiscourseAi::Agents::Agent }
+
+ expect(system_agent_classes_after_disable).to contain_exactly(
+ DiscourseAi::Agents::SqlHelper,
+ DiscourseAi::Agents::SettingsExplorer,
+ DiscourseAi::Agents::Creative,
+ DiscourseAi::Agents::DiscourseHelper,
+ DiscourseAi::Agents::Discover,
+ DiscourseAi::Agents::GithubHelper,
)
end
end
@@ -294,19 +294,19 @@ RSpec.describe DiscourseAi::Personas::Persona do
SiteSetting.ai_embeddings_enabled = true
end
- let(:ai_persona) { DiscourseAi::Personas::Persona.all(user: user).first.new }
+ let(:ai_agent) { DiscourseAi::Agents::Agent.all(user: user).first.new }
let(:with_cc) do
context.messages = [{ content: "Tell me the time", type: :user }]
context
end
- context "when a persona has no uploads" do
+ context "when a agent has no uploads" do
it "doesn't include RAG guidance" do
guidance_fragment =
"The following texts will give you additional guidance to elaborate a response."
- expect(ai_persona.craft_prompt(with_cc).messages.first[:content]).not_to include(
+ expect(ai_agent.craft_prompt(with_cc).messages.first[:content]).not_to include(
guidance_fragment,
)
end
@@ -317,9 +317,9 @@ RSpec.describe DiscourseAi::Personas::Persona do
fab!(:llm_model, :fake_model)
- fab!(:custom_ai_persona) do
+ fab!(:custom_ai_agent) do
Fabricate(
- :ai_persona,
+ :ai_agent,
name: "custom",
rag_conversation_chunks: 3,
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
@@ -331,12 +331,11 @@ RSpec.describe DiscourseAi::Personas::Persona do
context_embedding = vector_def.dimensions.times.map { rand(-1.0...1.0) }
EmbeddingsGenerationStubs.hugging_face_service(consolidated_question, context_embedding)
- UploadReference.ensure_exist!(target: custom_ai_persona, upload_ids: [upload.id])
+ UploadReference.ensure_exist!(target: custom_ai_agent, upload_ids: [upload.id])
end
it "will run the question consolidator" do
- custom_persona =
- DiscourseAi::Personas::Persona.find_by(id: custom_ai_persona.id, user: user).new
+ custom_agent = DiscourseAi::Agents::Agent.find_by(id: custom_ai_agent.id, user: user).new
# this means that we will consolidate
context.messages = [
@@ -346,7 +345,7 @@ RSpec.describe DiscourseAi::Personas::Persona do
]
DiscourseAi::Completions::Endpoints::Fake.with_fake_content(consolidated_question) do
- custom_persona.craft_prompt(context).messages.first[:content]
+ custom_agent.craft_prompt(context).messages.first[:content]
end
message =
@@ -365,8 +364,7 @@ RSpec.describe DiscourseAi::Personas::Persona do
end
it "the question consolidator works" do
- custom_persona =
- DiscourseAi::Personas::Persona.find_by(id: custom_ai_persona.id, user: user).new
+ custom_agent = DiscourseAi::Agents::Agent.find_by(id: custom_ai_agent.id, user: user).new
context.messages = [
{ content: "Tell me the time", type: :user },
@@ -375,7 +373,7 @@ RSpec.describe DiscourseAi::Personas::Persona do
]
DiscourseAi::Completions::Endpoints::Fake.with_fake_content(consolidated_question) do
- custom_persona.craft_prompt(context).messages.first[:content]
+ custom_agent.craft_prompt(context).messages.first[:content]
end
message =
@@ -389,11 +387,11 @@ RSpec.describe DiscourseAi::Personas::Persona do
end
end
- context "when a persona has RAG uploads" do
+ context "when a agent has RAG uploads" do
let(:embedding_value) { 0.04381 }
let(:prompt_cc_embeddings) { [embedding_value] * vector_def.dimensions }
- def stub_fragments(fragment_count, persona: ai_persona)
+ def stub_fragments(fragment_count, agent: ai_agent)
schema = DiscourseAi::Embeddings::Schema.for(RagDocumentFragment)
fragment_count.times do |i|
@@ -401,8 +399,8 @@ RSpec.describe DiscourseAi::Personas::Persona do
Fabricate(
:rag_document_fragment,
fragment: "fragment-n#{i}",
- target_id: persona.id,
- target_type: "AiPersona",
+ target_id: agent.id,
+ target_type: "AiAgent",
upload: upload,
)
@@ -414,8 +412,8 @@ RSpec.describe DiscourseAi::Personas::Persona do
end
before do
- stored_ai_persona = AiPersona.find(ai_persona.id)
- UploadReference.ensure_exist!(target: stored_ai_persona, upload_ids: [upload.id])
+ stored_ai_agent = AiAgent.find(ai_agent.id)
+ UploadReference.ensure_exist!(target: stored_ai_agent, upload_ids: [upload.id])
EmbeddingsGenerationStubs.hugging_face_service(
with_cc.messages.dig(0, :content),
@@ -423,26 +421,25 @@ RSpec.describe DiscourseAi::Personas::Persona do
)
end
- context "when persona allows for less fragments" do
+ context "when agent allows for less fragments" do
it "will only pick 3 fragments" do
- custom_ai_persona =
+ custom_ai_agent =
Fabricate(
- :ai_persona,
+ :ai_agent,
name: "custom",
rag_conversation_chunks: 3,
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
)
- stub_fragments(3, persona: custom_ai_persona)
+ stub_fragments(3, agent: custom_ai_agent)
- UploadReference.ensure_exist!(target: custom_ai_persona, upload_ids: [upload.id])
+ UploadReference.ensure_exist!(target: custom_ai_agent, upload_ids: [upload.id])
- custom_persona =
- DiscourseAi::Personas::Persona.find_by(id: custom_ai_persona.id, user: user).new
+ custom_agent = DiscourseAi::Agents::Agent.find_by(id: custom_ai_agent.id, user: user).new
- expect(custom_persona.class.rag_conversation_chunks).to eq(3)
+ expect(custom_agent.class.rag_conversation_chunks).to eq(3)
- crafted_system_prompt = custom_persona.craft_prompt(with_cc).messages.first[:content]
+ crafted_system_prompt = custom_agent.craft_prompt(with_cc).messages.first[:content]
expect(crafted_system_prompt).to include("fragment-n0")
expect(crafted_system_prompt).to include("fragment-n1")
@@ -468,7 +465,7 @@ RSpec.describe DiscourseAi::Personas::Persona do
body: JSON.dump(expected_reranked),
)
- crafted_system_prompt = ai_persona.craft_prompt(with_cc).messages.first[:content]
+ crafted_system_prompt = ai_agent.craft_prompt(with_cc).messages.first[:content]
expect(crafted_system_prompt).to include("fragment-n14")
expect(crafted_system_prompt).to include("fragment-n13")
@@ -481,7 +478,7 @@ RSpec.describe DiscourseAi::Personas::Persona do
before { stub_fragments(10) }
it "picks the first 10 candidates from the similarity search" do
- crafted_system_prompt = ai_persona.craft_prompt(with_cc).messages.first[:content]
+ crafted_system_prompt = ai_agent.craft_prompt(with_cc).messages.first[:content]
expect(crafted_system_prompt).to include("fragment-n0")
expect(crafted_system_prompt).to include("fragment-n1")
@@ -491,20 +488,19 @@ RSpec.describe DiscourseAi::Personas::Persona do
end
end
- context "when the persona has examples" do
- fab!(:examples_persona) do
+ context "when the agent has examples" do
+ fab!(:examples_agent) do
Fabricate(
- :ai_persona,
+ :ai_agent,
examples: [["User message", "assistant response"]],
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
)
end
it "includes them before the context messages" do
- custom_persona =
- DiscourseAi::Personas::Persona.find_by(id: examples_persona.id, user: user).new
+ custom_agent = DiscourseAi::Agents::Agent.find_by(id: examples_agent.id, user: user).new
- post_system_prompt_msgs = custom_persona.craft_prompt(with_cc).messages.last(3)
+ post_system_prompt_msgs = custom_agent.craft_prompt(with_cc).messages.last(3)
expect(post_system_prompt_msgs).to contain_exactly(
{ content: "User message", type: :user },
diff --git a/plugins/discourse-ai/spec/lib/personas/artifact_update_strategies/diff_spec.rb b/plugins/discourse-ai/spec/lib/agents/artifact_update_strategies/diff_spec.rb
similarity index 98%
rename from plugins/discourse-ai/spec/lib/personas/artifact_update_strategies/diff_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/artifact_update_strategies/diff_spec.rb
index 49a4a197158..b05be9afbde 100644
--- a/plugins/discourse-ai/spec/lib/personas/artifact_update_strategies/diff_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/artifact_update_strategies/diff_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::ArtifactUpdateStrategies::Diff do
+RSpec.describe DiscourseAi::Agents::ArtifactUpdateStrategies::Diff do
fab!(:user)
fab!(:post)
fab!(:artifact, :ai_artifact)
diff --git a/plugins/discourse-ai/spec/lib/personas/bot_spec.rb b/plugins/discourse-ai/spec/lib/agents/bot_spec.rb
similarity index 86%
rename from plugins/discourse-ai/spec/lib/personas/bot_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/bot_spec.rb
index 4542c4cd28f..c682014f420 100644
--- a/plugins/discourse-ai/spec/lib/personas/bot_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/bot_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Bot do
- subject(:bot) { described_class.as(bot_user, persona: DiscourseAi::Personas::General.new) }
+RSpec.describe DiscourseAi::Agents::Bot do
+ subject(:bot) { described_class.as(bot_user, agent: DiscourseAi::Agents::General.new) }
fab!(:admin)
fab!(:gpt_4) { Fabricate(:llm_model, name: "gpt-4") }
@@ -38,8 +38,8 @@ RSpec.describe DiscourseAi::Personas::Bot do
Group.refresh_automatic_groups!
bot_user = DiscourseAi::AiBot::EntryPoint.find_user_from_model(fake.name)
- AiPersona.create!(
- name: "TestPersona",
+ AiAgent.create!(
+ name: "TestAgent",
top_p: 0.5,
temperature: 0.4,
system_prompt: "test",
@@ -47,11 +47,11 @@ RSpec.describe DiscourseAi::Personas::Bot do
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
)
- personaClass = DiscourseAi::Personas::Persona.find_by(user: admin, name: "TestPersona")
+ agentClass = DiscourseAi::Agents::Agent.find_by(user: admin, name: "TestAgent")
- bot = described_class.as(bot_user, persona: personaClass.new)
+ bot = described_class.as(bot_user, agent: agentClass.new)
bot.reply(
- DiscourseAi::Personas::BotContext.new(messages: [{ type: :user, content: "test" }]),
+ DiscourseAi::Agents::BotContext.new(messages: [{ type: :user, content: "test" }]),
) { |_partial, _cancel, _placeholder| }
last_call = DiscourseAi::Completions::Endpoints::Fake.last_call
@@ -61,7 +61,7 @@ RSpec.describe DiscourseAi::Personas::Bot do
context "when using function chaining" do
it "yields a loading placeholder while proceeds to invoke the command" do
- tool = DiscourseAi::Personas::Tools::ListCategories.new({}, bot_user: nil, llm: nil)
+ tool = DiscourseAi::Agents::Tools::ListCategories.new({}, bot_user: nil, llm: nil)
partial_placeholder = +(<<~HTML)
<details>
<summary>#{tool.summary}</summary>
@@ -72,7 +72,7 @@ RSpec.describe DiscourseAi::Personas::Bot do
HTML
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
messages: [{ type: :user, content: "Does my site has tags?" }],
)
@@ -85,9 +85,9 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
context "with max_turn_tokens token budget" do
- fab!(:persona_record) do
+ fab!(:agent_record) do
Fabricate(
- :ai_persona,
+ :ai_agent,
execution_mode: "agentic",
max_turn_tokens: 5000,
compression_threshold: 80,
@@ -95,7 +95,7 @@ RSpec.describe DiscourseAi::Personas::Bot do
)
end
- let(:persona_class) { persona_record.class_instance }
+ let(:agent_class) { agent_record.class_instance }
it "stops the loop when token budget is exhausted" do
tool_call =
@@ -105,9 +105,9 @@ RSpec.describe DiscourseAi::Personas::Bot do
call_count = 0
DiscourseAi::Completions::Llm.with_prepared_responses(responses) do
- bot = described_class.as(bot_user, persona: persona_class.new)
+ bot = described_class.as(bot_user, agent: agent_class.new)
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
messages: [{ type: :user, content: "List categories" }],
)
@@ -134,16 +134,16 @@ RSpec.describe DiscourseAi::Personas::Bot do
# budget=10000, 85%=8500
# first call adds 9000 tokens → crosses 85% but under 10000 → sets tool_choice=:none
# second call sees tool_choice=:none in the prompt
- big_budget_persona =
+ big_budget_agent =
Fabricate(
- :ai_persona,
+ :ai_agent,
execution_mode: "agentic",
max_turn_tokens: 10_000,
compression_threshold: 80,
tools: [["ListCategories", nil, false]],
)
- klass = big_budget_persona.class_instance
+ klass = big_budget_agent.class_instance
tool_call =
DiscourseAi::Completions::ToolCall.new(id: "call_1", name: "categories", parameters: {})
@@ -152,9 +152,9 @@ RSpec.describe DiscourseAi::Personas::Bot do
tool_choice_values = []
DiscourseAi::Completions::Llm.with_prepared_responses(responses) do
- bot = described_class.as(bot_user, persona: klass.new)
+ bot = described_class.as(bot_user, agent: klass.new)
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
messages: [{ type: :user, content: "List categories" }],
)
@@ -178,10 +178,10 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
it "preserves legacy MAX_COMPLETIONS behavior when max_turn_tokens is nil" do
- no_budget_persona =
- Fabricate(:ai_persona, max_turn_tokens: nil, tools: [["ListCategories", nil, false]])
+ no_budget_agent =
+ Fabricate(:ai_agent, max_turn_tokens: nil, tools: [["ListCategories", nil, false]])
- klass = no_budget_persona.class_instance
+ klass = no_budget_agent.class_instance
expect(klass.max_turn_tokens).to be_nil
tool_call =
@@ -192,9 +192,9 @@ RSpec.describe DiscourseAi::Personas::Bot do
call_count = 0
DiscourseAi::Completions::Llm.with_prepared_responses(responses) do
- bot = described_class.as(bot_user, persona: klass.new)
+ bot = described_class.as(bot_user, agent: klass.new)
context =
- DiscourseAi::Personas::BotContext.new(messages: [{ type: :user, content: "test" }])
+ DiscourseAi::Agents::BotContext.new(messages: [{ type: :user, content: "test" }])
allow_any_instance_of(DiscourseAi::Completions::Llm).to receive(
:generate,
@@ -213,16 +213,16 @@ RSpec.describe DiscourseAi::Personas::Bot do
it "forces a final text-only call with budget hint when budget exhausted after tool execution" do
# budget=2000, first call adds 3000 tokens → tool runs → budget exceeded
# but prompt ends with :tool, so model gets one more tool_choice=:none call
- small_budget_persona =
+ small_budget_agent =
Fabricate(
- :ai_persona,
+ :ai_agent,
execution_mode: "agentic",
max_turn_tokens: 2000,
compression_threshold: 80,
tools: [["ListCategories", nil, false]],
)
- klass = small_budget_persona.class_instance
+ klass = small_budget_agent.class_instance
tool_call =
DiscourseAi::Completions::ToolCall.new(id: "call_1", name: "categories", parameters: {})
@@ -233,9 +233,9 @@ RSpec.describe DiscourseAi::Personas::Bot do
tool_choice_values = []
DiscourseAi::Completions::Llm.with_prepared_responses(responses) do
- bot = described_class.as(bot_user, persona: klass.new)
+ bot = described_class.as(bot_user, agent: klass.new)
context =
- DiscourseAi::Personas::BotContext.new(
+ DiscourseAi::Agents::BotContext.new(
messages: [{ type: :user, content: "List categories" }],
)
@@ -264,10 +264,10 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
it "forces a final text-only call in legacy MAX_COMPLETIONS mode too" do
- one_turn_persona =
- Fabricate(:ai_persona, max_turn_tokens: nil, tools: [["ListCategories", nil, false]])
+ one_turn_agent =
+ Fabricate(:ai_agent, max_turn_tokens: nil, tools: [["ListCategories", nil, false]])
- klass = one_turn_persona.class_instance
+ klass = one_turn_agent.class_instance
tool_call =
DiscourseAi::Completions::ToolCall.new(id: "call_1", name: "categories", parameters: {})
@@ -278,9 +278,9 @@ RSpec.describe DiscourseAi::Personas::Bot do
last_tool_choice = nil
DiscourseAi::Completions::Llm.with_prepared_responses(responses) do
- bot = described_class.as(bot_user, persona: klass.new)
+ bot = described_class.as(bot_user, agent: klass.new)
context =
- DiscourseAi::Personas::BotContext.new(messages: [{ type: :user, content: "test" }])
+ DiscourseAi::Agents::BotContext.new(messages: [{ type: :user, content: "test" }])
allow_any_instance_of(DiscourseAi::Completions::Llm).to receive(
:generate,
@@ -306,9 +306,9 @@ RSpec.describe DiscourseAi::Personas::Bot do
DiscourseAi::Completions::ExecutionContext.new(token_usage_tracker: tracker)
DiscourseAi::Completions::Llm.with_prepared_responses(responses) do
- bot = described_class.as(bot_user, persona: persona_class.new)
+ bot = described_class.as(bot_user, agent: agent_class.new)
context =
- DiscourseAi::Personas::BotContext.new(messages: [{ type: :user, content: "test" }])
+ DiscourseAi::Agents::BotContext.new(messages: [{ type: :user, content: "test" }])
expect { bot.reply(context, execution_context:) { |_partial| } }.to raise_error(
RuntimeError,
@@ -320,9 +320,9 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
describe "#maybe_compress_context" do
- fab!(:persona_record) do
+ fab!(:agent_record) do
Fabricate(
- :ai_persona,
+ :ai_agent,
execution_mode: "agentic",
max_turn_tokens: 500_000,
compression_threshold: 75,
@@ -330,10 +330,10 @@ RSpec.describe DiscourseAi::Personas::Bot do
)
end
- let(:persona_class) { persona_record.class_instance }
+ let(:agent_class) { agent_record.class_instance }
it "compresses context when prompt exceeds default threshold of max_prompt_tokens" do
- bot = described_class.as(bot_user, persona: persona_class.new)
+ bot = described_class.as(bot_user, agent: agent_class.new)
messages = [{ type: :system, content: "You are a bot" }]
20.times do |i|
@@ -363,7 +363,7 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
it "skips compression when under threshold" do
- bot = described_class.as(bot_user, persona: persona_class.new)
+ bot = described_class.as(bot_user, agent: agent_class.new)
messages = [
{ type: :system, content: "You are a bot" },
@@ -382,10 +382,10 @@ RSpec.describe DiscourseAi::Personas::Bot do
expect(prompt.messages.length).to eq(3)
end
- it "uses persona compression_threshold to control when compression triggers" do
- persona_record.update!(compression_threshold: 50)
- persona_class_with_threshold = persona_record.class_instance
- bot = described_class.as(bot_user, persona: persona_class_with_threshold.new)
+ it "uses agent compression_threshold to control when compression triggers" do
+ agent_record.update!(compression_threshold: 50)
+ agent_class_with_threshold = agent_record.class_instance
+ bot = described_class.as(bot_user, agent: agent_class_with_threshold.new)
messages = [{ type: :system, content: "You are a bot" }]
20.times do |i|
@@ -410,7 +410,7 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
it "keeps tool_call/tool pairs together in the tail" do
- bot = described_class.as(bot_user, persona: persona_class.new)
+ bot = described_class.as(bot_user, agent: agent_class.new)
messages = [{ type: :system, content: "You are a bot" }]
# build enough middle messages to trigger compression
@@ -453,7 +453,7 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
it "skips compression when summarization returns blank" do
- bot = described_class.as(bot_user, persona: persona_class.new)
+ bot = described_class.as(bot_user, agent: agent_class.new)
messages = [{ type: :system, content: "You are a bot" }]
20.times do |i|
@@ -476,7 +476,7 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
it "skips compression when summarization raises an error" do
- bot = described_class.as(bot_user, persona: persona_class.new)
+ bot = described_class.as(bot_user, agent: agent_class.new)
messages = [{ type: :system, content: "You are a bot" }]
20.times do |i|
@@ -499,7 +499,7 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
it "skips compression when fewer than 6 middle messages" do
- bot = described_class.as(bot_user, persona: persona_class.new)
+ bot = described_class.as(bot_user, agent: agent_class.new)
messages = [{ type: :system, content: "You are a bot" }]
2.times do |i|
@@ -520,7 +520,7 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
it "skips compression when summary is larger than the original middle messages" do
- bot = described_class.as(bot_user, persona: persona_class.new)
+ bot = described_class.as(bot_user, agent: agent_class.new)
messages = [{ type: :system, content: "You are a bot" }]
# use short messages so middle section is small
@@ -546,7 +546,7 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
it "includes merge instruction when prior compressed context exists" do
- bot = described_class.as(bot_user, persona: persona_class.new)
+ bot = described_class.as(bot_user, agent: agent_class.new)
messages = [
{ type: :system, content: "You are a bot" },
@@ -583,7 +583,7 @@ RSpec.describe DiscourseAi::Personas::Bot do
end
it "does not include merge instruction when no prior compressed context exists" do
- bot = described_class.as(bot_user, persona: persona_class.new)
+ bot = described_class.as(bot_user, agent: agent_class.new)
messages = [{ type: :system, content: "You are a bot" }]
20.times do |i|
diff --git a/plugins/discourse-ai/spec/lib/personas/concept_deduplicator_spec.rb b/plugins/discourse-ai/spec/lib/agents/concept_deduplicator_spec.rb
similarity index 77%
rename from plugins/discourse-ai/spec/lib/personas/concept_deduplicator_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/concept_deduplicator_spec.rb
index 6ebc355a940..65a9759d5d3 100644
--- a/plugins/discourse-ai/spec/lib/personas/concept_deduplicator_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/concept_deduplicator_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::ConceptDeduplicator do
- let(:persona) { described_class.new }
+RSpec.describe DiscourseAi::Agents::ConceptDeduplicator do
+ let(:agent) { described_class.new }
before { enable_current_plugin }
@@ -12,7 +12,7 @@ RSpec.describe DiscourseAi::Personas::ConceptDeduplicator do
end
describe "#system_prompt" do
- let(:prompt) { persona.system_prompt }
+ let(:prompt) { agent.system_prompt }
it "specifies output format" do
expect(prompt).to include("streamlined_tags")
@@ -22,7 +22,7 @@ RSpec.describe DiscourseAi::Personas::ConceptDeduplicator do
describe "#response_format" do
it "defines correct response format" do
- format = persona.response_format
+ format = agent.response_format
expect(format).to eq(
[{ "array_type" => "string", "key" => "streamlined_tags", "type" => "array" }],
diff --git a/plugins/discourse-ai/spec/lib/personas/concept_finder_spec.rb b/plugins/discourse-ai/spec/lib/agents/concept_finder_spec.rb
similarity index 83%
rename from plugins/discourse-ai/spec/lib/personas/concept_finder_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/concept_finder_spec.rb
index 139c478af39..ac7150503bd 100644
--- a/plugins/discourse-ai/spec/lib/personas/concept_finder_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/concept_finder_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::ConceptFinder do
- let(:persona) { described_class.new }
+RSpec.describe DiscourseAi::Agents::ConceptFinder do
+ let(:agent) { described_class.new }
before { enable_current_plugin }
@@ -19,14 +19,14 @@ RSpec.describe DiscourseAi::Personas::ConceptFinder do
end
it "includes existing concepts when available" do
- prompt = persona.system_prompt
+ prompt = agent.system_prompt
InferredConcept.all.each { |concept| expect(prompt).to include(concept.name) }
end
it "handles empty existing concepts" do
InferredConcept.destroy_all
- prompt = persona.system_prompt
+ prompt = agent.system_prompt
expect(prompt).not_to include("following concepts already exist")
expect(prompt).to include("advanced concept tagging system")
@@ -37,17 +37,17 @@ RSpec.describe DiscourseAi::Personas::ConceptFinder do
allow(DiscourseAi::InferredConcepts::Manager).to receive(:new).and_return(manager)
allow(manager).to receive(:list_concepts).with(limit: 100).and_return(%w[concept1 concept2])
- persona.system_prompt
+ agent.system_prompt
end
it "includes format instructions" do
- prompt = persona.system_prompt
+ prompt = agent.system_prompt
expect(prompt).to include('{"concepts": ["concept1", "concept2", "concept3"]}')
end
it "includes language preservation instruction" do
- prompt = persona.system_prompt
+ prompt = agent.system_prompt
expect(prompt).to include("original language of the text")
end
@@ -55,7 +55,7 @@ RSpec.describe DiscourseAi::Personas::ConceptFinder do
describe "#response_format" do
it "defines correct response format" do
- format = persona.response_format
+ format = agent.response_format
expect(format).to eq([{ "array_type" => "string", "key" => "concepts", "type" => "array" }])
end
diff --git a/plugins/discourse-ai/spec/lib/personas/concept_matcher_spec.rb b/plugins/discourse-ai/spec/lib/agents/concept_matcher_spec.rb
similarity index 81%
rename from plugins/discourse-ai/spec/lib/personas/concept_matcher_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/concept_matcher_spec.rb
index 8a109a75d19..994accab4cb 100644
--- a/plugins/discourse-ai/spec/lib/personas/concept_matcher_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/concept_matcher_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::ConceptMatcher do
- let(:persona) { described_class.new }
+RSpec.describe DiscourseAi::Agents::ConceptMatcher do
+ let(:agent) { described_class.new }
before { enable_current_plugin }
@@ -12,7 +12,7 @@ RSpec.describe DiscourseAi::Personas::ConceptMatcher do
end
describe "#system_prompt" do
- let(:prompt) { persona.system_prompt }
+ let(:prompt) { agent.system_prompt }
it "includes placeholder for concept list" do
expect(prompt).to include("{inferred_concepts}")
@@ -26,7 +26,7 @@ RSpec.describe DiscourseAi::Personas::ConceptMatcher do
describe "#response_format" do
it "defines correct response format" do
- format = persona.response_format
+ format = agent.response_format
expect(format).to eq(
[{ "array_type" => "string", "key" => "matching_concepts", "type" => "array" }],
diff --git a/plugins/discourse-ai/spec/lib/personas/question_consolidator_spec.rb b/plugins/discourse-ai/spec/lib/agents/question_consolidator_spec.rb
similarity index 94%
rename from plugins/discourse-ai/spec/lib/personas/question_consolidator_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/question_consolidator_spec.rb
index 2c3c2da6950..2a8a07e5056 100644
--- a/plugins/discourse-ai/spec/lib/personas/question_consolidator_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/question_consolidator_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::QuestionConsolidator do
+RSpec.describe DiscourseAi::Agents::QuestionConsolidator do
let(:llm) { DiscourseAi::Completions::Llm.proxy(Fabricate(:fake_model)) }
let(:fake_endpoint) { DiscourseAi::Completions::Endpoints::Fake }
diff --git a/plugins/discourse-ai/spec/lib/personas/researcher_spec.rb b/plugins/discourse-ai/spec/lib/agents/researcher_spec.rb
similarity index 57%
rename from plugins/discourse-ai/spec/lib/personas/researcher_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/researcher_spec.rb
index 18dc5e5439a..cba20c07dde 100644
--- a/plugins/discourse-ai/spec/lib/personas/researcher_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/researcher_spec.rb
@@ -1,13 +1,13 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Researcher do
+RSpec.describe DiscourseAi::Agents::Researcher do
subject(:researcher) { described_class.new }
before { enable_current_plugin }
it "renders schema" do
expect(researcher.tools).to eq(
- [DiscourseAi::Personas::Tools::Google, DiscourseAi::Personas::Tools::WebBrowser],
+ [DiscourseAi::Agents::Tools::Google, DiscourseAi::Agents::Tools::WebBrowser],
)
end
end
diff --git a/plugins/discourse-ai/spec/lib/personas/settings_explorer_spec.rb b/plugins/discourse-ai/spec/lib/agents/settings_explorer_spec.rb
similarity index 61%
rename from plugins/discourse-ai/spec/lib/personas/settings_explorer_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/settings_explorer_spec.rb
index 70f9aba9cf4..6616b55ae8c 100644
--- a/plugins/discourse-ai/spec/lib/personas/settings_explorer_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/settings_explorer_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::SettingsExplorer do
+RSpec.describe DiscourseAi::Agents::SettingsExplorer do
subject(:settings_explorer) { described_class.new }
before { enable_current_plugin }
@@ -9,12 +9,12 @@ RSpec.describe DiscourseAi::Personas::SettingsExplorer do
prompt = settings_explorer.system_prompt
# check we do not render plugin settings
- expect(prompt).not_to include("ai_bot_enabled_personas")
+ expect(prompt).not_to include("ai_bot_enabled_agents")
expect(prompt).to include("site_description")
expect(settings_explorer.tools).to eq(
- [DiscourseAi::Personas::Tools::SettingContext, DiscourseAi::Personas::Tools::SearchSettings],
+ [DiscourseAi::Agents::Tools::SettingContext, DiscourseAi::Agents::Tools::SearchSettings],
)
end
end
diff --git a/plugins/discourse-ai/spec/lib/personas/sql_helper_spec.rb b/plugins/discourse-ai/spec/lib/agents/sql_helper_spec.rb
similarity index 76%
rename from plugins/discourse-ai/spec/lib/personas/sql_helper_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/sql_helper_spec.rb
index beefa7e6c08..15b55429ad9 100644
--- a/plugins/discourse-ai/spec/lib/personas/sql_helper_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/sql_helper_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::SqlHelper do
+RSpec.describe DiscourseAi::Agents::SqlHelper do
subject(:sql_helper) { described_class.new }
before { enable_current_plugin }
@@ -12,6 +12,6 @@ RSpec.describe DiscourseAi::Personas::SqlHelper do
expect(prompt).not_to include("translation_key") # not a priority table
expect(prompt).to include("user_api_keys") # not a priority table
- expect(sql_helper.tools).to eq([DiscourseAi::Personas::Tools::DbSchema])
+ expect(sql_helper.tools).to eq([DiscourseAi::Agents::Tools::DbSchema])
end
end
diff --git a/plugins/discourse-ai/spec/lib/personas/tool_runner_spec.rb b/plugins/discourse-ai/spec/lib/agents/tool_runner_spec.rb
similarity index 99%
rename from plugins/discourse-ai/spec/lib/personas/tool_runner_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tool_runner_spec.rb
index c99e5214e33..eba9302a410 100644
--- a/plugins/discourse-ai/spec/lib/personas/tool_runner_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tool_runner_spec.rb
@@ -2,7 +2,7 @@
require "rails_helper"
-RSpec.describe DiscourseAi::Personas::ToolRunner do
+RSpec.describe DiscourseAi::Agents::ToolRunner do
fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }
fab!(:bot_user) { Fabricate(:user, admin: true, refresh_auto_groups: true) }
fab!(:tool) do
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/assign_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/assign_spec.rb
similarity index 93%
rename from plugins/discourse-ai/spec/lib/personas/tools/assign_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/assign_spec.rb
index 0fbae175154..e7390d061be 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/assign_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/assign_spec.rb
@@ -2,7 +2,7 @@
return unless defined?(::Assigner)
-RSpec.describe DiscourseAi::Personas::Tools::Assign do
+RSpec.describe DiscourseAi::Agents::Tools::Assign do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -21,7 +21,7 @@ RSpec.describe DiscourseAi::Personas::Tools::Assign do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
let(:topic) { post.topic }
it "assigns the topic to a user" do
@@ -84,7 +84,7 @@ RSpec.describe DiscourseAi::Personas::Tools::Assign do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ topic_id: topic.id, assigned: true, username: user.username, reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/close_topic_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/close_topic_spec.rb
similarity index 93%
rename from plugins/discourse-ai/spec/lib/personas/tools/close_topic_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/close_topic_spec.rb
index a93fba57377..8ffff194d4e 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/close_topic_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/close_topic_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::CloseTopic do
+RSpec.describe DiscourseAi::Agents::Tools::CloseTopic do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -16,7 +16,7 @@ RSpec.describe DiscourseAi::Personas::Tools::CloseTopic do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
it "closes the topic when closed is true" do
result = tool(topic_id: topic.id, closed: true, reason: "Off-topic discussion").invoke
@@ -77,7 +77,7 @@ RSpec.describe DiscourseAi::Personas::Tools::CloseTopic do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ topic_id: topic.id, closed: true, reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/create_artifact_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/create_artifact_spec.rb
similarity index 92%
rename from plugins/discourse-ai/spec/lib/personas/tools/create_artifact_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/create_artifact_spec.rb
index 8205550a827..a3c947e9f37 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/create_artifact_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/create_artifact_spec.rb
@@ -1,6 +1,6 @@
#frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::CreateArtifact do
+RSpec.describe DiscourseAi::Agents::Tools::CreateArtifact do
fab!(:llm_model)
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
fab!(:post)
@@ -37,7 +37,7 @@ RSpec.describe DiscourseAi::Personas::Tools::CreateArtifact do
{ html_body: "hello" },
bot_user: Fabricate(:user),
llm: llm,
- context: DiscourseAi::Personas::BotContext.new(post: post),
+ context: DiscourseAi::Agents::BotContext.new(post: post),
)
tool.parameters = { name: "hello", specification: "hello spec" }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/create_image_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/create_image_spec.rb
similarity index 98%
rename from plugins/discourse-ai/spec/lib/personas/tools/create_image_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/create_image_spec.rb
index 2322d3b8c9a..1cdbca6eb81 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/create_image_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/create_image_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::CreateImage do
+RSpec.describe DiscourseAi::Agents::Tools::CreateImage do
let(:prompts) { ["a watercolor painting", "an abstract design"] }
fab!(:gpt_35_turbo) { Fabricate(:llm_model, name: "gpt-3.5-turbo") }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/db_schema_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/db_schema_spec.rb
similarity index 92%
rename from plugins/discourse-ai/spec/lib/personas/tools/db_schema_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/db_schema_spec.rb
index d06d38a569b..91c8965b2f4 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/db_schema_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/db_schema_spec.rb
@@ -1,6 +1,6 @@
#frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::DbSchema do
+RSpec.describe DiscourseAi::Agents::Tools::DbSchema do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/delete_topic_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/delete_topic_spec.rb
similarity index 90%
rename from plugins/discourse-ai/spec/lib/personas/tools/delete_topic_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/delete_topic_spec.rb
index b953a0d029c..1706b7d1ed5 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/delete_topic_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/delete_topic_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::DeleteTopic do
+RSpec.describe DiscourseAi::Agents::Tools::DeleteTopic do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -16,7 +16,7 @@ RSpec.describe DiscourseAi::Personas::Tools::DeleteTopic do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
it "deletes the topic when deleted is true" do
topic_id = post.topic_id
@@ -51,7 +51,7 @@ RSpec.describe DiscourseAi::Personas::Tools::DeleteTopic do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ topic_id: post.topic_id, deleted: true, reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/discourse_meta_search_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/discourse_meta_search_spec.rb
similarity index 97%
rename from plugins/discourse-ai/spec/lib/personas/tools/discourse_meta_search_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/discourse_meta_search_spec.rb
index 1cd81b86aff..b2a72578e96 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/discourse_meta_search_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/discourse_meta_search_spec.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::DiscourseMetaSearch do
+RSpec.describe DiscourseAi::Agents::Tools::DiscourseMetaSearch do
before do
enable_current_plugin
SiteSetting.ai_bot_enabled = true
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/edit_category_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/edit_category_spec.rb
similarity index 92%
rename from plugins/discourse-ai/spec/lib/personas/tools/edit_category_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/edit_category_spec.rb
index 4300bee346f..e4a417b3480 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/edit_category_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/edit_category_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::EditCategory do
+RSpec.describe DiscourseAi::Agents::Tools::EditCategory do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -18,7 +18,7 @@ RSpec.describe DiscourseAi::Personas::Tools::EditCategory do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
it "moves the topic to a different category" do
topic = post.topic
@@ -67,7 +67,7 @@ RSpec.describe DiscourseAi::Personas::Tools::EditCategory do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ topic_id: post.topic_id, category_id: target_category.id, reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/edit_image_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/edit_image_spec.rb
similarity index 94%
rename from plugins/discourse-ai/spec/lib/personas/tools/edit_image_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/edit_image_spec.rb
index 1f2cab03ae4..db7191d443e 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/edit_image_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/edit_image_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::EditImage do
+RSpec.describe DiscourseAi::Agents::Tools::EditImage do
fab!(:gpt_35_turbo) { Fabricate(:llm_model, name: "gpt-3.5-turbo") }
fab!(:admin)
fab!(:user)
@@ -60,7 +60,7 @@ RSpec.describe DiscourseAi::Personas::Tools::EditImage do
{ image_urls: [image_upload.short_url], prompt: prompt },
llm: llm,
bot_user: bot_user,
- context: DiscourseAi::Personas::BotContext.new(user: user),
+ context: DiscourseAi::Agents::BotContext.new(user: user),
)
end
@@ -80,7 +80,7 @@ RSpec.describe DiscourseAi::Personas::Tools::EditImage do
{ image_urls: [], prompt: prompt },
llm: llm,
bot_user: bot_user,
- context: DiscourseAi::Personas::BotContext.new(user: user),
+ context: DiscourseAi::Agents::BotContext.new(user: user),
)
result = edit_image_no_images.invoke(&progress_blk)
@@ -117,7 +117,7 @@ RSpec.describe DiscourseAi::Personas::Tools::EditImage do
{ image_urls: [private_upload.short_url], prompt: prompt },
llm: llm,
bot_user: bot_user,
- context: DiscourseAi::Personas::BotContext.new(user: user),
+ context: DiscourseAi::Agents::BotContext.new(user: user),
)
result = edit_private_image.invoke(&progress_blk)
@@ -145,7 +145,7 @@ RSpec.describe DiscourseAi::Personas::Tools::EditImage do
{ image_urls: [private_upload.short_url], prompt: prompt },
llm: llm,
bot_user: bot_user,
- context: DiscourseAi::Personas::BotContext.new(user: user),
+ context: DiscourseAi::Agents::BotContext.new(user: user),
)
result = edit_private_image.invoke(&progress_blk)
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/edit_post_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/edit_post_spec.rb
similarity index 93%
rename from plugins/discourse-ai/spec/lib/personas/tools/edit_post_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/edit_post_spec.rb
index dcfa429f85e..6e1a9126d14 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/edit_post_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/edit_post_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::EditPost do
+RSpec.describe DiscourseAi::Agents::Tools::EditPost do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -16,7 +16,7 @@ RSpec.describe DiscourseAi::Personas::Tools::EditPost do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
it "edits the post content" do
result = tool(post_id: post.id, raw: "Updated content", edit_reason: "Fixing typo").invoke
@@ -70,7 +70,7 @@ RSpec.describe DiscourseAi::Personas::Tools::EditPost do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
other_post = Fabricate(:post)
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ post_id: other_post.id, raw: "New content", edit_reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/edit_tags_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/edit_tags_spec.rb
similarity index 94%
rename from plugins/discourse-ai/spec/lib/personas/tools/edit_tags_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/edit_tags_spec.rb
index a005d12edea..fd5438b5c1e 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/edit_tags_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/edit_tags_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::EditTags do
+RSpec.describe DiscourseAi::Agents::Tools::EditTags do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -19,7 +19,7 @@ RSpec.describe DiscourseAi::Personas::Tools::EditTags do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
let(:topic) { post.topic }
it "sets tags on the topic" do
@@ -89,7 +89,7 @@ RSpec.describe DiscourseAi::Personas::Tools::EditTags do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ topic_id: topic.id, tags: %w[alpha], reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/flag_post_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/flag_post_spec.rb
similarity index 89%
rename from plugins/discourse-ai/spec/lib/personas/tools/flag_post_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/flag_post_spec.rb
index 1470894d5ec..d8532477885 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/flag_post_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/flag_post_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::FlagPost do
+RSpec.describe DiscourseAi::Agents::Tools::FlagPost do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -11,18 +11,18 @@ RSpec.describe DiscourseAi::Personas::Tools::FlagPost do
SiteSetting.ai_bot_enabled = true
end
- def tool(params = nil, persona_options: {}, **kwargs)
+ def tool(params = nil, agent_options: {}, **kwargs)
params ||= kwargs
described_class.new(
params,
bot_user: bot_user,
llm: llm,
context: context,
- persona_options: persona_options,
+ agent_options: agent_options,
)
end
- let(:context) { DiscourseAi::Personas::BotContext.new(post: post) }
+ let(:context) { DiscourseAi::Agents::BotContext.new(post: post) }
it "flags the post when flag_post is true" do
result = nil
@@ -80,7 +80,7 @@ RSpec.describe DiscourseAi::Personas::Tools::FlagPost do
result =
tool(
{ flag_post: true, reason: "Needs review" },
- persona_options: {
+ agent_options: {
flag_type: "review_hide",
},
).invoke
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/github_diff_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/github_diff_spec.rb
similarity index 99%
rename from plugins/discourse-ai/spec/lib/personas/tools/github_diff_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/github_diff_spec.rb
index 61d7849e393..3bb71750687 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/github_diff_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/github_diff_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::GithubDiff do
+RSpec.describe DiscourseAi::Agents::Tools::GithubDiff do
let(:bot_user) { Fabricate(:user) }
fab!(:llm_model)
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/github_file_content_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/github_file_content_spec.rb
similarity index 99%
rename from plugins/discourse-ai/spec/lib/personas/tools/github_file_content_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/github_file_content_spec.rb
index 46d417b40c4..6765e0c42e7 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/github_file_content_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/github_file_content_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::GithubFileContent do
+RSpec.describe DiscourseAi::Agents::Tools::GithubFileContent do
fab!(:llm_model)
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/github_search_code_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/github_search_code_spec.rb
similarity index 99%
rename from plugins/discourse-ai/spec/lib/personas/tools/github_search_code_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/github_search_code_spec.rb
index d1acb235553..8527787b78c 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/github_search_code_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/github_search_code_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::GithubSearchCode do
+RSpec.describe DiscourseAi::Agents::Tools::GithubSearchCode do
let(:bot_user) { Fabricate(:user) }
fab!(:llm_model)
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/github_search_files_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/github_search_files_spec.rb
similarity index 98%
rename from plugins/discourse-ai/spec/lib/personas/tools/github_search_files_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/github_search_files_spec.rb
index 9cde352ea9c..7c5e997f0bd 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/github_search_files_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/github_search_files_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::GithubSearchFiles do
+RSpec.describe DiscourseAi::Agents::Tools::GithubSearchFiles do
fab!(:llm_model)
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model.id) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/google_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/google_spec.rb
similarity index 97%
rename from plugins/discourse-ai/spec/lib/personas/tools/google_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/google_spec.rb
index 7d419af12f4..3c361a494fc 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/google_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/google_spec.rb
@@ -1,6 +1,6 @@
#frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::Google do
+RSpec.describe DiscourseAi::Agents::Tools::Google do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -37,7 +37,7 @@ RSpec.describe DiscourseAi::Personas::Tools::Google do
{ query: "some search term" },
bot_user: bot_user,
llm: llm,
- persona_options: {
+ agent_options: {
"base_query" => base_query,
},
)
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/grant_badge_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/grant_badge_spec.rb
similarity index 91%
rename from plugins/discourse-ai/spec/lib/personas/tools/grant_badge_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/grant_badge_spec.rb
index 45ccc2d9ac9..3cde9061f6b 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/grant_badge_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/grant_badge_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::GrantBadge do
+RSpec.describe DiscourseAi::Agents::Tools::GrantBadge do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -17,7 +17,7 @@ RSpec.describe DiscourseAi::Personas::Tools::GrantBadge do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
it "grants the badge to the user" do
result =
@@ -59,7 +59,7 @@ RSpec.describe DiscourseAi::Personas::Tools::GrantBadge do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ username: user.username, badge_name: badge.name, reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/image_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/image_spec.rb
similarity index 96%
rename from plugins/discourse-ai/spec/lib/personas/tools/image_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/image_spec.rb
index 7ee3219a0ab..af131cdc772 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/image_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/image_spec.rb
@@ -1,6 +1,6 @@
#frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::Image do
+RSpec.describe DiscourseAi::Agents::Tools::Image do
let(:progress_blk) { Proc.new {} }
let(:prompts) { ["a pink cow", "a red cow"] }
@@ -9,7 +9,7 @@ RSpec.describe DiscourseAi::Personas::Tools::Image do
{ prompts: prompts, seeds: [99, 32] },
bot_user: bot_user,
llm: llm,
- context: DiscourseAi::Personas::BotContext.new,
+ context: DiscourseAi::Agents::BotContext.new,
)
end
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/javascript_evaluator_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/javascript_evaluator_spec.rb
similarity index 97%
rename from plugins/discourse-ai/spec/lib/personas/tools/javascript_evaluator_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/javascript_evaluator_spec.rb
index d356370eef8..be6d1d13673 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/javascript_evaluator_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/javascript_evaluator_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::JavascriptEvaluator do
+RSpec.describe DiscourseAi::Agents::Tools::JavascriptEvaluator do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/list_categories_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/list_categories_spec.rb
similarity index 90%
rename from plugins/discourse-ai/spec/lib/personas/tools/list_categories_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/list_categories_spec.rb
index 64ba14723ee..2ecbbcec9e1 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/list_categories_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/list_categories_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::ListCategories do
+RSpec.describe DiscourseAi::Agents::Tools::ListCategories do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/list_tags_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/list_tags_spec.rb
similarity index 92%
rename from plugins/discourse-ai/spec/lib/personas/tools/list_tags_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/list_tags_spec.rb
index a4e604cecc0..9521231bca5 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/list_tags_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/list_tags_spec.rb
@@ -1,6 +1,6 @@
#frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::ListTags do
+RSpec.describe DiscourseAi::Agents::Tools::ListTags do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/lock_post_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/lock_post_spec.rb
similarity index 90%
rename from plugins/discourse-ai/spec/lib/personas/tools/lock_post_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/lock_post_spec.rb
index 4e98f4bb287..f8a64ef3229 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/lock_post_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/lock_post_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::LockPost do
+RSpec.describe DiscourseAi::Agents::Tools::LockPost do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -16,7 +16,7 @@ RSpec.describe DiscourseAi::Personas::Tools::LockPost do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
it "locks the post when locked is true" do
result = tool(post_id: post.id, locked: true, reason: "Preventing edits").invoke
@@ -48,7 +48,7 @@ RSpec.describe DiscourseAi::Personas::Tools::LockPost do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ post_id: post.id, locked: true, reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/mark_as_solved_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/mark_as_solved_spec.rb
similarity index 91%
rename from plugins/discourse-ai/spec/lib/personas/tools/mark_as_solved_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/mark_as_solved_spec.rb
index 89a5b264800..9ae84304c47 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/mark_as_solved_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/mark_as_solved_spec.rb
@@ -2,7 +2,7 @@
return unless defined?(::DiscourseSolved)
-RSpec.describe DiscourseAi::Personas::Tools::MarkAsSolved do
+RSpec.describe DiscourseAi::Agents::Tools::MarkAsSolved do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -22,7 +22,7 @@ RSpec.describe DiscourseAi::Personas::Tools::MarkAsSolved do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
it "marks a post as the accepted solution" do
result = tool(post_id: reply.id, solved: true, reason: "This answers the question").invoke
@@ -56,7 +56,7 @@ RSpec.describe DiscourseAi::Personas::Tools::MarkAsSolved do
return unless defined?(::DiscourseSolved)
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ post_id: reply.id, solved: true, reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/move_posts_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/move_posts_spec.rb
similarity index 94%
rename from plugins/discourse-ai/spec/lib/personas/tools/move_posts_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/move_posts_spec.rb
index 722f93f786a..24fcd151a74 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/move_posts_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/move_posts_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::MovePosts do
+RSpec.describe DiscourseAi::Agents::Tools::MovePosts do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -19,7 +19,7 @@ RSpec.describe DiscourseAi::Personas::Tools::MovePosts do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
it "moves posts to an existing topic" do
result =
@@ -93,7 +93,7 @@ RSpec.describe DiscourseAi::Personas::Tools::MovePosts do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/random_picker_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/random_picker_spec.rb
similarity index 96%
rename from plugins/discourse-ai/spec/lib/personas/tools/random_picker_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/random_picker_spec.rb
index db9b67dc91c..72c755ff9d2 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/random_picker_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/random_picker_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::RandomPicker do
+RSpec.describe DiscourseAi::Agents::Tools::RandomPicker do
before { enable_current_plugin }
describe "#invoke" do
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/read_artifact_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/read_artifact_spec.rb
similarity index 90%
rename from plugins/discourse-ai/spec/lib/personas/tools/read_artifact_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/read_artifact_spec.rb
index e1314618d60..eaef70ddde2 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/read_artifact_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/read_artifact_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::ReadArtifact do
+RSpec.describe DiscourseAi::Agents::Tools::ReadArtifact do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
fab!(:post)
@@ -28,7 +28,7 @@ RSpec.describe DiscourseAi::Personas::Tools::ReadArtifact do
{ url: "#{Discourse.base_url}/discourse-ai/ai-bot/artifacts/#{artifact.id}" },
bot_user: bot_user,
llm: llm_model.to_llm,
- context: DiscourseAi::Personas::BotContext.new(post: post),
+ context: DiscourseAi::Agents::BotContext.new(post: post),
)
result = tool.invoke {}
@@ -47,7 +47,7 @@ RSpec.describe DiscourseAi::Personas::Tools::ReadArtifact do
{ url: "invalid-url" },
bot_user: bot_user,
llm: llm_model.to_llm,
- context: DiscourseAi::Personas::BotContext.new(post: post),
+ context: DiscourseAi::Agents::BotContext.new(post: post),
)
result = tool.invoke {}
@@ -61,7 +61,7 @@ RSpec.describe DiscourseAi::Personas::Tools::ReadArtifact do
{ url: "#{Discourse.base_url}/discourse-ai/ai-bot/artifacts/99999" },
bot_user: bot_user,
llm: llm_model.to_llm,
- context: DiscourseAi::Personas::BotContext.new(post: post),
+ context: DiscourseAi::Agents::BotContext.new(post: post),
)
result = tool.invoke {}
@@ -94,7 +94,7 @@ RSpec.describe DiscourseAi::Personas::Tools::ReadArtifact do
{ url: "https://example.com" },
bot_user: bot_user,
llm: llm_model.to_llm,
- context: DiscourseAi::Personas::BotContext.new(post: post),
+ context: DiscourseAi::Agents::BotContext.new(post: post),
)
result = tool.invoke {}
@@ -123,7 +123,7 @@ RSpec.describe DiscourseAi::Personas::Tools::ReadArtifact do
{ url: "https://example.com" },
bot_user: bot_user,
llm: llm_model.to_llm,
- context: DiscourseAi::Personas::BotContext.new(post: post),
+ context: DiscourseAi::Agents::BotContext.new(post: post),
)
result = tool.invoke {}
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/read_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/read_spec.rb
similarity index 93%
rename from plugins/discourse-ai/spec/lib/personas/tools/read_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/read_spec.rb
index 6f347661b34..a0e9cda5fba 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/read_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/read_spec.rb
@@ -1,6 +1,6 @@
#frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::Read do
+RSpec.describe DiscourseAi::Agents::Tools::Read do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -56,10 +56,10 @@ RSpec.describe DiscourseAi::Personas::Tools::Read do
{ topic_id: topic_with_tags.id, post_numbers: [post1.post_number] },
bot_user: bot_user,
llm: llm,
- persona_options: {
+ agent_options: {
"read_private" => true,
},
- context: DiscourseAi::Personas::BotContext.new(user: admin),
+ context: DiscourseAi::Agents::BotContext.new(user: admin),
)
results = tool.invoke
expect(results[:content]).to include("hello there")
@@ -69,7 +69,7 @@ RSpec.describe DiscourseAi::Personas::Tools::Read do
{ topic_id: topic_with_tags.id, post_numbers: [post1.post_number] },
bot_user: bot_user,
llm: llm,
- context: DiscourseAi::Personas::BotContext.new(user: admin),
+ context: DiscourseAi::Agents::BotContext.new(user: admin),
)
results = tool.invoke
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/researcher_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/researcher_spec.rb
similarity index 91%
rename from plugins/discourse-ai/spec/lib/personas/tools/researcher_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/researcher_spec.rb
index c57c6dc01db..da0dc8d499e 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/researcher_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/researcher_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::Researcher do
+RSpec.describe DiscourseAi::Agents::Tools::Researcher do
before { SearchIndexer.enable }
after { SearchIndexer.disable }
@@ -45,14 +45,14 @@ RSpec.describe DiscourseAi::Personas::Tools::Researcher do
researcher =
described_class.new(
{ filter: "category:research-category", goals: "analyze test content", dry_run: false },
- persona_options: {
+ agent_options: {
"researcher_llm" => secondary_llm_model.id,
"max_tokens_per_post" => 50, # Very small to force truncation
"max_tokens_per_batch" => 8000,
},
bot_user: bot_user,
llm: nil,
- context: DiscourseAi::Personas::BotContext.new(user: user, post: post),
+ context: DiscourseAi::Agents::BotContext.new(user: user, post: post),
)
results = researcher.invoke(&progress_blk)
@@ -79,7 +79,7 @@ RSpec.describe DiscourseAi::Personas::Tools::Researcher do
{ dry_run: true, filter: "topic:#{topic_with_tags.id}", goals: "analyze topic content" },
bot_user: bot_user,
llm: llm,
- context: DiscourseAi::Personas::BotContext.new(user: user, post: post),
+ context: DiscourseAi::Agents::BotContext.new(user: user, post: post),
)
results = researcher.invoke(&progress_blk)
expect(results[:number_of_posts]).to eq(1)
@@ -91,7 +91,7 @@ RSpec.describe DiscourseAi::Personas::Tools::Researcher do
{ filter: "tag:research after:2023", goals: "analyze post patterns", dry_run: true },
bot_user: bot_user,
llm: llm,
- context: DiscourseAi::Personas::BotContext.new(user: user, post: post),
+ context: DiscourseAi::Agents::BotContext.new(user: user, post: post),
)
results = researcher.invoke(&progress_blk)
@@ -117,7 +117,7 @@ RSpec.describe DiscourseAi::Personas::Tools::Researcher do
researcher =
described_class.new(
{ filter: "category:research-category" },
- persona_options: {
+ agent_options: {
"max_results" => "50",
},
bot_user: bot_user,
@@ -133,7 +133,7 @@ RSpec.describe DiscourseAi::Personas::Tools::Researcher do
{ filter: "invalidfilter tag:research", goals: "analyze content" },
bot_user: bot_user,
llm: llm,
- context: DiscourseAi::Personas::BotContext.new(user: user, post: post),
+ context: DiscourseAi::Agents::BotContext.new(user: user, post: post),
)
results = researcher.invoke(&progress_blk)
@@ -161,7 +161,7 @@ RSpec.describe DiscourseAi::Personas::Tools::Researcher do
},
bot_user: bot_user,
llm: llm,
- context: DiscourseAi::Personas::BotContext.new(user: user, post: post),
+ context: DiscourseAi::Agents::BotContext.new(user: user, post: post),
)
responses = 10.times.map { |i| ["Found: Relevant content #{i + 1}"] }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/search_settings_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/search_settings_spec.rb
similarity index 97%
rename from plugins/discourse-ai/spec/lib/personas/tools/search_settings_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/search_settings_spec.rb
index c89399ad63c..1af551411b1 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/search_settings_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/search_settings_spec.rb
@@ -1,6 +1,6 @@
#frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::SearchSettings do
+RSpec.describe DiscourseAi::Agents::Tools::SearchSettings do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/search_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/search_spec.rb
similarity index 97%
rename from plugins/discourse-ai/spec/lib/personas/tools/search_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/search_spec.rb
index 5c5ab64d6a0..c3d24de9718 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/search_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/search_spec.rb
@@ -1,6 +1,6 @@
#frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::Search do
+RSpec.describe DiscourseAi::Agents::Tools::Search do
before { SearchIndexer.enable }
after { SearchIndexer.disable }
@@ -43,8 +43,8 @@ RSpec.describe DiscourseAi::Personas::Tools::Search do
end
describe "#invoke" do
- it "can retrieve options from persona correctly" do
- persona_options = {
+ it "can retrieve options from agent correctly" do
+ agent_options = {
"base_query" => "#funny",
"search_private" => "true",
"max_results" => "10",
@@ -60,10 +60,10 @@ RSpec.describe DiscourseAi::Personas::Tools::Search do
search =
described_class.new(
{ order: "latest" },
- persona_options: persona_options,
+ agent_options: agent_options,
bot_user: bot_user,
llm: llm,
- context: DiscourseAi::Personas::BotContext.new(user: user),
+ context: DiscourseAi::Agents::BotContext.new(user: user),
)
expect(search.options[:base_query]).to eq("#funny")
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/set_slow_mode_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/set_slow_mode_spec.rb
similarity index 92%
rename from plugins/discourse-ai/spec/lib/personas/tools/set_slow_mode_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/set_slow_mode_spec.rb
index e57ba2341e1..58285a7a773 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/set_slow_mode_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/set_slow_mode_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::SetSlowMode do
+RSpec.describe DiscourseAi::Agents::Tools::SetSlowMode do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -16,7 +16,7 @@ RSpec.describe DiscourseAi::Personas::Tools::SetSlowMode do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
it "enables slow mode on the topic" do
result = tool(topic_id: topic.id, slow_mode_seconds: 600, reason: "Heated discussion").invoke
@@ -62,7 +62,7 @@ RSpec.describe DiscourseAi::Personas::Tools::SetSlowMode do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ topic_id: topic.id, slow_mode_seconds: 600, reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/set_topic_timer_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/set_topic_timer_spec.rb
similarity index 92%
rename from plugins/discourse-ai/spec/lib/personas/tools/set_topic_timer_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/set_topic_timer_spec.rb
index 0647c705082..25dbf13ea8c 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/set_topic_timer_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/set_topic_timer_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::SetTopicTimer do
+RSpec.describe DiscourseAi::Agents::Tools::SetTopicTimer do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -16,7 +16,7 @@ RSpec.describe DiscourseAi::Personas::Tools::SetTopicTimer do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
it "sets a close timer on the topic" do
result =
@@ -69,7 +69,7 @@ RSpec.describe DiscourseAi::Personas::Tools::SetTopicTimer do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ topic_id: topic.id, timer_type: "close", duration_hours: 1, reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/setting_context_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/setting_context_spec.rb
similarity index 95%
rename from plugins/discourse-ai/spec/lib/personas/tools/setting_context_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/setting_context_spec.rb
index 0db9e63487e..60eebe80d79 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/setting_context_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/setting_context_spec.rb
@@ -8,7 +8,7 @@ def has_rg?
end
end
-RSpec.describe DiscourseAi::Personas::Tools::SettingContext, if: has_rg? do
+RSpec.describe DiscourseAi::Agents::Tools::SettingContext, if: has_rg? do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/summarize_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/summarize_spec.rb
similarity index 96%
rename from plugins/discourse-ai/spec/lib/personas/tools/summarize_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/summarize_spec.rb
index 139c13d787a..37a575514b9 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/summarize_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/summarize_spec.rb
@@ -1,6 +1,6 @@
#frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::Summarize do
+RSpec.describe DiscourseAi::Agents::Tools::Summarize do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/time_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/time_spec.rb
similarity index 92%
rename from plugins/discourse-ai/spec/lib/personas/tools/time_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/time_spec.rb
index 8a9b707d6d9..bf65defe338 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/time_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/time_spec.rb
@@ -1,6 +1,6 @@
#frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::Time do
+RSpec.describe DiscourseAi::Agents::Tools::Time do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/tool_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/tool_spec.rb
similarity index 95%
rename from plugins/discourse-ai/spec/lib/personas/tools/tool_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/tool_spec.rb
index fb8f41d17ea..89ae5b7ae36 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/tool_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/tool_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::Tool do
+RSpec.describe DiscourseAi::Agents::Tools::Tool do
let :tool_class do
described_class
end
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/unlist_topic_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/unlist_topic_spec.rb
similarity index 92%
rename from plugins/discourse-ai/spec/lib/personas/tools/unlist_topic_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/unlist_topic_spec.rb
index d7ffd47a7c4..5f69a43f90a 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/unlist_topic_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/unlist_topic_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::UnlistTopic do
+RSpec.describe DiscourseAi::Agents::Tools::UnlistTopic do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
@@ -16,7 +16,7 @@ RSpec.describe DiscourseAi::Personas::Tools::UnlistTopic do
described_class.new(params, bot_user: bot_user, llm: llm, context: context)
end
- let(:context) { DiscourseAi::Personas::BotContext.new }
+ let(:context) { DiscourseAi::Agents::BotContext.new }
it "unlists the topic when unlisted is true" do
result = tool(topic_id: topic.id, unlisted: true, reason: "Needs cleanup").invoke
@@ -67,7 +67,7 @@ RSpec.describe DiscourseAi::Personas::Tools::UnlistTopic do
it "returns an error when context user lacks permission" do
regular_user = Fabricate(:user, trust_level: TrustLevel[0])
- ctx = DiscourseAi::Personas::BotContext.new(user: regular_user)
+ ctx = DiscourseAi::Agents::BotContext.new(user: regular_user)
t =
described_class.new(
{ topic_id: topic.id, unlisted: true, reason: "test" },
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/update_artifact_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/update_artifact_spec.rb
similarity index 90%
rename from plugins/discourse-ai/spec/lib/personas/tools/update_artifact_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/update_artifact_spec.rb
index 0c3f01a7498..290c9b8a9bf 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/update_artifact_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/update_artifact_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::UpdateArtifact do
+RSpec.describe DiscourseAi::Agents::Tools::UpdateArtifact do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
fab!(:post)
@@ -47,10 +47,10 @@ RSpec.describe DiscourseAi::Personas::Tools::UpdateArtifact do
},
bot_user: bot_user,
llm: llm_model.to_llm,
- persona_options: {
+ agent_options: {
"update_algorithm" => "full",
},
- context: DiscourseAi::Personas::BotContext.new(messages: [], post: post),
+ context: DiscourseAi::Agents::BotContext.new(messages: [], post: post),
)
result = tool.invoke {}
@@ -91,10 +91,10 @@ RSpec.describe DiscourseAi::Personas::Tools::UpdateArtifact do
{ artifact_id: artifact.id, instructions: "Update only JavaScript" },
bot_user: bot_user,
llm: llm_model.to_llm,
- persona_options: {
+ agent_options: {
"update_algorithm" => "full",
},
- context: DiscourseAi::Personas::BotContext.new(messages: [], post: post),
+ context: DiscourseAi::Agents::BotContext.new(messages: [], post: post),
)
result = tool.invoke {}
@@ -118,7 +118,7 @@ RSpec.describe DiscourseAi::Personas::Tools::UpdateArtifact do
{ artifact_id: artifact.id, instructions: "Invalid update" },
bot_user: bot_user,
llm: llm_model.to_llm,
- context: DiscourseAi::Personas::BotContext.new(messages: [], post: post),
+ context: DiscourseAi::Agents::BotContext.new(messages: [], post: post),
)
result = tool.invoke {}
@@ -132,7 +132,7 @@ RSpec.describe DiscourseAi::Personas::Tools::UpdateArtifact do
{ artifact_id: -1, instructions: "Update something" },
bot_user: bot_user,
llm: llm_model.to_llm,
- context: DiscourseAi::Personas::BotContext.new(messages: [], post: post),
+ context: DiscourseAi::Agents::BotContext.new(messages: [], post: post),
)
result = tool.invoke {}
@@ -155,10 +155,10 @@ RSpec.describe DiscourseAi::Personas::Tools::UpdateArtifact do
{ artifact_id: artifact.id, instructions: "Just update the HTML" },
bot_user: bot_user,
llm: llm_model.to_llm,
- persona_options: {
+ agent_options: {
"update_algorithm" => "full",
},
- context: DiscourseAi::Personas::BotContext.new(messages: [], post: post),
+ context: DiscourseAi::Agents::BotContext.new(messages: [], post: post),
)
tool.invoke {}
@@ -199,10 +199,10 @@ RSpec.describe DiscourseAi::Personas::Tools::UpdateArtifact do
{ artifact_id: artifact.id, instructions: "Just update the HTML" },
bot_user: bot_user,
llm: llm_model.to_llm,
- persona_options: {
+ agent_options: {
"update_algorithm" => "full",
},
- context: DiscourseAi::Personas::BotContext.new(messages: [], post: post),
+ context: DiscourseAi::Agents::BotContext.new(messages: [], post: post),
)
result = tool.invoke {}
@@ -226,10 +226,10 @@ RSpec.describe DiscourseAi::Personas::Tools::UpdateArtifact do
{ artifact_id: artifact.id, instructions: "Update to version 1" },
bot_user: bot_user,
llm: llm_model.to_llm,
- persona_options: {
+ agent_options: {
"update_algorithm" => "full",
},
- context: DiscourseAi::Personas::BotContext.new(messages: [], post: post),
+ context: DiscourseAi::Agents::BotContext.new(messages: [], post: post),
)
.invoke {}
end
@@ -252,10 +252,10 @@ RSpec.describe DiscourseAi::Personas::Tools::UpdateArtifact do
},
bot_user: bot_user,
llm: llm_model.to_llm,
- persona_options: {
+ agent_options: {
"update_algorithm" => "full",
},
- context: DiscourseAi::Personas::BotContext.new(messages: [], post: post),
+ context: DiscourseAi::Agents::BotContext.new(messages: [], post: post),
)
result = tool.invoke {}
@@ -305,8 +305,8 @@ RSpec.describe DiscourseAi::Personas::Tools::UpdateArtifact do
{ artifact_id: artifact.id, instructions: "Change the text to Updated and color to red" },
bot_user: bot_user,
llm: llm_model.to_llm,
- context: DiscourseAi::Personas::BotContext.new(messages: [], post: post),
- persona_options: {
+ context: DiscourseAi::Agents::BotContext.new(messages: [], post: post),
+ agent_options: {
"update_algorithm" => "diff",
},
)
@@ -373,8 +373,8 @@ RSpec.describe DiscourseAi::Personas::Tools::UpdateArtifact do
{ artifact_id: artifact.id, instructions: "Change the text to Updated and color to red" },
bot_user: bot_user,
llm: llm_model.to_llm,
- context: DiscourseAi::Personas::BotContext.new(messages: [], post: post),
- persona_options: {
+ context: DiscourseAi::Agents::BotContext.new(messages: [], post: post),
+ agent_options: {
"update_algorithm" => "diff",
},
)
diff --git a/plugins/discourse-ai/spec/lib/personas/tools/web_browser_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/web_browser_spec.rb
similarity index 98%
rename from plugins/discourse-ai/spec/lib/personas/tools/web_browser_spec.rb
rename to plugins/discourse-ai/spec/lib/agents/tools/web_browser_spec.rb
index cccd883338b..57763876930 100644
--- a/plugins/discourse-ai/spec/lib/personas/tools/web_browser_spec.rb
+++ b/plugins/discourse-ai/spec/lib/agents/tools/web_browser_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Personas::Tools::WebBrowser do
+RSpec.describe DiscourseAi::Agents::Tools::WebBrowser do
fab!(:llm_model)
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }
diff --git a/plugins/discourse-ai/spec/lib/automation/llm_tagger_spec.rb b/plugins/discourse-ai/spec/lib/automation/llm_tagger_spec.rb
index 2b027fdfdcd..83c7a2a2bf7 100644
--- a/plugins/discourse-ai/spec/lib/automation/llm_tagger_spec.rb
+++ b/plugins/discourse-ai/spec/lib/automation/llm_tagger_spec.rb
@@ -4,13 +4,13 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
fab!(:user)
fab!(:topic) { Fabricate(:topic, user: user) }
fab!(:post) { Fabricate(:post, topic: topic, user: user, post_number: 1) }
- fab!(:ai_persona)
+ fab!(:ai_agent)
fab!(:llm_model)
before do
enable_current_plugin
SiteSetting.tagging_enabled = true
- ai_persona.update!(default_llm: llm_model)
+ ai_agent.update!(default_llm: llm_model)
Fabricate(:tag, name: "bug")
Fabricate(:tag, name: "feature")
@@ -23,9 +23,9 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
before do
automation.fields.create!(
component: "choices",
- name: "tagger_persona",
+ name: "tagger_agent",
metadata: {
- value: ai_persona.id,
+ value: ai_agent.id,
},
target: "script",
)
@@ -72,7 +72,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
available_tags: available_tags,
confidence_threshold: 70,
max_tags: 3,
@@ -91,7 +91,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
available_tags: available_tags,
confidence_threshold: 70,
max_tags: 3,
@@ -110,7 +110,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
available_tags: available_tags,
confidence_threshold: 70,
max_tags: 3,
@@ -131,7 +131,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
available_tags: available_tags,
confidence_threshold: 70,
max_tags: 2,
@@ -148,7 +148,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses(["invalid json"]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
available_tags: available_tags,
confidence_threshold: 70,
max_tags: 3,
@@ -169,7 +169,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
tag_mode: "discover",
available_tags: [],
confidence_threshold: 70,
@@ -191,7 +191,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
tag_mode: "discover",
available_tags: %w[bug feature], # discovery tag not in this list
confidence_threshold: 70,
@@ -210,7 +210,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
tag_mode: "discover",
available_tags: [],
confidence_threshold: 70,
@@ -234,7 +234,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
tag_mode: "discover",
available_tags: [],
confidence_threshold: 70,
@@ -269,7 +269,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
tag_mode: "discover",
available_tags: [],
confidence_threshold: 70,
@@ -288,7 +288,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
tag_mode: "discover",
available_tags: [],
confidence_threshold: 70,
@@ -311,7 +311,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
available_tags: available_tags,
confidence_threshold: 70,
max_tags: 3,
@@ -325,7 +325,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
it "skips processing when manual mode has no available tags" do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
tag_mode: "manual",
available_tags: [],
confidence_threshold: 70,
@@ -365,7 +365,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
available_tags: available_tags,
confidence_threshold: 70,
max_tags: 3,
@@ -384,7 +384,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
available_tags: available_tags,
confidence_threshold: 70,
max_tags: 3,
@@ -410,7 +410,7 @@ RSpec.describe DiscourseAi::Automation::LlmTagger do
DiscourseAi::Completions::Llm.with_prepared_responses([mock_response]) do
described_class.handle(
post: system_post,
- tagger_persona_id: ai_persona.id,
+ tagger_agent_id: ai_agent.id,
available_tags: available_tags,
confidence_threshold: 70,
max_tags: 3,
diff --git a/plugins/discourse-ai/spec/lib/discord/bot/agent_replier_spec.rb b/plugins/discourse-ai/spec/lib/discord/bot/agent_replier_spec.rb
new file mode 100644
index 00000000000..6b47999f317
--- /dev/null
+++ b/plugins/discourse-ai/spec/lib/discord/bot/agent_replier_spec.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+RSpec.describe DiscourseAi::Discord::Bot::AgentReplier do
+ let(:interaction_body) do
+ { data: { options: [{ value: "test query" }] }, token: "interaction_token" }.to_json.to_s
+ end
+ let(:agent_replier) { described_class.new(interaction_body) }
+
+ fab!(:llm_model)
+ fab!(:agent) { Fabricate(:ai_agent, default_llm_id: llm_model.id) }
+
+ before do
+ enable_current_plugin
+ SiteSetting.ai_discord_search_agent = agent.id.to_s
+ allow_any_instance_of(DiscourseAi::Agents::Bot).to receive(:reply).and_return(
+ "This is a reply from bot!",
+ )
+ allow(agent_replier).to receive(:create_reply)
+ end
+
+ describe "#handle_interaction!" do
+ it "creates and updates replies" do
+ agent_replier.handle_interaction!
+ expect(agent_replier).to have_received(:create_reply).at_least(:once)
+ end
+
+ it "uses a BotContext to generate the reply" do
+ expect_any_instance_of(DiscourseAi::Agents::Bot).to receive(:reply) do |bot, context|
+ expect(context).to be_a(DiscourseAi::Agents::BotContext)
+ [["This is a reply from bot!"]]
+ end
+
+ agent_replier.handle_interaction!
+ end
+ end
+end
diff --git a/plugins/discourse-ai/spec/lib/discord/bot/persona_replier_spec.rb b/plugins/discourse-ai/spec/lib/discord/bot/persona_replier_spec.rb
deleted file mode 100644
index d6f9a0ac9bf..00000000000
--- a/plugins/discourse-ai/spec/lib/discord/bot/persona_replier_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe DiscourseAi::Discord::Bot::PersonaReplier do
- let(:interaction_body) do
- { data: { options: [{ value: "test query" }] }, token: "interaction_token" }.to_json.to_s
- end
- let(:persona_replier) { described_class.new(interaction_body) }
-
- fab!(:llm_model)
- fab!(:persona) { Fabricate(:ai_persona, default_llm_id: llm_model.id) }
-
- before do
- enable_current_plugin
- SiteSetting.ai_discord_search_persona = persona.id.to_s
- allow_any_instance_of(DiscourseAi::Personas::Bot).to receive(:reply).and_return(
- "This is a reply from bot!",
- )
- allow(persona_replier).to receive(:create_reply)
- end
-
- describe "#handle_interaction!" do
- it "creates and updates replies" do
- persona_replier.handle_interaction!
- expect(persona_replier).to have_received(:create_reply).at_least(:once)
- end
-
- it "uses a BotContext to generate the reply" do
- expect_any_instance_of(DiscourseAi::Personas::Bot).to receive(:reply) do |bot, context|
- expect(context).to be_a(DiscourseAi::Personas::BotContext)
- [["This is a reply from bot!"]]
- end
-
- persona_replier.handle_interaction!
- end
- end
-end
diff --git a/plugins/discourse-ai/spec/lib/discord/bot/search_spec.rb b/plugins/discourse-ai/spec/lib/discord/bot/search_spec.rb
index 14a74bbaf39..1fee27287bc 100644
--- a/plugins/discourse-ai/spec/lib/discord/bot/search_spec.rb
+++ b/plugins/discourse-ai/spec/lib/discord/bot/search_spec.rb
@@ -20,7 +20,7 @@ RSpec.describe DiscourseAi::Discord::Bot::Search do
describe "#handle_interaction!" do
it "creates a reply with search results" do
- allow_any_instance_of(DiscourseAi::Personas::Tools::Search).to receive(:invoke).and_return(
+ allow_any_instance_of(DiscourseAi::Agents::Tools::Search).to receive(:invoke).and_return(
{ rows: [%w[Title /link]] },
)
search.handle_interaction!
diff --git a/plugins/discourse-ai/spec/lib/discourse_automation/llm_persona_triage_spec.rb b/plugins/discourse-ai/spec/lib/discourse_automation/llm_agent_triage_spec.rb
similarity index 92%
rename from plugins/discourse-ai/spec/lib/discourse_automation/llm_persona_triage_spec.rb
rename to plugins/discourse-ai/spec/lib/discourse_automation/llm_agent_triage_spec.rb
index 84bb6b7942c..1d37df62d97 100644
--- a/plugins/discourse-ai/spec/lib/discourse_automation/llm_persona_triage_spec.rb
+++ b/plugins/discourse-ai/spec/lib/discourse_automation/llm_agent_triage_spec.rb
@@ -2,29 +2,29 @@
return if !defined?(DiscourseAutomation)
-describe DiscourseAi::Automation::LlmPersonaTriage do
+describe DiscourseAi::Automation::LlmAgentTriage do
fab!(:user)
fab!(:bot_user, :user)
fab!(:llm_model) { Fabricate(:anthropic_model, name: "claude-3-opus") }
- fab!(:ai_persona) do
- persona =
+ fab!(:ai_agent) do
+ agent =
Fabricate(
- :ai_persona,
+ :ai_agent,
name: "Triage Helper",
- description: "A persona that helps with triaging posts",
+ description: "A agent that helps with triaging posts",
system_prompt: "You are a helpful assistant that triages posts",
default_llm: llm_model,
)
- # Create the user for this persona
- persona.update!(user_id: bot_user.id)
- persona
+ # Create the user for this agent
+ agent.update!(user_id: bot_user.id)
+ agent
end
let(:automation) do
- Fabricate(:automation, name: "my automation", script: "llm_persona_triage", enabled: true)
+ Fabricate(:automation, name: "my automation", script: "llm_agent_triage", enabled: true)
end
def add_automation_field(name, value, type: "text")
@@ -44,11 +44,11 @@ describe DiscourseAi::Automation::LlmPersonaTriage do
SiteSetting.ai_bot_enabled = true
SiteSetting.ai_bot_allowed_groups = "#{Group::AUTO_GROUPS[:trust_level_0]}"
- add_automation_field("persona", ai_persona.id, type: "choices")
+ add_automation_field("agent", ai_agent.id, type: "choices")
add_automation_field("whisper", false, type: "boolean")
end
- it "can respond to a post using the specified persona" do
+ it "can respond to a post using the specified agent" do
post = Fabricate(:post, raw: "This is a test post that needs triage")
response_text = "I analyzed your post and can help with that."
@@ -91,7 +91,7 @@ describe DiscourseAi::Automation::LlmPersonaTriage do
expect(topic.posts.count).to eq(2)
- # Verify that the response was posted by the persona's user
+ # Verify that the response was posted by the agent's user
expect(last_post.user_id).to eq(bot_user.id)
expect(last_post.raw).to eq(response_text)
expect(last_post.post_type).to eq(Post.types[:regular]) # Not a whisper
@@ -118,7 +118,7 @@ describe DiscourseAi::Automation::LlmPersonaTriage do
expect(last_post.raw).to eq(response_text)
end
- it "hides thinking output when the persona is configured to do so" do
+ it "hides thinking output when the agent is configured to do so" do
post = Fabricate(:post, raw: "This is a test post that needs triage")
thinking =
@@ -180,7 +180,7 @@ describe DiscourseAi::Automation::LlmPersonaTriage do
post = Fabricate(:post, raw: "Error-triggering post")
# Set up to cause an error
- ai_persona.update!(user_id: nil)
+ ai_agent.update!(user_id: nil)
# Should not raise an error
expect {
@@ -311,11 +311,11 @@ describe DiscourseAi::Automation::LlmPersonaTriage do
topic = reply.topic
- # should not inject persona into allowed users
+ # should not inject agent into allowed users
expect(topic.topic_allowed_users.pluck(:user_id).sort).to eq(original_user_ids.sort)
end
- describe "LLM Persona Triage with Chat Message Creation" do
+ describe "LLM Agent Triage with Chat Message Creation" do
fab!(:user)
fab!(:bot_user, :user)
fab!(:chat_channel, :category_channel)
@@ -356,14 +356,14 @@ describe DiscourseAi::Automation::LlmPersonaTriage do
before do
SiteSetting.chat_enabled = true
- ai_persona.update!(tools: ["custom-#{custom_tool.id}"])
+ ai_agent.update!(tools: ["custom-#{custom_tool.id}"])
# Set up automation fields
automation.fields.create!(
component: "choices",
- name: "persona",
+ name: "agent",
metadata: {
- value: ai_persona.id,
+ value: ai_agent.id,
},
target: "script",
)
diff --git a/plugins/discourse-ai/spec/lib/discourse_automation/llm_report_spec.rb b/plugins/discourse-ai/spec/lib/discourse_automation/llm_report_spec.rb
index d6d2f467598..5851a38dc6e 100644
--- a/plugins/discourse-ai/spec/lib/discourse_automation/llm_report_spec.rb
+++ b/plugins/discourse-ai/spec/lib/discourse_automation/llm_report_spec.rb
@@ -27,8 +27,8 @@ describe DiscourseAutomation do
add_automation_field("sender", user.username, type: "user")
add_automation_field("receivers", [user.username], type: "email_group_user")
add_automation_field(
- "persona_id",
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::ReportRunner],
+ "agent_id",
+ DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::ReportRunner],
)
add_automation_field("model", llm_model.id)
@@ -46,8 +46,8 @@ describe DiscourseAutomation do
add_automation_field("sender", user.username, type: "user")
add_automation_field("topic_id", "#{post.topic_id}")
add_automation_field(
- "persona_id",
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::ReportRunner],
+ "agent_id",
+ DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::ReportRunner],
)
add_automation_field("model", llm_model.id)
diff --git a/plugins/discourse-ai/spec/lib/discourse_automation/llm_triage_spec.rb b/plugins/discourse-ai/spec/lib/discourse_automation/llm_triage_spec.rb
index d2506cff7f8..7fbc456a73c 100644
--- a/plugins/discourse-ai/spec/lib/discourse_automation/llm_triage_spec.rb
+++ b/plugins/discourse-ai/spec/lib/discourse_automation/llm_triage_spec.rb
@@ -11,7 +11,7 @@ describe DiscourseAi::Automation::LlmTriage do
let(:automation) { Fabricate(:automation, script: "llm_triage", enabled: true) }
fab!(:llm_model)
- fab!(:ai_persona)
+ fab!(:ai_agent)
def add_automation_field(name, value, type: "text")
automation.fields.create!(
@@ -29,9 +29,9 @@ describe DiscourseAi::Automation::LlmTriage do
SiteSetting.tagging_enabled = true
- ai_persona.update!(default_llm: llm_model)
+ ai_agent.update!(default_llm: llm_model)
- add_automation_field("triage_persona", ai_persona.id)
+ add_automation_field("triage_agent", ai_agent.id)
add_automation_field("search_for_text", "bad")
add_automation_field("category", category.id, type: "category")
add_automation_field("tags", %w[aaa bbb], type: "tags")
@@ -114,7 +114,7 @@ describe DiscourseAi::Automation::LlmTriage do
# PM
reply_user.update!(admin: true)
add_automation_field("include_personal_messages", true, type: :boolean)
- ai_persona.update!(temperature: 0.2)
+ ai_agent.update!(temperature: 0.2)
add_automation_field("max_output_tokens", "700")
post = Fabricate(:post, topic: personal_message)
@@ -146,11 +146,11 @@ describe DiscourseAi::Automation::LlmTriage do
expect(last_post.raw).to eq post.raw
end
- it "can respond using an AI persona when configured" do
+ it "can respond using an AI agent when configured" do
bot_user = Fabricate(:user, username: "ai_assistant")
- ai_persona =
+ ai_agent =
Fabricate(
- :ai_persona,
+ :ai_agent,
name: "Help Bot",
description: "AI assistant for forum help",
system_prompt: "You are a helpful forum assistant",
@@ -158,16 +158,16 @@ describe DiscourseAi::Automation::LlmTriage do
user_id: bot_user.id,
)
- # Configure the automation to use the persona instead of canned reply
+ # Configure the automation to use the agent instead of canned reply
add_automation_field("canned_reply", nil, type: "message") # Clear canned reply
- add_automation_field("reply_persona", ai_persona.id, type: "choices")
+ add_automation_field("reply_agent", ai_agent.id, type: "choices")
add_automation_field("whisper", true, type: "boolean")
post = Fabricate(:post, raw: "I need help with a problem")
ai_response = "I'll help you with your problem!"
- # Set up the test to provide both the triage and the persona responses
+ # Set up the test to provide both the triage and the agent responses
DiscourseAi::Completions::Llm.with_prepared_responses(["bad", ai_response]) do
automation.running_in_background!
automation.trigger!({ "post" => post })
@@ -177,7 +177,7 @@ describe DiscourseAi::Automation::LlmTriage do
topic = post.topic.reload
last_post = topic.posts.order(:post_number).last
- # Verify the AI persona's user created the post
+ # Verify the AI agent's user created the post
expect(last_post.user_id).to eq(bot_user.id)
# Verify the content matches the AI response
@@ -188,11 +188,11 @@ describe DiscourseAi::Automation::LlmTriage do
end
it "does not create replies when the action is edit" do
- # Set up bot user and persona
+ # Set up bot user and agent
bot_user = Fabricate(:user, username: "helper_bot")
- ai_persona =
+ ai_agent =
Fabricate(
- :ai_persona,
+ :ai_agent,
name: "Edit Helper",
description: "AI assistant for editing",
system_prompt: "You help with editing",
@@ -202,7 +202,7 @@ describe DiscourseAi::Automation::LlmTriage do
# Configure the automation with both reply methods
add_automation_field("canned_reply", "This is a canned reply", type: "message")
- add_automation_field("reply_persona", ai_persona.id, type: "choices")
+ add_automation_field("reply_agent", ai_agent.id, type: "choices")
# Create a post and capture its topic
post = Fabricate(:post, raw: "This needs to be evaluated")
@@ -237,7 +237,7 @@ describe DiscourseAi::Automation::LlmTriage do
end
it "excludes images when vision is disabled" do
- ai_persona.update!(vision_enabled: false)
+ ai_agent.update!(vision_enabled: false)
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do |_, _, prompts|
automation.running_in_background!
@@ -247,7 +247,7 @@ describe DiscourseAi::Automation::LlmTriage do
end
it "includes images when vision is enabled" do
- ai_persona.update!(vision_enabled: true)
+ ai_agent.update!(vision_enabled: true)
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do |_, _, prompts|
automation.running_in_background!
diff --git a/plugins/discourse-ai/spec/lib/guardian_extensions_spec.rb b/plugins/discourse-ai/spec/lib/guardian_extensions_spec.rb
index d04445acc5d..a1eb55d3fe3 100644
--- a/plugins/discourse-ai/spec/lib/guardian_extensions_spec.rb
+++ b/plugins/discourse-ai/spec/lib/guardian_extensions_spec.rb
@@ -18,7 +18,7 @@ describe DiscourseAi::GuardianExtensions do
describe "#can_see_summary?" do
context "when the user cannot generate a summary" do
- before { assign_persona_to(:ai_summarization_persona, []) }
+ before { assign_agent_to(:ai_summarization_agent, []) }
it "returns false" do
expect(guardian.can_see_summary?(topic)).to eq(false)
@@ -32,7 +32,7 @@ describe DiscourseAi::GuardianExtensions do
end
context "when the user can generate a summary" do
- before { assign_persona_to(:ai_summarization_persona, [group.id]) }
+ before { assign_agent_to(:ai_summarization_agent, [group.id]) }
it "returns true if the user group is present in the ai_custom_summarization_allowed_groups_map setting" do
expect(guardian.can_see_summary?(topic)).to eq(true)
@@ -40,7 +40,7 @@ describe DiscourseAi::GuardianExtensions do
end
context "when the topic is a PM" do
- before { assign_persona_to(:ai_summarization_persona, [group.id]) }
+ before { assign_agent_to(:ai_summarization_agent, [group.id]) }
let(:pm) { Fabricate(:private_message_topic) }
it "returns false" do
@@ -67,7 +67,7 @@ describe DiscourseAi::GuardianExtensions do
end
describe "#can_see_gists?" do
- before { assign_persona_to(:ai_summary_gists_persona, [group.id]) }
+ before { assign_agent_to(:ai_summary_gists_agent, [group.id]) }
let(:guardian) { Guardian.new(user) }
context "when access is restricted to the user's group" do
@@ -87,7 +87,7 @@ describe DiscourseAi::GuardianExtensions do
end
context "when access is set to everyone" do
- before { assign_persona_to(:ai_summary_gists_persona, [Group::AUTO_GROUPS[:everyone]]) }
+ before { assign_agent_to(:ai_summary_gists_agent, [Group::AUTO_GROUPS[:everyone]]) }
it "returns true" do
expect(guardian.can_see_gists?).to eq(true)
diff --git a/plugins/discourse-ai/spec/lib/inferred_concepts/applier_spec.rb b/plugins/discourse-ai/spec/lib/inferred_concepts/applier_spec.rb
index ac549c40cce..bf2b47df562 100644
--- a/plugins/discourse-ai/spec/lib/inferred_concepts/applier_spec.rb
+++ b/plugins/discourse-ai/spec/lib/inferred_concepts/applier_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe DiscourseAi::InferredConcepts::Applier do
before do
enable_current_plugin
- SiteSetting.inferred_concepts_match_persona = -1
+ SiteSetting.inferred_concepts_match_agent = -1
SiteSetting.inferred_concepts_enabled = true
# Set up the post's user
@@ -136,20 +136,20 @@ RSpec.describe DiscourseAi::InferredConcepts::Applier do
allow(InferredConcept).to receive(:where).with(name: ["programming"]).and_return([concept1])
# Mock the LLM interaction
- persona_instance_double = instance_spy("DiscourseAi::Personas::Persona")
- bot_double = instance_spy(DiscourseAi::Personas::Bot)
+ agent_instance_double = instance_spy("DiscourseAi::Agents::Agent")
+ bot_double = instance_spy(DiscourseAi::Agents::Bot)
structured_output_double = instance_double("DiscourseAi::Completions::StructuredOutput")
- persona_class_double = double("PersonaClass") # rubocop:disable RSpec/VerifiedDoubles
+ agent_class_double = double("AgentClass") # rubocop:disable RSpec/VerifiedDoubles
- allow(AiPersona).to receive(:all_personas).and_return([persona_class_double])
- allow(persona_class_double).to receive(:id).and_return(
- SiteSetting.inferred_concepts_match_persona.to_i,
+ allow(AiAgent).to receive(:all_agents).and_return([agent_class_double])
+ allow(agent_class_double).to receive(:id).and_return(
+ SiteSetting.inferred_concepts_match_agent.to_i,
)
- allow(persona_class_double).to receive(:new).and_return(persona_instance_double)
- allow(persona_class_double).to receive(:default_llm_id).and_return(llm_model.id)
- allow(persona_instance_double).to receive(:class).and_return(persona_class_double)
+ allow(agent_class_double).to receive(:new).and_return(agent_instance_double)
+ allow(agent_class_double).to receive(:default_llm_id).and_return(llm_model.id)
+ allow(agent_instance_double).to receive(:class).and_return(agent_class_double)
allow(LlmModel).to receive(:find).and_return(llm_model)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(bot_double)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(bot_double)
allow(bot_double).to receive(:reply).and_yield(
structured_output_double,
nil,
@@ -188,20 +188,20 @@ RSpec.describe DiscourseAi::InferredConcepts::Applier do
allow(InferredConcept).to receive(:where).with(name: ["testing"]).and_return([concept2])
# Mock the LLM interaction
- persona_instance_double = instance_spy("DiscourseAi::Personas::Persona")
- bot_double = instance_spy(DiscourseAi::Personas::Bot)
+ agent_instance_double = instance_spy("DiscourseAi::Agents::Agent")
+ bot_double = instance_spy(DiscourseAi::Agents::Bot)
structured_output_double = instance_double("DiscourseAi::Completions::StructuredOutput")
- persona_class_double = double("PersonaClass") # rubocop:disable RSpec/VerifiedDoubles
+ agent_class_double = double("AgentClass") # rubocop:disable RSpec/VerifiedDoubles
- allow(AiPersona).to receive(:all_personas).and_return([persona_class_double])
- allow(persona_class_double).to receive(:id).and_return(
- SiteSetting.inferred_concepts_match_persona.to_i,
+ allow(AiAgent).to receive(:all_agents).and_return([agent_class_double])
+ allow(agent_class_double).to receive(:id).and_return(
+ SiteSetting.inferred_concepts_match_agent.to_i,
)
- allow(persona_class_double).to receive(:new).and_return(persona_instance_double)
- allow(persona_class_double).to receive(:default_llm_id).and_return(llm_model.id)
- allow(persona_instance_double).to receive(:class).and_return(persona_class_double)
+ allow(agent_class_double).to receive(:new).and_return(agent_instance_double)
+ allow(agent_class_double).to receive(:default_llm_id).and_return(llm_model.id)
+ allow(agent_instance_double).to receive(:class).and_return(agent_class_double)
allow(LlmModel).to receive(:find).and_return(llm_model)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(bot_double)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(bot_double)
allow(bot_double).to receive(:reply).and_yield(
structured_output_double,
nil,
@@ -224,24 +224,24 @@ RSpec.describe DiscourseAi::InferredConcepts::Applier do
expect(applier.match_concepts_to_content("content", nil)).to eq([])
end
- it "uses ConceptMatcher persona to match concepts" do
+ it "uses ConceptMatcher agent to match concepts" do
content = "This is about Ruby programming"
concept_list = %w[programming testing ruby]
structured_output_double = instance_double("DiscourseAi::Completions::StructuredOutput")
- persona_class_double = double("PersonaClass") # rubocop:disable RSpec/VerifiedDoubles
- persona_instance_double = instance_spy("DiscourseAi::Personas::Persona")
- bot_double = instance_spy(DiscourseAi::Personas::Bot)
+ agent_class_double = double("AgentClass") # rubocop:disable RSpec/VerifiedDoubles
+ agent_instance_double = instance_spy("DiscourseAi::Agents::Agent")
+ bot_double = instance_spy(DiscourseAi::Agents::Bot)
- allow(AiPersona).to receive(:all_personas).and_return([persona_class_double])
- allow(persona_class_double).to receive(:id).and_return(
- SiteSetting.inferred_concepts_match_persona.to_i,
+ allow(AiAgent).to receive(:all_agents).and_return([agent_class_double])
+ allow(agent_class_double).to receive(:id).and_return(
+ SiteSetting.inferred_concepts_match_agent.to_i,
)
- allow(persona_class_double).to receive(:new).and_return(persona_instance_double)
- allow(persona_class_double).to receive(:default_llm_id).and_return(llm_model.id)
- allow(persona_instance_double).to receive(:class).and_return(persona_class_double)
+ allow(agent_class_double).to receive(:new).and_return(agent_instance_double)
+ allow(agent_class_double).to receive(:default_llm_id).and_return(llm_model.id)
+ allow(agent_instance_double).to receive(:class).and_return(agent_class_double)
allow(LlmModel).to receive(:find).and_return(llm_model)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(bot_double)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(bot_double)
allow(bot_double).to receive(:reply).and_yield(
structured_output_double,
nil,
@@ -264,19 +264,19 @@ RSpec.describe DiscourseAi::InferredConcepts::Applier do
content = "Test content"
concept_list = ["concept1"]
- persona_class_double = double("PersonaClass") # rubocop:disable RSpec/VerifiedDoubles
- persona_instance_double = instance_double("DiscourseAi::Personas::Persona")
- bot_double = instance_double("DiscourseAi::Personas::Bot")
+ agent_class_double = double("AgentClass") # rubocop:disable RSpec/VerifiedDoubles
+ agent_instance_double = instance_double("DiscourseAi::Agents::Agent")
+ bot_double = instance_double("DiscourseAi::Agents::Bot")
- allow(AiPersona).to receive(:all_personas).and_return([persona_class_double])
- allow(persona_class_double).to receive(:id).and_return(
- SiteSetting.inferred_concepts_match_persona.to_i,
+ allow(AiAgent).to receive(:all_agents).and_return([agent_class_double])
+ allow(agent_class_double).to receive(:id).and_return(
+ SiteSetting.inferred_concepts_match_agent.to_i,
)
- allow(persona_class_double).to receive(:new).and_return(persona_instance_double)
- allow(persona_class_double).to receive(:default_llm_id).and_return(llm_model.id)
- allow(persona_instance_double).to receive(:class).and_return(persona_class_double)
+ allow(agent_class_double).to receive(:new).and_return(agent_instance_double)
+ allow(agent_class_double).to receive(:default_llm_id).and_return(llm_model.id)
+ allow(agent_instance_double).to receive(:class).and_return(agent_class_double)
allow(LlmModel).to receive(:find).and_return(llm_model)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(bot_double)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(bot_double)
allow(bot_double).to receive(:reply).and_yield(nil, nil, :text)
result = applier.match_concepts_to_content(content, concept_list)
@@ -288,19 +288,19 @@ RSpec.describe DiscourseAi::InferredConcepts::Applier do
concept_list = %w[programming testing]
expected_response = [['{"matching_concepts": []}']]
- persona_class_double = double("PersonaClass") # rubocop:disable RSpec/VerifiedDoubles
- persona_instance_double = instance_double("DiscourseAi::Personas::Persona")
- bot_double = instance_double("DiscourseAi::Personas::Bot")
+ agent_class_double = double("AgentClass") # rubocop:disable RSpec/VerifiedDoubles
+ agent_instance_double = instance_double("DiscourseAi::Agents::Agent")
+ bot_double = instance_double("DiscourseAi::Agents::Bot")
- allow(AiPersona).to receive(:all_personas).and_return([persona_class_double])
- allow(persona_class_double).to receive(:id).and_return(
- SiteSetting.inferred_concepts_match_persona.to_i,
+ allow(AiAgent).to receive(:all_agents).and_return([agent_class_double])
+ allow(agent_class_double).to receive(:id).and_return(
+ SiteSetting.inferred_concepts_match_agent.to_i,
)
- allow(persona_class_double).to receive(:new).and_return(persona_instance_double)
- allow(persona_class_double).to receive(:default_llm_id).and_return(llm_model.id)
- allow(persona_instance_double).to receive(:class).and_return(persona_class_double)
+ allow(agent_class_double).to receive(:new).and_return(agent_instance_double)
+ allow(agent_class_double).to receive(:default_llm_id).and_return(llm_model.id)
+ allow(agent_instance_double).to receive(:class).and_return(agent_class_double)
allow(LlmModel).to receive(:find).and_return(llm_model)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(bot_double)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(bot_double)
allow(bot_double).to receive(:reply).and_return(expected_response)
result = applier.match_concepts_to_content(content, concept_list)
@@ -312,19 +312,19 @@ RSpec.describe DiscourseAi::InferredConcepts::Applier do
concept_list = ["concept1"]
expected_response = [['{"other_key": ["value"]}']]
- persona_class_double = double("PersonaClass") # rubocop:disable RSpec/VerifiedDoubles
- persona_instance_double = instance_double("DiscourseAi::Personas::Persona")
- bot_double = instance_double("DiscourseAi::Personas::Bot")
+ agent_class_double = double("AgentClass") # rubocop:disable RSpec/VerifiedDoubles
+ agent_instance_double = instance_double("DiscourseAi::Agents::Agent")
+ bot_double = instance_double("DiscourseAi::Agents::Bot")
- allow(AiPersona).to receive(:all_personas).and_return([persona_class_double])
- allow(persona_class_double).to receive(:id).and_return(
- SiteSetting.inferred_concepts_match_persona.to_i,
+ allow(AiAgent).to receive(:all_agents).and_return([agent_class_double])
+ allow(agent_class_double).to receive(:id).and_return(
+ SiteSetting.inferred_concepts_match_agent.to_i,
)
- allow(persona_class_double).to receive(:new).and_return(persona_instance_double)
- allow(persona_class_double).to receive(:default_llm_id).and_return(llm_model.id)
- allow(persona_instance_double).to receive(:class).and_return(persona_class_double)
+ allow(agent_class_double).to receive(:new).and_return(agent_instance_double)
+ allow(agent_class_double).to receive(:default_llm_id).and_return(llm_model.id)
+ allow(agent_instance_double).to receive(:class).and_return(agent_class_double)
allow(LlmModel).to receive(:find).and_return(llm_model)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(bot_double)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(bot_double)
allow(bot_double).to receive(:reply).and_return(expected_response)
result = applier.match_concepts_to_content(content, concept_list)
diff --git a/plugins/discourse-ai/spec/lib/inferred_concepts/finder_spec.rb b/plugins/discourse-ai/spec/lib/inferred_concepts/finder_spec.rb
index d9176b408ed..e0121f092c2 100644
--- a/plugins/discourse-ai/spec/lib/inferred_concepts/finder_spec.rb
+++ b/plugins/discourse-ai/spec/lib/inferred_concepts/finder_spec.rb
@@ -11,8 +11,8 @@ RSpec.describe DiscourseAi::InferredConcepts::Finder do
before do
enable_current_plugin
- SiteSetting.inferred_concepts_generate_persona = -1
- SiteSetting.inferred_concepts_deduplicate_persona = -1
+ SiteSetting.inferred_concepts_generate_agent = -1
+ SiteSetting.inferred_concepts_deduplicate_agent = -1
SiteSetting.inferred_concepts_enabled = true
end
@@ -22,24 +22,24 @@ RSpec.describe DiscourseAi::InferredConcepts::Finder do
expect(finder.identify_concepts(nil)).to eq([])
end
- it "uses ConceptFinder persona to identify concepts" do
+ it "uses ConceptFinder agent to identify concepts" do
content = "This is about Ruby programming and testing"
structured_output_double = instance_double("DiscourseAi::Completions::StructuredOutput")
- # Mock the persona and bot interaction
- persona_class_double = double("PersonaClass") # rubocop:disable RSpec/VerifiedDoubles
- persona_instance_double = double("PersonaInstance") # rubocop:disable RSpec/VerifiedDoubles
- bot_double = instance_double("DiscourseAi::Personas::Bot")
+ # Mock the agent and bot interaction
+ agent_class_double = double("AgentClass") # rubocop:disable RSpec/VerifiedDoubles
+ agent_instance_double = double("AgentInstance") # rubocop:disable RSpec/VerifiedDoubles
+ bot_double = instance_double("DiscourseAi::Agents::Bot")
- allow(AiPersona).to receive(:all_personas).and_return([persona_class_double])
- allow(persona_class_double).to receive(:id).and_return(
- SiteSetting.inferred_concepts_generate_persona.to_i,
+ allow(AiAgent).to receive(:all_agents).and_return([agent_class_double])
+ allow(agent_class_double).to receive(:id).and_return(
+ SiteSetting.inferred_concepts_generate_agent.to_i,
)
- allow(persona_class_double).to receive(:new).and_return(persona_instance_double)
- allow(persona_instance_double).to receive(:class).and_return(persona_class_double)
- allow(persona_class_double).to receive(:default_llm_id).and_return(llm_model.id)
+ allow(agent_class_double).to receive(:new).and_return(agent_instance_double)
+ allow(agent_instance_double).to receive(:class).and_return(agent_class_double)
+ allow(agent_class_double).to receive(:default_llm_id).and_return(llm_model.id)
allow(LlmModel).to receive(:find).with(llm_model.id).and_return(llm_model)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(bot_double)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(bot_double)
allow(bot_double).to receive(:reply).and_yield(
structured_output_double,
nil,
@@ -56,19 +56,19 @@ RSpec.describe DiscourseAi::InferredConcepts::Finder do
it "handles no structured output gracefully" do
content = "Test content"
- persona_class_double = double("PersonaClass") # rubocop:disable RSpec/VerifiedDoubles
- persona_instance_double = double("PersonaInstance") # rubocop:disable RSpec/VerifiedDoubles
- bot_double = instance_double("DiscourseAi::Personas::Bot")
+ agent_class_double = double("AgentClass") # rubocop:disable RSpec/VerifiedDoubles
+ agent_instance_double = double("AgentInstance") # rubocop:disable RSpec/VerifiedDoubles
+ bot_double = instance_double("DiscourseAi::Agents::Bot")
- allow(AiPersona).to receive(:all_personas).and_return([persona_class_double])
- allow(persona_class_double).to receive(:id).and_return(
- SiteSetting.inferred_concepts_generate_persona.to_i,
+ allow(AiAgent).to receive(:all_agents).and_return([agent_class_double])
+ allow(agent_class_double).to receive(:id).and_return(
+ SiteSetting.inferred_concepts_generate_agent.to_i,
)
- allow(persona_class_double).to receive(:new).and_return(persona_instance_double)
- allow(persona_instance_double).to receive(:class).and_return(persona_class_double)
- allow(persona_class_double).to receive(:default_llm_id).and_return(llm_model.id)
+ allow(agent_class_double).to receive(:new).and_return(agent_instance_double)
+ allow(agent_instance_double).to receive(:class).and_return(agent_class_double)
+ allow(agent_class_double).to receive(:default_llm_id).and_return(llm_model.id)
allow(LlmModel).to receive(:find).with(llm_model.id).and_return(llm_model)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(bot_double)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(bot_double)
allow(bot_double).to receive(:reply).and_yield(nil, nil, :text)
result = finder.identify_concepts(content)
@@ -227,23 +227,23 @@ RSpec.describe DiscourseAi::InferredConcepts::Finder do
expect(result).to eq({ deduplicated_concepts: [], mapping: {} })
end
- it "uses ConceptDeduplicator persona to deduplicate concepts" do
+ it "uses ConceptDeduplicator agent to deduplicate concepts" do
concept_names = ["ruby", "Ruby programming", "testing", "unit testing"]
structured_output_double = instance_double("DiscourseAi::Completions::StructuredOutput")
- persona_class_double = double("PersonaClass") # rubocop:disable RSpec/VerifiedDoubles
- persona_instance_double = double("PersonaInstance") # rubocop:disable RSpec/VerifiedDoubles
- bot_double = instance_double("DiscourseAi::Personas::Bot")
+ agent_class_double = double("AgentClass") # rubocop:disable RSpec/VerifiedDoubles
+ agent_instance_double = double("AgentInstance") # rubocop:disable RSpec/VerifiedDoubles
+ bot_double = instance_double("DiscourseAi::Agents::Bot")
- allow(AiPersona).to receive(:all_personas).and_return([persona_class_double])
- allow(persona_class_double).to receive(:id).and_return(
- SiteSetting.inferred_concepts_deduplicate_persona.to_i,
+ allow(AiAgent).to receive(:all_agents).and_return([agent_class_double])
+ allow(agent_class_double).to receive(:id).and_return(
+ SiteSetting.inferred_concepts_deduplicate_agent.to_i,
)
- allow(persona_class_double).to receive(:new).and_return(persona_instance_double)
- allow(persona_instance_double).to receive(:class).and_return(persona_class_double)
- allow(persona_class_double).to receive(:default_llm_id).and_return(llm_model.id)
+ allow(agent_class_double).to receive(:new).and_return(agent_instance_double)
+ allow(agent_instance_double).to receive(:class).and_return(agent_class_double)
+ allow(agent_class_double).to receive(:default_llm_id).and_return(llm_model.id)
allow(LlmModel).to receive(:find).with(llm_model.id).and_return(llm_model)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(bot_double)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(bot_double)
allow(bot_double).to receive(:reply).and_yield(
structured_output_double,
nil,
@@ -260,19 +260,19 @@ RSpec.describe DiscourseAi::InferredConcepts::Finder do
it "handles no structured output gracefully" do
concept_names = %w[concept1 concept2]
- persona_class_double = double("PersonaClass") # rubocop:disable RSpec/VerifiedDoubles
- persona_instance_double = double("PersonaInstance") # rubocop:disable RSpec/VerifiedDoubles
- bot_double = instance_double("DiscourseAi::Personas::Bot")
+ agent_class_double = double("AgentClass") # rubocop:disable RSpec/VerifiedDoubles
+ agent_instance_double = double("AgentInstance") # rubocop:disable RSpec/VerifiedDoubles
+ bot_double = instance_double("DiscourseAi::Agents::Bot")
- allow(AiPersona).to receive(:all_personas).and_return([persona_class_double])
- allow(persona_class_double).to receive(:id).and_return(
- SiteSetting.inferred_concepts_deduplicate_persona.to_i,
+ allow(AiAgent).to receive(:all_agents).and_return([agent_class_double])
+ allow(agent_class_double).to receive(:id).and_return(
+ SiteSetting.inferred_concepts_deduplicate_agent.to_i,
)
- allow(persona_class_double).to receive(:new).and_return(persona_instance_double)
- allow(persona_instance_double).to receive(:class).and_return(persona_class_double)
- allow(persona_class_double).to receive(:default_llm_id).and_return(llm_model.id)
+ allow(agent_class_double).to receive(:new).and_return(agent_instance_double)
+ allow(agent_instance_double).to receive(:class).and_return(agent_class_double)
+ allow(agent_class_double).to receive(:default_llm_id).and_return(llm_model.id)
allow(LlmModel).to receive(:find).with(llm_model.id).and_return(llm_model)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(bot_double)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(bot_double)
allow(bot_double).to receive(:reply).and_yield(nil, nil, :text)
result = finder.deduplicate_concepts(concept_names)
diff --git a/plugins/discourse-ai/spec/lib/inferred_concepts/manager_spec.rb b/plugins/discourse-ai/spec/lib/inferred_concepts/manager_spec.rb
index 554710045e2..b186cc9d12e 100644
--- a/plugins/discourse-ai/spec/lib/inferred_concepts/manager_spec.rb
+++ b/plugins/discourse-ai/spec/lib/inferred_concepts/manager_spec.rb
@@ -31,7 +31,7 @@ RSpec.describe DiscourseAi::InferredConcepts::Manager do
describe "#generate_concepts_from_content" do
before do
- SiteSetting.inferred_concepts_generate_persona = -1
+ SiteSetting.inferred_concepts_generate_agent = -1
SiteSetting.inferred_concepts_enabled = true
end
diff --git a/plugins/discourse-ai/spec/lib/modules/ai_bot/entry_point_spec.rb b/plugins/discourse-ai/spec/lib/modules/ai_bot/entry_point_spec.rb
index 7d524aa5404..89429626b95 100644
--- a/plugins/discourse-ai/spec/lib/modules/ai_bot/entry_point_spec.rb
+++ b/plugins/discourse-ai/spec/lib/modules/ai_bot/entry_point_spec.rb
@@ -54,39 +54,39 @@ RSpec.describe DiscourseAi::AiBot::EntryPoint do
it "adds information about forcing default llm to current_user_serializer" do
Group.refresh_automatic_groups!
- persona =
+ agent =
Fabricate(
- :ai_persona,
+ :ai_agent,
enabled: true,
allowed_group_ids: [bot_allowed_group.id],
default_llm_id: claude_2.id,
force_default_llm: true,
)
- persona.create_user!
+ agent.create_user!
serializer = CurrentUserSerializer.new(admin, scope: Guardian.new(admin))
serializer = serializer.as_json
bots = serializer[:current_user][:ai_enabled_chat_bots]
- persona_bot = bots.find { |bot| bot["id"] == persona.user_id }
+ agent_bot = bots.find { |bot| bot["id"] == agent.user_id }
- expect(persona_bot["username"]).to eq(persona.user.username)
- expect(persona_bot["force_default_llm"]).to eq(true)
+ expect(agent_bot["username"]).to eq(agent.user.username)
+ expect(agent_bot["force_default_llm"]).to eq(true)
end
- it "includes user ids for all personas in the serializer" do
+ it "includes user ids for all agents in the serializer" do
Group.refresh_automatic_groups!
- persona = Fabricate(:ai_persona, enabled: true, allowed_group_ids: [bot_allowed_group.id])
- persona.create_user!
+ agent = Fabricate(:ai_agent, enabled: true, allowed_group_ids: [bot_allowed_group.id])
+ agent.create_user!
serializer = CurrentUserSerializer.new(admin, scope: Guardian.new(admin))
serializer = serializer.as_json
bots = serializer[:current_user][:ai_enabled_chat_bots]
- persona_bot = bots.find { |bot| bot["id"] == persona.user_id }
- expect(persona_bot["username"]).to eq(persona.user.username)
- expect(persona_bot["force_default_llm"]).to eq(false)
+ agent_bot = bots.find { |bot| bot["id"] == agent.user_id }
+ expect(agent_bot["username"]).to eq(agent.user.username)
+ expect(agent_bot["force_default_llm"]).to eq(false)
end
it "queues a job to generate a reply by the AI" do
@@ -178,9 +178,9 @@ RSpec.describe DiscourseAi::AiBot::EntryPoint do
end
end
- it "will include ai_search_discoveries field in the user_option if discover persona is enabled" do
+ it "will include ai_search_discoveries field in the user_option if discover agent is enabled" do
SiteSetting.ai_discover_enabled = true
- SiteSetting.ai_discover_persona = Fabricate(:ai_persona).id
+ SiteSetting.ai_discover_agent = Fabricate(:ai_agent).id
user = Fabricate(:user)
user.user_option.update!(ai_search_discoveries: true)
diff --git a/plugins/discourse-ai/spec/lib/modules/ai_bot/jobs/regular/create_ai_reply_spec.rb b/plugins/discourse-ai/spec/lib/modules/ai_bot/jobs/regular/create_ai_reply_spec.rb
index 94c3f3396db..5e131ded5d9 100644
--- a/plugins/discourse-ai/spec/lib/modules/ai_bot/jobs/regular/create_ai_reply_spec.rb
+++ b/plugins/discourse-ai/spec/lib/modules/ai_bot/jobs/regular/create_ai_reply_spec.rb
@@ -22,11 +22,11 @@ RSpec.describe Jobs::CreateAiReply do
before { SiteSetting.min_personal_message_post_length = 5 }
it "adds a reply from the bot" do
- persona_id = AiPersona.find_by(name: "Forum Helper").id
+ agent_id = AiAgent.find_by(name: "Forum Helper").id
bot_user = DiscourseAi::AiBot::EntryPoint.find_user_from_model("gpt-3.5-turbo")
DiscourseAi::Completions::Llm.with_prepared_responses([expected_response]) do
- job.execute(post_id: topic.first_post.id, bot_user_id: bot_user.id, persona_id: persona_id)
+ job.execute(post_id: topic.first_post.id, bot_user_id: bot_user.id, agent_id: agent_id)
end
expect(topic.posts.last.raw).to eq(expected_response)
diff --git a/plugins/discourse-ai/spec/lib/modules/ai_bot/playground_spec.rb b/plugins/discourse-ai/spec/lib/modules/ai_bot/playground_spec.rb
index a1f2f5a0081..b25d6e56cd9 100644
--- a/plugins/discourse-ai/spec/lib/modules/ai_bot/playground_spec.rb
+++ b/plugins/discourse-ai/spec/lib/modules/ai_bot/playground_spec.rb
@@ -21,12 +21,12 @@ RSpec.describe DiscourseAi::AiBot::Playground do
end
fab!(:bot) do
- persona =
- AiPersona
- .find(DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::General])
+ agent =
+ AiAgent
+ .find(DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::General])
.class_instance
.new
- DiscourseAi::Personas::Bot.as(bot_user, persona: persona)
+ DiscourseAi::Agents::Bot.as(bot_user, agent: agent)
end
fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) }
@@ -65,16 +65,16 @@ RSpec.describe DiscourseAi::AiBot::Playground do
end
after do
- # we must reset cache on persona cause data can be rolled back
- AiPersona.persona_cache.flush!
+ # we must reset cache on agent cause data can be rolled back
+ AiAgent.agent_cache.flush!
end
describe "is_bot_user_id?" do
it "properly detects ALL bots as bot users" do
- persona = Fabricate(:ai_persona, enabled: false)
- persona.create_user!
+ agent = Fabricate(:ai_agent, enabled: false)
+ agent.create_user!
- expect(DiscourseAi::AiBot::Playground.is_bot_user_id?(persona.user_id)).to eq(true)
+ expect(DiscourseAi::AiBot::Playground.is_bot_user_id?(agent.user_id)).to eq(true)
end
end
@@ -92,7 +92,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
)
end
- let!(:ai_persona) { Fabricate(:ai_persona, tools: ["custom-#{custom_tool.id}"]) }
+ let!(:ai_agent) { Fabricate(:ai_agent, tools: ["custom-#{custom_tool.id}"]) }
let(:tool_call) do
DiscourseAi::Completions::ToolCall.new(
name: "search",
@@ -103,7 +103,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
)
end
- let(:bot) { DiscourseAi::Personas::Bot.as(bot_user, persona: ai_persona.class_instance.new) }
+ let(:bot) { DiscourseAi::Agents::Bot.as(bot_user, agent: ai_agent.class_instance.new) }
let(:playground) { DiscourseAi::AiBot::Playground.new(bot) }
@@ -118,7 +118,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
JS
tool_name = "custom-#{custom_tool.id}"
- ai_persona.update!(tools: [[tool_name, nil, true]], show_thinking: false)
+ ai_agent.update!(tools: [[tool_name, nil, true]], show_thinking: false)
reply_post = nil
prompts = nil
@@ -140,7 +140,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
it "can force usage of a tool" do
tool_name = "custom-#{custom_tool.id}"
- ai_persona.update!(tools: [[tool_name, nil, true]], forced_tool_count: 1)
+ ai_agent.update!(tools: [[tool_name, nil, true]], forced_tool_count: 1)
responses = [tool_call, ["custom tool did stuff (maybe)"], ["new PM title"]]
prompts = nil
@@ -158,7 +158,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
expect(prompts[0].tool_choice).to eq("search")
expect(prompts[1].tool_choice).to eq(nil)
- ai_persona.update!(forced_tool_count: 1)
+ ai_agent.update!(forced_tool_count: 1)
responses = ["no tool call here"]
DiscourseAi::Completions::Llm.with_prepared_responses(responses) do |_, _, _prompts|
@@ -172,9 +172,9 @@ RSpec.describe DiscourseAi::AiBot::Playground do
end
it "uses custom tool in conversation" do
- ai_persona.update!(show_thinking: true)
- persona_klass = AiPersona.all_personas.find { |p| p.name == ai_persona.name }
- bot = DiscourseAi::Personas::Bot.as(bot_user, persona: persona_klass.new)
+ ai_agent.update!(show_thinking: true)
+ agent_klass = AiAgent.all_agents.find { |p| p.name == ai_agent.name }
+ bot = DiscourseAi::Agents::Bot.as(bot_user, agent: agent_klass.new)
playground = described_class.new(bot)
responses = [tool_call, "custom tool did stuff (maybe)"]
@@ -216,8 +216,8 @@ RSpec.describe DiscourseAi::AiBot::Playground do
custom_tool.update!(enabled: false)
# so we pick up new cache
- persona_klass = AiPersona.all_personas.find { |p| p.name == ai_persona.name }
- bot = DiscourseAi::Personas::Bot.as(bot_user, persona: persona_klass.new)
+ agent_klass = AiAgent.all_agents.find { |p| p.name == ai_agent.name }
+ bot = DiscourseAi::Agents::Bot.as(bot_user, agent: agent_klass.new)
playground = DiscourseAi::AiBot::Playground.new(bot)
responses = ["custom tool did stuff (maybe)", tool_call]
@@ -238,10 +238,10 @@ RSpec.describe DiscourseAi::AiBot::Playground do
SiteSetting.ai_bot_allowed_groups = "#{Group::AUTO_GROUPS[:trust_level_0]}"
end
- fab!(:persona) do
- AiPersona.create!(
- name: "Test Persona",
- description: "A test persona",
+ fab!(:agent) do
+ AiAgent.create!(
+ name: "Test Agent",
+ description: "A test agent",
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
enabled: true,
system_prompt: "You are a helpful bot",
@@ -257,10 +257,10 @@ RSpec.describe DiscourseAi::AiBot::Playground do
it "sends images to llm" do
post = nil
- persona.create_user!
+ agent.create_user!
image = "![image](upload://#{upload.base62_sha1}.jpg)"
- body = "Hey @#{persona.user.username}, can you help me with this image? #{image}"
+ body = "Hey @#{agent.user.username}, can you help me with this image? #{image}"
prompts = nil
options = nil
@@ -288,29 +288,29 @@ RSpec.describe DiscourseAi::AiBot::Playground do
end
end
- describe "persona with user support" do
+ describe "agent with user support" do
before do
Jobs.run_immediately!
SiteSetting.ai_bot_allowed_groups = "#{Group::AUTO_GROUPS[:trust_level_0]}"
end
- fab!(:persona) do
- persona =
- AiPersona.create!(
- name: "Test Persona",
- description: "A test persona",
+ fab!(:agent) do
+ agent =
+ AiAgent.create!(
+ name: "Test Agent",
+ description: "A test agent",
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
enabled: true,
system_prompt: "You are a helpful bot",
)
- persona.create_user!
- persona.update!(
+ agent.create_user!
+ agent.update!(
default_llm_id: claude_2.id,
allow_chat_channel_mentions: true,
allow_topic_mentions: true,
)
- persona
+ agent
end
context "with chat channels" do
@@ -326,7 +326,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
SiteSetting.ai_bot_enabled = true
SiteSetting.chat_allowed_groups = "#{Group::AUTO_GROUPS[:trust_level_0]}"
Group.refresh_automatic_groups!
- persona.update!(allow_chat_channel_mentions: true, default_llm_id: opus_model.id)
+ agent.update!(allow_chat_channel_mentions: true, default_llm_id: opus_model.id)
end
it "should behave in a sane way when threading is enabled" do
@@ -370,7 +370,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
message =
ChatSDK::Message.create(
channel_id: channel.id,
- raw: "Hello @#{persona.user.username}",
+ raw: "Hello @#{agent.user.username}",
guardian: guardian,
)
@@ -431,7 +431,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
) do |_, _, _prompts|
ChatSDK::Message.create(
channel_id: channel.id,
- raw: "Hello @#{persona.user.username}",
+ raw: "Hello @#{agent.user.username}",
guardian: guardian,
)
@@ -474,7 +474,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
ChatSDK::Message.create(
channel_id: channel.id,
- raw: "Hello @#{persona.user.username}",
+ raw: "Hello @#{agent.user.username}",
guardian: guardian,
)
@@ -487,7 +487,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
reset_time: allocation.formatted_reset_time,
).gsub(%r{<a\s+href=['"]([^'"]+)['"][^>]*>([^<]+)</a>}i, '[\2](\1)')
expect(last_message.message).to eq(expected_message)
- expect(last_message.user_id).to eq(persona.user_id)
+ expect(last_message.user_id).to eq(agent.user_id)
end
it "sends admin error message when credit limit is exceeded for admin users" do
@@ -528,7 +528,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
ChatSDK::Message.create(
channel_id: channel.id,
- raw: "Hello @#{persona.user.username}",
+ raw: "Hello @#{agent.user.username}",
guardian: admin_guardian,
)
@@ -541,17 +541,17 @@ RSpec.describe DiscourseAi::AiBot::Playground do
reset_time: allocation.formatted_reset_time,
).gsub(%r{<a\s+href=['"]([^'"]+)['"][^>]*>([^<]+)</a>}i, '[\2](\1)')
expect(last_message.message).to eq(expected_message)
- expect(last_message.user_id).to eq(persona.user_id)
+ expect(last_message.user_id).to eq(agent.user_id)
end
end
context "with chat dms" do
- fab!(:dm_channel) { Fabricate(:direct_message_channel, users: [user, persona.user]) }
+ fab!(:dm_channel) { Fabricate(:direct_message_channel, users: [user, agent.user]) }
before do
SiteSetting.chat_allowed_groups = "#{Group::AUTO_GROUPS[:trust_level_0]}"
Group.refresh_automatic_groups!
- persona.update!(
+ agent.update!(
allow_chat_direct_messages: true,
allow_topic_mentions: false,
allow_chat_channel_mentions: false,
@@ -587,7 +587,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
end
it "can run tools" do
- persona.update!(tools: ["Time"])
+ agent.update!(tools: ["Time"])
tool_call1 =
DiscourseAi::Completions::ToolCall.new(
@@ -643,8 +643,8 @@ RSpec.describe DiscourseAi::AiBot::Playground do
expect(thread_messages.last.message).to eq("World")
# it also needs to include history per config - first feed some history
- persona.update!(enabled: false)
- persona_guardian = Guardian.new(persona.user)
+ agent.update!(enabled: false)
+ agent_guardian = Guardian.new(agent.user)
4.times do |i|
ChatSDK::Message.create(
@@ -658,11 +658,11 @@ RSpec.describe DiscourseAi::AiBot::Playground do
channel_id: dm_channel.id,
thread_id: message.thread_id,
raw: "response #{i}",
- guardian: persona_guardian,
+ guardian: agent_guardian,
)
end
- persona.update!(max_context_posts: 4, enabled: true)
+ agent.update!(max_context_posts: 4, enabled: true)
prompts = nil
DiscourseAi::Completions::Llm.with_prepared_responses(
@@ -708,7 +708,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
create_post(
user: admin,
title: "My public topic",
- raw: "Hey @#{persona.user.username}, can you help me?",
+ raw: "Hey @#{agent.user.username}, can you help me?",
post_type: Post.types[:whisper],
)
end
@@ -716,15 +716,15 @@ RSpec.describe DiscourseAi::AiBot::Playground do
post.topic.reload
last_post = post.topic.posts.order(:post_number).last
expect(last_post.raw).to eq("Yes I can")
- expect(last_post.user_id).to eq(persona.user_id)
+ expect(last_post.user_id).to eq(agent.user_id)
expect(last_post.post_type).to eq(Post.types[:whisper])
end
- it "allows mentioning a persona" do
+ it "allows mentioning a agent" do
# we still should be able to mention with no bots
toggle_enabled_bots(bots: [])
- persona.update!(allow_topic_mentions: true)
+ agent.update!(allow_topic_mentions: true)
post = nil
DiscourseAi::Completions::Llm.with_prepared_responses(["Yes I can"]) do
@@ -732,21 +732,21 @@ RSpec.describe DiscourseAi::AiBot::Playground do
create_post(
user: admin,
title: "My public topic",
- raw: "Hey @#{persona.user.username}, can you help me?",
+ raw: "Hey @#{agent.user.username}, can you help me?",
)
end
post.topic.reload
last_post = post.topic.posts.order(:post_number).last
expect(last_post.raw).to eq("Yes I can")
- expect(last_post.user_id).to eq(persona.user_id)
+ expect(last_post.user_id).to eq(agent.user_id)
- persona.update!(allow_topic_mentions: false)
+ agent.update!(allow_topic_mentions: false)
post =
create_post(
title: "My public topic ABC",
- raw: "Hey @#{persona.user.username}, can you help me?",
+ raw: "Hey @#{agent.user.username}, can you help me?",
)
expect(post.topic.posts.last.post_number).to eq(1)
@@ -763,15 +763,15 @@ RSpec.describe DiscourseAi::AiBot::Playground do
post =
create_post(
title: "I just made a PM",
- raw: "Hey there #{persona.user.username}, can you help me?",
- target_usernames: "#{user.username},#{persona.user.username},#{claude_2.user.username}",
+ raw: "Hey there #{agent.user.username}, can you help me?",
+ target_usernames: "#{user.username},#{agent.user.username},#{claude_2.user.username}",
archetype: Archetype.private_message,
user: admin,
)
end
# note that this is a string due to custom field shananigans
- post.topic.custom_fields["ai_persona_id"] = persona.id.to_s
+ post.topic.custom_fields["ai_agent_id"] = agent.id.to_s
post.topic.save_custom_fields
llm2 = Fabricate(:llm_model)
@@ -788,7 +788,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
last_post = post.topic.reload.posts.order("id desc").first
expect(last_post.raw).to eq("Hi from bot two")
- expect(last_post.user_id).to eq(persona.user_id)
+ expect(last_post.user_id).to eq(agent.user_id)
current_users = last_post.topic.reload.topic_allowed_users.joins(:user).pluck(:username)
expect(current_users).to include(llm2.user.username)
@@ -804,10 +804,10 @@ RSpec.describe DiscourseAi::AiBot::Playground do
last_post = post.topic.reload.posts.order("id desc").first
expect(last_post.raw).to eq("Hi from bot two")
- expect(last_post.user_id).to eq(persona.user_id)
+ expect(last_post.user_id).to eq(agent.user_id)
# tether llm, so it can no longer be switched
- persona.update!(force_default_llm: true, default_llm_id: claude_2.id)
+ agent.update!(force_default_llm: true, default_llm_id: claude_2.id)
DiscourseAi::Completions::Llm.with_prepared_responses(["Hi from bot one"], llm: claude_2) do
create_post(
@@ -819,10 +819,10 @@ RSpec.describe DiscourseAi::AiBot::Playground do
last_post = post.topic.reload.posts.order("id desc").first
expect(last_post.raw).to eq("Hi from bot one")
- expect(last_post.user_id).to eq(persona.user_id)
+ expect(last_post.user_id).to eq(agent.user_id)
end
- it "allows PMing a persona even when no particular bots are enabled" do
+ it "allows PMing a agent even when no particular bots are enabled" do
SiteSetting.ai_bot_enabled = true
toggle_enabled_bots(bots: [])
post = nil
@@ -834,8 +834,8 @@ RSpec.describe DiscourseAi::AiBot::Playground do
post =
create_post(
title: "I just made a PM",
- raw: "Hey there #{persona.user.username}, can you help me?",
- target_usernames: "#{user.username},#{persona.user.username}",
+ raw: "Hey there #{agent.user.username}, can you help me?",
+ target_usernames: "#{user.username},#{agent.user.username}",
archetype: Archetype.private_message,
user: admin,
)
@@ -843,19 +843,19 @@ RSpec.describe DiscourseAi::AiBot::Playground do
last_post = post.topic.posts.order(:post_number).last
expect(last_post.raw).to eq("Yes I can")
- expect(last_post.user_id).to eq(persona.user_id)
+ expect(last_post.user_id).to eq(agent.user_id)
last_post.topic.reload
- expect(last_post.topic.allowed_users.pluck(:user_id)).to include(persona.user_id)
+ expect(last_post.topic.allowed_users.pluck(:user_id)).to include(agent.user_id)
expect(last_post.topic.participant_count).to eq(2)
# ensure it can be disabled
- persona.update!(allow_personal_messages: false)
+ agent.update!(allow_personal_messages: false)
post =
create_post(
- raw: "Hey there #{persona.user.username}, can you help me please",
+ raw: "Hey there #{agent.user.username}, can you help me please",
topic_id: post.topic.id,
user: admin,
)
@@ -863,7 +863,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
expect(post.post_number).to eq(3)
end
- it "can tether a persona unconditionally to an llm" do
+ it "can tether a agent unconditionally to an llm" do
gpt_35_turbo = Fabricate(:llm_model, name: "gpt-3.5-turbo")
# If you start a PM with GPT 3.5 bot, replies should come from it, not from Claude
@@ -871,7 +871,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
toggle_enabled_bots(bots: [gpt_35_turbo, claude_2])
post = nil
- persona.update!(force_default_llm: true, default_llm_id: gpt_35_turbo.id)
+ agent.update!(force_default_llm: true, default_llm_id: gpt_35_turbo.id)
DiscourseAi::Completions::Llm.with_prepared_responses(
["Yes I can", "Magic Title"],
@@ -885,21 +885,21 @@ RSpec.describe DiscourseAi::AiBot::Playground do
archetype: Archetype.private_message,
user: admin,
custom_fields: {
- "ai_persona_id" => persona.id,
+ "ai_agent_id" => agent.id,
},
)
end
last_post = post.topic.posts.order(:post_number).last
expect(last_post.raw).to eq("Yes I can")
- expect(last_post.user_id).to eq(persona.user_id)
+ expect(last_post.user_id).to eq(agent.user_id)
expect(last_post.custom_fields[DiscourseAi::AiBot::POST_AI_LLM_NAME_FIELD]).to eq(
gpt_35_turbo.display_name,
)
end
- it "picks the correct llm for persona in PMs" do
+ it "picks the correct llm for agent in PMs" do
gpt_35_turbo = Fabricate(:llm_model, name: "gpt-3.5-turbo")
# If you start a PM with GPT 3.5 bot, replies should come from it, not from Claude
@@ -919,7 +919,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
post =
create_post(
title: "I just made a PM",
- raw: "Hey @#{persona.user.username}, can you help me?",
+ raw: "Hey @#{agent.user.username}, can you help me?",
target_usernames: "#{user.username},#{gpt3_5_bot_user.username}",
archetype: Archetype.private_message,
user: admin,
@@ -933,10 +933,10 @@ RSpec.describe DiscourseAi::AiBot::Playground do
expect(title_update_message.data).to eq({ title: "Magic Title" })
last_post = post.topic.posts.order(:post_number).last
expect(last_post.raw).to eq("Yes I can")
- expect(last_post.user_id).to eq(persona.user_id)
+ expect(last_post.user_id).to eq(agent.user_id)
last_post.topic.reload
- expect(last_post.topic.allowed_users.pluck(:user_id)).to include(persona.user_id)
+ expect(last_post.topic.allowed_users.pluck(:user_id)).to include(agent.user_id)
# does not reply if replying directly to a user
# nothing is mocked, so this would result in HTTP error
@@ -948,7 +948,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
reply_to_post_number: post.post_number,
)
- # replies as correct persona if replying direct to persona
+ # replies as correct agent if replying direct to agent
DiscourseAi::Completions::Llm.with_prepared_responses(["Another reply"], llm: gpt_35_turbo) do
create_post(
raw: "Please ignore this bot, I am replying to a user",
@@ -960,7 +960,7 @@ RSpec.describe DiscourseAi::AiBot::Playground do
last_post = post.topic.posts.order(:post_number).last
expect(last_post.raw).to eq("Another reply")
- expect(last_post.user_id).to eq(persona.user_id)
+ expect(last_post.user_id).to eq(agent.user_id)
end
end
@@ -1103,8 +1103,8 @@ RSpec.describe DiscourseAi::AiBot::Playground do
end
it "supports disabling thinking" do
- persona = Fabricate(:ai_persona, show_thinking: false, tools: ["Search"])
- bot = DiscourseAi::Personas::Bot.as(bot_user, persona: persona.class_instance.new)
+ agent = Fabricate(:ai_agent, show_thinking: false, tools: ["Search"])
+ bot = DiscourseAi::Agents::Bot.as(bot_user, agent: agent.class_instance.new)
playground = described_class.new(bot)
response1 =
@@ -1278,11 +1278,11 @@ RSpec.describe DiscourseAi::AiBot::Playground do
end
describe "#available_bot_usernames" do
- it "includes persona users" do
- persona = Fabricate(:ai_persona)
- persona.create_user!
+ it "includes agent users" do
+ agent = Fabricate(:ai_agent)
+ agent.create_user!
- expect(playground.available_bot_usernames).to include(persona.user.username)
+ expect(playground.available_bot_usernames).to include(agent.user.username)
end
end
@@ -1311,8 +1311,8 @@ RSpec.describe DiscourseAi::AiBot::Playground do
)
end
- let!(:ai_persona) { Fabricate(:ai_persona, tools: ["custom-#{custom_tool.id}"]) }
- let(:bot) { DiscourseAi::Personas::Bot.as(bot_user, persona: ai_persona.class_instance.new) }
+ let!(:ai_agent) { Fabricate(:ai_agent, tools: ["custom-#{custom_tool.id}"]) }
+ let(:bot) { DiscourseAi::Agents::Bot.as(bot_user, agent: ai_agent.class_instance.new) }
let(:playground) { DiscourseAi::AiBot::Playground.new(bot) }
it "injects custom context into the prompt" do
@@ -1353,8 +1353,8 @@ RSpec.describe DiscourseAi::AiBot::Playground do
)
end
- let!(:ai_persona) { Fabricate(:ai_persona, tools: ["custom-#{custom_tool.id}"]) }
- let(:bot) { DiscourseAi::Personas::Bot.as(bot_user, persona: ai_persona.class_instance.new) }
+ let!(:ai_agent) { Fabricate(:ai_agent, tools: ["custom-#{custom_tool.id}"]) }
+ let(:bot) { DiscourseAi::Agents::Bot.as(bot_user, agent: ai_agent.class_instance.new) }
let(:playground) { DiscourseAi::AiBot::Playground.new(bot) }
it "injects custom system message into the system prompt" do
@@ -1398,8 +1398,8 @@ RSpec.describe DiscourseAi::AiBot::Playground do
)
end
- let!(:ai_persona) { Fabricate(:ai_persona, tools: ["custom-#{custom_tool.id}"]) }
- let(:bot) { DiscourseAi::Personas::Bot.as(bot_user, persona: ai_persona.class_instance.new) }
+ let!(:ai_agent) { Fabricate(:ai_agent, tools: ["custom-#{custom_tool.id}"]) }
+ let(:bot) { DiscourseAi::Agents::Bot.as(bot_user, agent: ai_agent.class_instance.new) }
let(:playground) { DiscourseAi::AiBot::Playground.new(bot) }
it "injects both hooks into the correct prompt locations" do
diff --git a/plugins/discourse-ai/spec/lib/modules/ai_bot/stream_reply_custom_tools_session_spec.rb b/plugins/discourse-ai/spec/lib/modules/ai_bot/stream_reply_custom_tools_session_spec.rb
index d957e58675e..1bf5db98dec 100644
--- a/plugins/discourse-ai/spec/lib/modules/ai_bot/stream_reply_custom_tools_session_spec.rb
+++ b/plugins/discourse-ai/spec/lib/modules/ai_bot/stream_reply_custom_tools_session_spec.rb
@@ -3,10 +3,10 @@
RSpec.describe DiscourseAi::AiBot::StreamReplyCustomToolsSession do
fab!(:admin)
fab!(:llm) { Fabricate(:llm_model, name: "fake_llm", provider: "fake") }
- fab!(:ai_persona) do
- persona =
+ fab!(:ai_agent) do
+ agent =
Fabricate(
- :ai_persona,
+ :ai_agent,
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
default_llm_id: llm.id,
allow_personal_messages: true,
@@ -14,8 +14,8 @@ RSpec.describe DiscourseAi::AiBot::StreamReplyCustomToolsSession do
max_turn_tokens: 5000,
compression_threshold: 80,
)
- persona.create_user!
- persona
+ agent.create_user!
+ agent
end
let(:custom_tools) do
@@ -37,7 +37,7 @@ RSpec.describe DiscourseAi::AiBot::StreamReplyCustomToolsSession do
def build_session(query: "test question", resume_token: nil, tool_results: nil)
described_class.new(
- persona: ai_persona,
+ agent: ai_agent,
user: admin,
topic: nil,
query: query,
@@ -105,7 +105,7 @@ RSpec.describe DiscourseAi::AiBot::StreamReplyCustomToolsSession do
end
it "triggers synthetic tool errors + final text when budget exhausted mid-round" do
- ai_persona.update!(max_turn_tokens: 1)
+ ai_agent.update!(max_turn_tokens: 1)
tool_call =
DiscourseAi::Completions::ToolCall.new(
diff --git a/plugins/discourse-ai/spec/lib/modules/ai_helper/assistant_spec.rb b/plugins/discourse-ai/spec/lib/modules/ai_helper/assistant_spec.rb
index 326782efb53..52ea153556b 100644
--- a/plugins/discourse-ai/spec/lib/modules/ai_helper/assistant_spec.rb
+++ b/plugins/discourse-ai/spec/lib/modules/ai_helper/assistant_spec.rb
@@ -89,7 +89,7 @@ RSpec.describe DiscourseAi::AiHelper::Assistant do
expect { assistant.available_prompts(user) }.not_to raise_error
end
- context "when PostIllustrator persona has an image generation tool" do
+ context "when PostIllustrator agent has an image generation tool" do
let(:image_tool) do
AiTool.create!(
name: "Test Image Generator",
@@ -108,9 +108,9 @@ RSpec.describe DiscourseAi::AiHelper::Assistant do
)
end
- context "with system PostIllustrator persona (dynamic tool discovery)" do
+ context "with system PostIllustrator agent (dynamic tool discovery)" do
before do
- # Use the default system PostIllustrator persona
+ # Use the default system PostIllustrator agent
image_tool # Create the tool
DiscourseAi::AiHelper::Assistant.clear_prompt_cache!
end
@@ -129,23 +129,23 @@ RSpec.describe DiscourseAi::AiHelper::Assistant do
)
end
- it "PostIllustrator persona has tools and forces their use" do
- persona = AiPersona.find_by(id: SiteSetting.ai_helper_post_illustrator_persona)
- persona_instance = persona.class_instance.new
+ it "PostIllustrator agent has tools and forces their use" do
+ agent = AiAgent.find_by(id: SiteSetting.ai_helper_post_illustrator_agent)
+ agent_instance = agent.class_instance.new
- expect(persona_instance.tools).not_to be_empty
- expect(persona_instance.tools.first).to be_a(Class)
- expect(persona_instance.tools.first.tool_id).to eq(image_tool.id)
- expect(persona_instance.force_tool_use).to eq(persona_instance.tools)
- expect(persona_instance.forced_tool_count).to eq(1)
+ expect(agent_instance.tools).not_to be_empty
+ expect(agent_instance.tools.first).to be_a(Class)
+ expect(agent_instance.tools.first.tool_id).to eq(image_tool.id)
+ expect(agent_instance.force_tool_use).to eq(agent_instance.tools)
+ expect(agent_instance.forced_tool_count).to eq(1)
end
end
- context "with custom persona" do
- let(:custom_persona) do
- AiPersona.create!(
+ context "with custom agent" do
+ let(:custom_agent) do
+ AiAgent.create!(
name: "Custom Post Illustrator",
- description: "Test persona with image tool",
+ description: "Test agent with image tool",
system_prompt: "You are an AI that generates images from text prompts.",
enabled: true,
system: false,
@@ -155,8 +155,8 @@ RSpec.describe DiscourseAi::AiHelper::Assistant do
end
before do
- # Set the custom persona as the illustrator persona
- SiteSetting.ai_helper_post_illustrator_persona = custom_persona.id
+ # Set the custom agent as the illustrator agent
+ SiteSetting.ai_helper_post_illustrator_agent = custom_agent.id
DiscourseAi::AiHelper::Assistant.clear_prompt_cache!
end
@@ -210,9 +210,9 @@ RSpec.describe DiscourseAi::AiHelper::Assistant do
it "gracefully handles PostIllustrator.tools raising exception" do
# Stub the PostIllustrator class to raise an error
- allow_any_instance_of(DiscourseAi::Personas::PostIllustrator).to receive(
- :tools,
- ).and_raise(StandardError.new("Tool discovery failed"))
+ allow_any_instance_of(DiscourseAi::Agents::PostIllustrator).to receive(:tools).and_raise(
+ StandardError.new("Tool discovery failed"),
+ )
DiscourseAi::AiHelper::Assistant.clear_prompt_cache!
@@ -228,7 +228,7 @@ RSpec.describe DiscourseAi::AiHelper::Assistant do
describe("#attach_user_context") do
before { SiteSetting.allow_user_locale = true }
- let(:context) { DiscourseAi::Personas::BotContext.new(user: user) }
+ let(:context) { DiscourseAi::Agents::BotContext.new(user: user) }
it "is able to perform %LANGUAGE% replacements" do
assistant.attach_user_context(context, user)
@@ -291,10 +291,10 @@ RSpec.describe DiscourseAi::AiHelper::Assistant do
expect(response[:suggestions]).to contain_exactly(english_text)
end
- context "when the persona is not using structured outputs" do
+ context "when the agent is not using structured outputs" do
it "still works" do
- regular_persona = Fabricate(:ai_persona, response_format: nil)
- SiteSetting.ai_helper_translator_persona = regular_persona.id
+ regular_agent = Fabricate(:ai_agent, response_format: nil)
+ SiteSetting.ai_helper_translator_agent = regular_agent.id
response =
DiscourseAi::Completions::Llm.with_prepared_responses([english_text]) do
diff --git a/plugins/discourse-ai/spec/lib/modules/ai_helper/chat_thread_titler_spec.rb b/plugins/discourse-ai/spec/lib/modules/ai_helper/chat_thread_titler_spec.rb
index 0d9529ad3c8..475e2822dd4 100644
--- a/plugins/discourse-ai/spec/lib/modules/ai_helper/chat_thread_titler_spec.rb
+++ b/plugins/discourse-ai/spec/lib/modules/ai_helper/chat_thread_titler_spec.rb
@@ -8,12 +8,12 @@ RSpec.describe DiscourseAi::AiHelper::ChatThreadTitler do
fab!(:user)
fab!(:llm_model)
- let(:chat_thread_titler_persona) do
- AiPersona.find_by(
- id: DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::ChatThreadTitler],
+ let(:chat_thread_titler_agent) do
+ AiAgent.find_by(
+ id: DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::ChatThreadTitler],
) ||
Fabricate(
- :ai_persona,
+ :ai_agent,
name: "Chat Thread Titler",
system_prompt: "Generate a title",
response_format: [{ "key" => "title", "type" => "string" }],
@@ -23,7 +23,7 @@ RSpec.describe DiscourseAi::AiHelper::ChatThreadTitler do
before do
enable_current_plugin
assign_fake_provider_to(:ai_default_llm_model)
- SiteSetting.ai_helper_chat_thread_title_persona = chat_thread_titler_persona.id
+ SiteSetting.ai_helper_chat_thread_title_agent = chat_thread_titler_agent.id
end
describe "#suggested_title" do
@@ -46,8 +46,8 @@ RSpec.describe DiscourseAi::AiHelper::ChatThreadTitler do
expect(result).to eq(expected_title)
end
- it "returns nil when persona is not found" do
- SiteSetting.ai_helper_chat_thread_title_persona = 999_999
+ it "returns nil when agent is not found" do
+ SiteSetting.ai_helper_chat_thread_title_agent = 999_999
result = titler.suggested_title
diff --git a/plugins/discourse-ai/spec/lib/modules/automation/llm_triage_spec.rb b/plugins/discourse-ai/spec/lib/modules/automation/llm_triage_spec.rb
index c5f0c8d2c9e..457f67b5248 100644
--- a/plugins/discourse-ai/spec/lib/modules/automation/llm_triage_spec.rb
+++ b/plugins/discourse-ai/spec/lib/modules/automation/llm_triage_spec.rb
@@ -4,7 +4,7 @@ describe DiscourseAi::Automation::LlmTriage do
fab!(:reply) { Fabricate(:post, topic: post.topic, user: Fabricate(:user)) }
fab!(:llm_model)
- fab!(:ai_persona)
+ fab!(:ai_agent)
def triage(**args)
DiscourseAi::Automation::LlmTriage.handle(**args)
@@ -12,14 +12,14 @@ describe DiscourseAi::Automation::LlmTriage do
before do
enable_current_plugin
- ai_persona.update!(default_llm: llm_model)
+ ai_agent.update!(default_llm: llm_model)
end
it "does nothing if it does not pass triage" do
DiscourseAi::Completions::Llm.with_prepared_responses(["good"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
hide_topic: true,
search_for_text: "bad",
automation: nil,
@@ -33,7 +33,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
hide_topic: true,
search_for_text: "bad",
automation: nil,
@@ -49,7 +49,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
category_id: category.id,
search_for_text: "bad",
automation: nil,
@@ -64,7 +64,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
canned_reply: "test canned reply 123",
canned_reply_user: user.username,
@@ -82,7 +82,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
automation: nil,
@@ -96,8 +96,8 @@ describe DiscourseAi::Automation::LlmTriage do
expect(reviewable.reviewable_scores.first.reason).to include("bad")
end
- it "flags via tool call when the persona invokes flag_post" do
- ai_persona.update!(tools: ["FlagPost"])
+ it "flags via tool call when the agent invokes flag_post" do
+ ai_agent.update!(tools: ["FlagPost"])
tool_call =
DiscourseAi::Completions::ToolCall.new(
name: "flag_post",
@@ -111,7 +111,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses([tool_call, "all good"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
automation: nil,
@@ -129,7 +129,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
flag_type: :spam,
@@ -145,7 +145,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
flag_type: :spam_silence,
@@ -162,7 +162,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
flag_type: :review_hide,
@@ -182,7 +182,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
flag_type: :review_delete,
@@ -202,7 +202,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
flag_type: :review_delete_silence,
@@ -223,7 +223,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
flag_type: :review_delete,
@@ -249,7 +249,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
flag_type: :review_delete,
@@ -268,7 +268,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
flag_type: :review_delete,
@@ -299,7 +299,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
flag_type: :spam_silence,
@@ -314,7 +314,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["Bad.\n\nYo"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
automation: nil,
@@ -330,7 +330,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "BAD",
flag_post: true,
automation: nil,
@@ -343,13 +343,13 @@ describe DiscourseAi::Automation::LlmTriage do
end
it "includes post uploads when triaging" do
- ai_persona.update!(vision_enabled: true)
+ ai_agent.update!(vision_enabled: true)
post_upload = Fabricate(:image_upload, posts: [post])
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
automation: nil,
@@ -367,7 +367,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do |spy|
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
automation: nil,
@@ -386,7 +386,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
tags: [tag_2.name],
@@ -403,7 +403,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(["bad"]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
automation: nil,
@@ -423,7 +423,7 @@ describe DiscourseAi::Automation::LlmTriage do
DiscourseAi::Completions::Llm.with_prepared_responses(%w[bad bad]) do
triage(
post: post,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
flag_type: :review,
@@ -433,7 +433,7 @@ describe DiscourseAi::Automation::LlmTriage do
triage(
post: post.reload,
- triage_persona_id: ai_persona.id,
+ triage_agent_id: ai_agent.id,
search_for_text: "bad",
flag_post: true,
flag_type: :review,
diff --git a/plugins/discourse-ai/spec/lib/modules/automation/report_runner_spec.rb b/plugins/discourse-ai/spec/lib/modules/automation/report_runner_spec.rb
index bd955618a02..dc3e08500d5 100644
--- a/plugins/discourse-ai/spec/lib/modules/automation/report_runner_spec.rb
+++ b/plugins/discourse-ai/spec/lib/modules/automation/report_runner_spec.rb
@@ -43,8 +43,7 @@ module DiscourseAi
sender_username: user.username,
receivers: ["[email protected]"],
title: "test report %DATE%",
- persona_id:
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::ReportRunner],
+ agent_id: DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::ReportRunner],
model: llm_model.id,
category_ids: nil,
tags: nil,
@@ -82,8 +81,7 @@ module DiscourseAi
sender_username: user.username,
receivers: [receiver.username],
title: "test report",
- persona_id:
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::ReportRunner],
+ agent_id: DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::ReportRunner],
model: llm_model.id,
category_ids: nil,
tags: nil,
@@ -129,8 +127,7 @@ module DiscourseAi
sender_username: user.username,
receivers: [receiver.username],
title: "test report",
- persona_id:
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::ReportRunner],
+ agent_id: DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::ReportRunner],
model: llm_model.id,
category_ids: nil,
tags: nil,
@@ -174,8 +171,7 @@ module DiscourseAi
sender_username: user.username,
receivers: [receiver.username],
title: "test report",
- persona_id:
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::ReportRunner],
+ agent_id: DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::ReportRunner],
model: llm_model.id,
category_ids: nil,
tags: nil,
@@ -208,8 +204,7 @@ module DiscourseAi
sender_username: user.username,
receivers: [group_for_reports.name],
title: "group report",
- persona_id:
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::ReportRunner],
+ agent_id: DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::ReportRunner],
model: llm_model.id,
category_ids: nil,
tags: nil,
@@ -238,8 +233,7 @@ module DiscourseAi
sender_username: user.username,
receivers: [receiver.username],
title: "test report",
- persona_id:
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::ReportRunner],
+ agent_id: DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::ReportRunner],
model: llm_model.id,
category_ids: nil,
tags: nil,
diff --git a/plugins/discourse-ai/spec/lib/modules/summarization/entry_point_spec.rb b/plugins/discourse-ai/spec/lib/modules/summarization/entry_point_spec.rb
index 844cdcc621d..db24a898761 100644
--- a/plugins/discourse-ai/spec/lib/modules/summarization/entry_point_spec.rb
+++ b/plugins/discourse-ai/spec/lib/modules/summarization/entry_point_spec.rb
@@ -64,7 +64,7 @@ RSpec.describe DiscourseAi::Summarization::EntryPoint do
before do
group.add(user)
- assign_persona_to(:ai_summary_gists_persona, [group.id])
+ assign_agent_to(:ai_summary_gists_agent, [group.id])
SiteSetting.ai_summary_gists_enabled = true
end
diff --git a/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rb b/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rb
index 9eb09e58675..2b41e3a5d2c 100644
--- a/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rb
+++ b/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rb
@@ -1,10 +1,8 @@
# frozen_string_literal: true
describe DiscourseAi::Translation::BaseTranslator do
- let!(:persona) do
- AiPersona.find(
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::PostRawTranslator],
- )
+ let!(:agent) do
+ AiAgent.find(DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::PostRawTranslator])
end
before do
@@ -24,7 +22,7 @@ describe DiscourseAi::Translation::BaseTranslator do
post_translator =
DiscourseAi::Translation::PostRawTranslator.new(text:, target_locale:, post:)
allow(DiscourseAi::Completions::Prompt).to receive(:new).with(
- persona.system_prompt,
+ agent.system_prompt,
messages: array_including({ type: :user, content: a_string_including(text) }),
post_id: post.id,
topic_id: post.topic_id,
@@ -41,16 +39,16 @@ describe DiscourseAi::Translation::BaseTranslator do
expected_content = { content: text, target_locale: target_locale }.to_json
- bot_context = instance_double(DiscourseAi::Personas::BotContext)
- allow(DiscourseAi::Personas::BotContext).to receive(:new).and_return(bot_context)
+ bot_context = instance_double(DiscourseAi::Agents::BotContext)
+ allow(DiscourseAi::Agents::BotContext).to receive(:new).and_return(bot_context)
- mock_bot = instance_double(DiscourseAi::Personas::Bot)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(mock_bot)
+ mock_bot = instance_double(DiscourseAi::Agents::Bot)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(mock_bot)
allow(mock_bot).to receive(:reply).and_yield(llm_response)
post_translator.translate
- expect(DiscourseAi::Personas::BotContext).to have_received(:new).with(
+ expect(DiscourseAi::Agents::BotContext).to have_received(:new).with(
user: an_instance_of(User),
skip_show_thinking: true,
feature_name: "translation",
@@ -59,7 +57,7 @@ describe DiscourseAi::Translation::BaseTranslator do
post: post,
)
- expect(DiscourseAi::Personas::Bot).to have_received(:as)
+ expect(DiscourseAi::Agents::Bot).to have_received(:as)
expect(mock_bot).to have_received(:reply).with(bot_context, llm_args: { max_tokens: 500 })
end
@@ -75,11 +73,11 @@ describe DiscourseAi::Translation::BaseTranslator do
test_cases.each do |text, expected_max_tokens|
translator = DiscourseAi::Translation::PostRawTranslator.new(text: text, target_locale:)
- bot_context = instance_double(DiscourseAi::Personas::BotContext)
- allow(DiscourseAi::Personas::BotContext).to receive(:new).and_return(bot_context)
+ bot_context = instance_double(DiscourseAi::Agents::BotContext)
+ allow(DiscourseAi::Agents::BotContext).to receive(:new).and_return(bot_context)
- mock_bot = instance_double(DiscourseAi::Personas::Bot)
- allow(DiscourseAi::Personas::Bot).to receive(:as).and_return(mock_bot)
+ mock_bot = instance_double(DiscourseAi::Agents::Bot)
+ allow(DiscourseAi::Agents::Bot).to receive(:as).and_return(mock_bot)
allow(mock_bot).to receive(:reply).and_yield("translated #{text[0..10]}")
translator.translate
diff --git a/plugins/discourse-ai/spec/lib/translation/language_detector_spec.rb b/plugins/discourse-ai/spec/lib/translation/language_detector_spec.rb
index 97d50621616..435b1952df8 100644
--- a/plugins/discourse-ai/spec/lib/translation/language_detector_spec.rb
+++ b/plugins/discourse-ai/spec/lib/translation/language_detector_spec.rb
@@ -1,10 +1,8 @@
# frozen_string_literal: true
describe DiscourseAi::Translation::LanguageDetector do
- let!(:persona) do
- AiPersona.find(
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::LocaleDetector],
- )
+ let!(:agent) do
+ AiAgent.find(DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::LocaleDetector])
end
before do
@@ -18,7 +16,7 @@ describe DiscourseAi::Translation::LanguageDetector do
let(:llm_response) { "en-US" }
it "creates the correct prompt" do
- expected_system_prompt = DiscourseAi::Personas::LocaleDetector.new.system_prompt
+ expected_system_prompt = DiscourseAi::Agents::LocaleDetector.new.system_prompt
allow(DiscourseAi::Completions::Prompt).to receive(:new).with(
expected_system_prompt,
@@ -66,10 +64,10 @@ describe DiscourseAi::Translation::LanguageDetector do
it "skips detection when provided blank text" do
blank_detector = described_class.new(" ")
- allow(AiPersona).to receive(:find_by).and_call_original
+ allow(AiAgent).to receive(:find_by).and_call_original
expect(blank_detector.detect).to eq(nil)
- expect(AiPersona).not_to have_received(:find_by)
+ expect(AiAgent).not_to have_received(:find_by)
end
end
end
diff --git a/plugins/discourse-ai/spec/lib/utils/ai_staff_action_logger_spec.rb b/plugins/discourse-ai/spec/lib/utils/ai_staff_action_logger_spec.rb
index 39123cbf021..7b32007daa2 100644
--- a/plugins/discourse-ai/spec/lib/utils/ai_staff_action_logger_spec.rb
+++ b/plugins/discourse-ai/spec/lib/utils/ai_staff_action_logger_spec.rb
@@ -3,7 +3,7 @@
RSpec.describe DiscourseAi::Utils::AiStaffActionLogger do
fab!(:admin)
fab!(:llm_model)
- fab!(:ai_persona)
+ fab!(:ai_agent)
fab!(:group)
subject(:ai_staff_action_logger) { described_class.new(admin) }
@@ -48,23 +48,23 @@ RSpec.describe DiscourseAi::Utils::AiStaffActionLogger do
allow(StaffActionLogger).to receive(:new).with(admin).and_return(staff_action_logger)
allow(staff_action_logger).to receive(:log_custom)
- # Create a persona with a large system prompt
+ # Create a agent with a large system prompt
large_prompt = "a" * 200
- ai_persona.update!(system_prompt: large_prompt)
+ ai_agent.update!(system_prompt: large_prompt)
# Create entity details
- entity_details = { persona_id: ai_persona.id, persona_name: ai_persona.name }
+ entity_details = { agent_id: ai_agent.id, agent_name: ai_agent.name }
field_config = { name: {}, description: {}, system_prompt: { type: :large_text } }
- ai_staff_action_logger.log_creation("persona", ai_persona, field_config, entity_details)
+ ai_staff_action_logger.log_creation("agent", ai_agent, field_config, entity_details)
# Verify with have_received
expect(staff_action_logger).to have_received(:log_custom).with(
- "create_ai_persona",
+ "create_ai_agent",
hash_including(
- "persona_id" => ai_persona.id,
- "name" => ai_persona.name,
+ "agent_id" => ai_agent.id,
+ "name" => ai_agent.name,
"system_prompt" => an_instance_of(String),
),
) do |action, details|
@@ -124,16 +124,16 @@ RSpec.describe DiscourseAi::Utils::AiStaffActionLogger do
initial_attributes = { "name" => "Old Name", "allowed_group_ids" => [] }
# Update with complex JSON
- ai_persona.update!(name: "New Name", allowed_group_ids: [group.id, 999])
+ ai_agent.update!(name: "New Name", allowed_group_ids: [group.id, 999])
field_config = { name: {}, json_fields: %w[allowed_group_ids] }
# Create entity details
- entity_details = { persona_id: ai_persona.id, persona_name: ai_persona.name }
+ entity_details = { agent_id: ai_agent.id, agent_name: ai_agent.name }
ai_staff_action_logger.log_update(
- "persona",
- ai_persona,
+ "agent",
+ ai_agent,
initial_attributes,
field_config,
entity_details,
@@ -141,10 +141,10 @@ RSpec.describe DiscourseAi::Utils::AiStaffActionLogger do
# Verify with have_received
expect(staff_action_logger).to have_received(:log_custom).with(
- "update_ai_persona",
+ "update_ai_agent",
hash_including(
- "persona_id" => ai_persona.id,
- "persona_name" => ai_persona.name,
+ "agent_id" => ai_agent.id,
+ "agent_name" => ai_agent.name,
"name" => "Old Name → New Name",
"allowed_group_ids" => "updated",
),
@@ -295,7 +295,7 @@ RSpec.describe DiscourseAi::Utils::AiStaffActionLogger do
}
# Update with different JSON
- ai_persona.update!(
+ ai_agent.update!(
name: "New Name",
tools: [["search", { "base_query" => "updated" }, true], ["categories", {}, false]],
)
@@ -303,11 +303,11 @@ RSpec.describe DiscourseAi::Utils::AiStaffActionLogger do
field_config = { name: {}, json_fields: %w[tools] }
# Create entity details
- entity_details = { persona_id: ai_persona.id, persona_name: ai_persona.name }
+ entity_details = { agent_id: ai_agent.id, agent_name: ai_agent.name }
ai_staff_action_logger.log_update(
- "persona",
- ai_persona,
+ "agent",
+ ai_agent,
initial_attributes,
field_config,
entity_details,
@@ -315,10 +315,10 @@ RSpec.describe DiscourseAi::Utils::AiStaffActionLogger do
# Verify with have_received
expect(staff_action_logger).to have_received(:log_custom).with(
- "update_ai_persona",
+ "update_ai_agent",
hash_including(
- "persona_id" => ai_persona.id,
- "persona_name" => ai_persona.name,
+ "agent_id" => ai_agent.id,
+ "agent_name" => ai_agent.name,
"name" => "Old Name → New Name",
"tools" => "updated",
),
diff --git a/plugins/discourse-ai/spec/models/ai_agent_multisite_spec.rb b/plugins/discourse-ai/spec/models/ai_agent_multisite_spec.rb
new file mode 100644
index 00000000000..2e26a8c6994
--- /dev/null
+++ b/plugins/discourse-ai/spec/models/ai_agent_multisite_spec.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+RSpec.describe AiAgent, type: :multisite do
+ before { enable_current_plugin }
+
+ it "is able to amend settings on system agents on multisite" do
+ agent = AiAgent.find_by(name: "Designer")
+ expect(agent.allow_personal_messages).to eq(true)
+ agent.update!(allow_personal_messages: false)
+
+ instance = agent.class_instance
+ expect(instance.allow_personal_messages).to eq(false)
+
+ test_multisite_connection("second") do
+ agent = AiAgent.find_by(name: "Designer")
+ expect(agent.allow_personal_messages).to eq(true)
+ instance = agent.class_instance
+ expect(instance.name).to eq("Designer")
+ expect(instance.allow_personal_messages).to eq(true)
+ end
+
+ agent = AiAgent.find_by(name: "Designer")
+ instance = agent.class_instance
+ expect(instance.allow_personal_messages).to eq(false)
+ end
+end
diff --git a/plugins/discourse-ai/spec/models/ai_persona_spec.rb b/plugins/discourse-ai/spec/models/ai_agent_spec.rb
similarity index 52%
rename from plugins/discourse-ai/spec/models/ai_persona_spec.rb
rename to plugins/discourse-ai/spec/models/ai_agent_spec.rb
index 986280c28da..e92c6c86ec4 100644
--- a/plugins/discourse-ai/spec/models/ai_persona_spec.rb
+++ b/plugins/discourse-ai/spec/models/ai_agent_spec.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-RSpec.describe AiPersona do
- subject(:basic_persona) do
- AiPersona.new(
+RSpec.describe AiAgent do
+ subject(:basic_agent) do
+ AiAgent.new(
name: "test",
description: "test",
system_prompt: "test",
@@ -17,74 +17,74 @@ RSpec.describe AiPersona do
before { enable_current_plugin }
it "validates context settings" do
- expect(basic_persona.valid?).to eq(true)
+ expect(basic_agent.valid?).to eq(true)
- basic_persona.max_context_posts = 0
- expect(basic_persona.valid?).to eq(false)
- expect(basic_persona.errors[:max_context_posts]).to eq(["must be greater than 0"])
+ basic_agent.max_context_posts = 0
+ expect(basic_agent.valid?).to eq(false)
+ expect(basic_agent.errors[:max_context_posts]).to eq(["must be greater than 0"])
- basic_persona.max_context_posts = 1
- expect(basic_persona.valid?).to eq(true)
+ basic_agent.max_context_posts = 1
+ expect(basic_agent.valid?).to eq(true)
- basic_persona.max_context_posts = nil
- expect(basic_persona.valid?).to eq(true)
+ basic_agent.max_context_posts = nil
+ expect(basic_agent.valid?).to eq(true)
end
it "validates tools" do
Fabricate(:ai_tool, id: 1)
Fabricate(:ai_tool, id: 2, name: "Archie search", tool_name: "search")
- expect(basic_persona.valid?).to eq(true)
+ expect(basic_agent.valid?).to eq(true)
- basic_persona.tools = %w[search image_generation]
- expect(basic_persona.valid?).to eq(true)
+ basic_agent.tools = %w[search image_generation]
+ expect(basic_agent.valid?).to eq(true)
- basic_persona.tools = %w[search image_generation search]
- expect(basic_persona.valid?).to eq(false)
- expect(basic_persona.errors[:tools]).to eq(["Can not have duplicate tools"])
+ basic_agent.tools = %w[search image_generation search]
+ expect(basic_agent.valid?).to eq(false)
+ expect(basic_agent.errors[:tools]).to eq(["Can not have duplicate tools"])
- basic_persona.tools = [
+ basic_agent.tools = [
["custom-1", { test: "test" }, false],
["custom-2", { test: "test" }, false],
]
- expect(basic_persona.valid?).to eq(true)
- expect(basic_persona.errors[:tools]).to eq([])
+ expect(basic_agent.valid?).to eq(true)
+ expect(basic_agent.errors[:tools]).to eq([])
- basic_persona.tools = [
+ basic_agent.tools = [
["custom-1", { test: "test" }, false],
["custom-1", { test: "test" }, false],
]
- expect(basic_persona.valid?).to eq(false)
- expect(basic_persona.errors[:tools]).to eq(["Can not have duplicate tools"])
+ expect(basic_agent.valid?).to eq(false)
+ expect(basic_agent.errors[:tools]).to eq(["Can not have duplicate tools"])
- basic_persona.tools = [
+ basic_agent.tools = [
["custom-1", { test: "test" }, false],
["custom-2", { test: "test" }, false],
"image_generation",
]
- expect(basic_persona.valid?).to eq(true)
- expect(basic_persona.errors[:tools]).to eq([])
+ expect(basic_agent.valid?).to eq(true)
+ expect(basic_agent.errors[:tools]).to eq([])
- basic_persona.tools = [
+ basic_agent.tools = [
["custom-1", { test: "test" }, false],
["custom-2", { test: "test" }, false],
"Search",
]
- expect(basic_persona.valid?).to eq(false)
- expect(basic_persona.errors[:tools]).to eq(["Can not have duplicate tools"])
+ expect(basic_agent.valid?).to eq(false)
+ expect(basic_agent.errors[:tools]).to eq(["Can not have duplicate tools"])
end
it "allows creation of user" do
- user = basic_persona.create_user!
+ user = basic_agent.create_user!
expect(user.username).to eq("test_bot")
expect(user.name).to eq("Test")
expect(user.bot?).to be(true)
- expect(user.id).to be <= AiPersona::FIRST_PERSONA_USER_ID
+ expect(user.id).to be <= AiAgent::FIRST_AGENT_USER_ID
end
it "removes all rag embeddings when rag params change" do
- persona =
- AiPersona.create!(
+ agent =
+ AiAgent.create!(
name: "test",
description: "test",
system_prompt: "test",
@@ -96,20 +96,20 @@ RSpec.describe AiPersona do
id =
RagDocumentFragment.create!(
- target: persona,
+ target: agent,
fragment: "test",
fragment_number: 1,
upload: Fabricate(:upload),
).id
- persona.rag_chunk_tokens = 20
- persona.save!
+ agent.rag_chunk_tokens = 20
+ agent.save!
expect(RagDocumentFragment.exists?(id)).to eq(false)
end
- it "defines singleton methods on system persona classes" do
- forum_helper = AiPersona.find_by(name: "Forum Helper")
+ it "defines singleton methods on system agent classes" do
+ forum_helper = AiAgent.find_by(name: "Forum Helper")
forum_helper.update!(
user_id: 1,
default_llm_id: llm_model.id,
@@ -135,9 +135,9 @@ RSpec.describe AiPersona do
expect(klass.allow_chat_direct_messages).to eq(true)
end
- it "defines singleton methods non persona classes" do
- persona =
- AiPersona.create!(
+ it "defines singleton methods non agent classes" do
+ agent =
+ AiAgent.create!(
name: "test",
description: "test",
system_prompt: "test",
@@ -152,9 +152,9 @@ RSpec.describe AiPersona do
user_id: 1,
)
- klass = persona.class_instance
+ klass = agent.class_instance
- expect(klass.id).to eq(persona.id)
+ expect(klass.id).to eq(agent.id)
expect(klass.system).to eq(false)
expect(klass.allowed_group_ids).to eq([])
expect(klass.user_id).to eq(1)
@@ -167,8 +167,8 @@ RSpec.describe AiPersona do
end
it "does not allow setting allowing chat without a default_llm" do
- persona =
- AiPersona.create(
+ agent =
+ AiAgent.create(
name: "test",
description: "test",
system_prompt: "test",
@@ -177,13 +177,13 @@ RSpec.describe AiPersona do
allow_chat_channel_mentions: true,
)
- expect(persona.valid?).to eq(false)
- expect(persona.errors[:default_llm].first).to eq(
- I18n.t("discourse_ai.ai_bot.personas.default_llm_required"),
+ expect(agent.valid?).to eq(false)
+ expect(agent.errors[:default_llm].first).to eq(
+ I18n.t("discourse_ai.ai_bot.agents.default_llm_required"),
)
- persona =
- AiPersona.create(
+ agent =
+ AiAgent.create(
name: "test",
description: "test",
system_prompt: "test",
@@ -192,13 +192,13 @@ RSpec.describe AiPersona do
allow_chat_direct_messages: true,
)
- expect(persona.valid?).to eq(false)
- expect(persona.errors[:default_llm].first).to eq(
- I18n.t("discourse_ai.ai_bot.personas.default_llm_required"),
+ expect(agent.valid?).to eq(false)
+ expect(agent.errors[:default_llm].first).to eq(
+ I18n.t("discourse_ai.ai_bot.agents.default_llm_required"),
)
- persona =
- AiPersona.create(
+ agent =
+ AiAgent.create(
name: "test",
description: "test",
system_prompt: "test",
@@ -207,14 +207,14 @@ RSpec.describe AiPersona do
allow_topic_mentions: true,
)
- expect(persona.valid?).to eq(false)
- expect(persona.errors[:default_llm].first).to eq(
- I18n.t("discourse_ai.ai_bot.personas.default_llm_required"),
+ expect(agent.valid?).to eq(false)
+ expect(agent.errors[:default_llm].first).to eq(
+ I18n.t("discourse_ai.ai_bot.agents.default_llm_required"),
)
end
it "does not leak caches between sites" do
- AiPersona.create!(
+ AiAgent.create!(
name: "pun_bot",
description: "you write puns",
system_prompt: "you are pun bot",
@@ -222,86 +222,86 @@ RSpec.describe AiPersona do
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
)
- AiPersona.all_personas
+ AiAgent.all_agents
- expect(AiPersona.persona_cache[:value].length).to be > (0)
+ expect(AiAgent.agent_cache[:value].length).to be > (0)
RailsMultisite::ConnectionManagement.stubs(:current_db) { "abc" }
- expect(AiPersona.persona_cache[:value]).to eq(nil)
+ expect(AiAgent.agent_cache[:value]).to eq(nil)
end
describe ".find_by_id_from_cache" do
- fab!(:persona) do
- AiPersona.create!(
- name: "cached_persona",
- description: "test persona for cache",
+ fab!(:agent) do
+ AiAgent.create!(
+ name: "cached_agent",
+ description: "test agent for cache",
system_prompt: "you are a test",
tools: [],
allowed_group_ids: [],
)
end
- it "returns nil for blank persona_id" do
- expect(AiPersona.find_by_id_from_cache(nil)).to eq(nil)
- expect(AiPersona.find_by_id_from_cache("")).to eq(nil)
+ it "returns nil for blank agent_id" do
+ expect(AiAgent.find_by_id_from_cache(nil)).to eq(nil)
+ expect(AiAgent.find_by_id_from_cache("")).to eq(nil)
end
- it "finds persona by id from cache" do
- result = AiPersona.find_by_id_from_cache(persona.id)
+ it "finds agent by id from cache" do
+ result = AiAgent.find_by_id_from_cache(agent.id)
expect(result).to be_present
- expect(result.id).to eq(persona.id)
- expect(result.name).to eq("cached_persona")
+ expect(result.id).to eq(agent.id)
+ expect(result.name).to eq("cached_agent")
end
- it "finds persona when id is provided as a string" do
- result = AiPersona.find_by_id_from_cache(persona.id.to_s)
+ it "finds agent when id is provided as a string" do
+ result = AiAgent.find_by_id_from_cache(agent.id.to_s)
expect(result).to be_present
- expect(result.id).to eq(persona.id)
+ expect(result.id).to eq(agent.id)
end
- it "returns nil for non-existent persona id" do
- result = AiPersona.find_by_id_from_cache(999_999)
+ it "returns nil for non-existent agent id" do
+ result = AiAgent.find_by_id_from_cache(999_999)
expect(result).to eq(nil)
end
- it "finds disabled personas" do
- persona.update!(enabled: false)
- result = AiPersona.find_by_id_from_cache(persona.id)
+ it "finds disabled agents" do
+ agent.update!(enabled: false)
+ result = AiAgent.find_by_id_from_cache(agent.id)
expect(result).to be_present
- expect(result.id).to eq(persona.id)
+ expect(result.id).to eq(agent.id)
end
it "uses cache and avoids database queries after initial load" do
- AiPersona.find_by_id_from_cache(persona.id)
+ AiAgent.find_by_id_from_cache(agent.id)
- query_count = track_sql_queries { AiPersona.find_by_id_from_cache(persona.id) }.count
+ query_count = track_sql_queries { AiAgent.find_by_id_from_cache(agent.id) }.count
expect(query_count).to eq(0)
end
it "falls back to database when cache is cleared after initial load" do
- result_before = AiPersona.find_by_id_from_cache(persona.id)
+ result_before = AiAgent.find_by_id_from_cache(agent.id)
expect(result_before).to be_present
- AiPersona.persona_cache.flush!
+ AiAgent.agent_cache.flush!
query_count =
track_sql_queries do
- result_after = AiPersona.find_by_id_from_cache(persona.id)
+ result_after = AiAgent.find_by_id_from_cache(agent.id)
expect(result_after).to be_present
- expect(result_after.id).to eq(persona.id)
- expect(result_after.name).to eq("cached_persona")
+ expect(result_after.id).to eq(agent.id)
+ expect(result_after.name).to eq("cached_agent")
end.count
expect(query_count).to be > 0
end
end
- describe "system persona validations" do
- let(:system_persona) do
- AiPersona.create!(
- name: "system_persona",
- description: "system persona",
- system_prompt: "system persona",
+ describe "system agent validations" do
+ let(:system_agent) do
+ AiAgent.create!(
+ name: "system_agent",
+ description: "system agent",
+ system_prompt: "system agent",
tools: %w[Search Time],
response_format: [{ key: "summary", type: "string" }],
examples: [%w[user_msg1 assistant_msg1], %w[user_msg2 assistant_msg2]],
@@ -309,25 +309,25 @@ RSpec.describe AiPersona do
)
end
- context "when modifying a system persona" do
+ context "when modifying a system agent" do
it "allows changing tool options without allowing tool additions/removals" do
tools = [["Search", { "base_query" => "abc" }], ["Time"]]
- system_persona.update!(tools: tools)
+ system_agent.update!(tools: tools)
- system_persona.reload
- expect(system_persona.tools).to eq(tools)
+ system_agent.reload
+ expect(system_agent.tools).to eq(tools)
invalid_tools = ["Time"]
- system_persona.update(tools: invalid_tools)
- expect(system_persona.errors[:base]).to include(
- I18n.t("discourse_ai.ai_bot.personas.cannot_edit_system_persona"),
+ system_agent.update(tools: invalid_tools)
+ expect(system_agent.errors[:base]).to include(
+ I18n.t("discourse_ai.ai_bot.agents.cannot_edit_system_agent"),
)
end
it "doesn't accept response format changes" do
new_format = [{ key: "summary2", type: "string" }]
- expect { system_persona.update!(response_format: new_format) }.to raise_error(
+ expect { system_agent.update!(response_format: new_format) }.to raise_error(
ActiveRecord::RecordInvalid,
)
end
@@ -335,7 +335,7 @@ RSpec.describe AiPersona do
it "doesn't accept additional format changes" do
new_format = [{ key: "summary", type: "string" }, { key: "summary2", type: "string" }]
- expect { system_persona.update!(response_format: new_format) }.to raise_error(
+ expect { system_agent.update!(response_format: new_format) }.to raise_error(
ActiveRecord::RecordInvalid,
)
end
@@ -343,7 +343,7 @@ RSpec.describe AiPersona do
it "doesn't accept changes to examples" do
other_examples = [%w[user_msg1 assistant_msg1]]
- expect { system_persona.update!(examples: other_examples) }.to raise_error(
+ expect { system_agent.update!(examples: other_examples) }.to raise_error(
ActiveRecord::RecordInvalid,
)
end
@@ -351,21 +351,21 @@ RSpec.describe AiPersona do
end
describe "agentic execution mode defaults and propagation" do
- it "assigns safe defaults to a persona created without agentic fields" do
- persona =
- AiPersona.create!(
- name: "legacy_persona",
+ it "assigns safe defaults to a agent created without agentic fields" do
+ agent =
+ AiAgent.create!(
+ name: "legacy_agent",
description: "no agentic fields set",
system_prompt: "test",
tools: [],
allowed_group_ids: [],
)
- expect(persona.execution_mode).to eq("default")
- expect(persona.max_turn_tokens).to be_nil
- expect(persona.compression_threshold).to be_nil
+ expect(agent.execution_mode).to eq("default")
+ expect(agent.max_turn_tokens).to be_nil
+ expect(agent.compression_threshold).to be_nil
- klass = persona.class_instance
+ klass = agent.class_instance
expect(klass.execution_mode).to eq("default")
expect(klass.max_turn_tokens).to be_nil
@@ -373,9 +373,9 @@ RSpec.describe AiPersona do
end
it "requires compression_threshold for agentic mode but not for default mode" do
- persona =
- AiPersona.new(
- name: "agentic_persona",
+ agent =
+ AiAgent.new(
+ name: "agentic_agent",
description: "test",
system_prompt: "test",
tools: [],
@@ -383,41 +383,41 @@ RSpec.describe AiPersona do
execution_mode: "agentic",
)
- expect(persona.valid?).to eq(false)
- expect(persona.errors[:compression_threshold]).to be_present
+ expect(agent.valid?).to eq(false)
+ expect(agent.errors[:compression_threshold]).to be_present
- persona.compression_threshold = 75
- expect(persona.valid?).to eq(true)
+ agent.compression_threshold = 75
+ expect(agent.valid?).to eq(true)
- persona.execution_mode = "default"
- persona.compression_threshold = nil
- expect(persona.valid?).to eq(true)
+ agent.execution_mode = "default"
+ agent.compression_threshold = nil
+ expect(agent.valid?).to eq(true)
end
end
describe "validates examples format" do
it "doesn't accept examples that are not arrays" do
- basic_persona.examples = [1]
+ basic_agent.examples = [1]
- expect(basic_persona.valid?).to eq(false)
- expect(basic_persona.errors[:examples].first).to eq(
- I18n.t("discourse_ai.personas.malformed_examples"),
+ expect(basic_agent.valid?).to eq(false)
+ expect(basic_agent.errors[:examples].first).to eq(
+ I18n.t("discourse_ai.agents.malformed_examples"),
)
end
it "doesn't accept examples that don't come in pairs" do
- basic_persona.examples = [%w[user_msg1]]
+ basic_agent.examples = [%w[user_msg1]]
- expect(basic_persona.valid?).to eq(false)
- expect(basic_persona.errors[:examples].first).to eq(
- I18n.t("discourse_ai.personas.malformed_examples"),
+ expect(basic_agent.valid?).to eq(false)
+ expect(basic_agent.errors[:examples].first).to eq(
+ I18n.t("discourse_ai.agents.malformed_examples"),
)
end
it "works when example is well formatted" do
- basic_persona.examples = [%w[user_msg1 assistant1]]
+ basic_agent.examples = [%w[user_msg1 assistant1]]
- expect(basic_persona.valid?).to eq(true)
+ expect(basic_agent.valid?).to eq(true)
end
end
end
diff --git a/plugins/discourse-ai/spec/models/ai_persona_multisite_spec.rb b/plugins/discourse-ai/spec/models/ai_persona_multisite_spec.rb
deleted file mode 100644
index d2c15085b1d..00000000000
--- a/plugins/discourse-ai/spec/models/ai_persona_multisite_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe AiPersona, type: :multisite do
- before { enable_current_plugin }
-
- it "is able to amend settings on system personas on multisite" do
- persona = AiPersona.find_by(name: "Designer")
- expect(persona.allow_personal_messages).to eq(true)
- persona.update!(allow_personal_messages: false)
-
- instance = persona.class_instance
- expect(instance.allow_personal_messages).to eq(false)
-
- test_multisite_connection("second") do
- persona = AiPersona.find_by(name: "Designer")
- expect(persona.allow_personal_messages).to eq(true)
- instance = persona.class_instance
- expect(instance.name).to eq("Designer")
- expect(instance.allow_personal_messages).to eq(true)
- end
-
- persona = AiPersona.find_by(name: "Designer")
- instance = persona.class_instance
- expect(instance.allow_personal_messages).to eq(false)
- end
-end
diff --git a/plugins/discourse-ai/spec/models/ai_tool_spec.rb b/plugins/discourse-ai/spec/models/ai_tool_spec.rb
index b71638aa4b7..3ceff90ed92 100644
--- a/plugins/discourse-ai/spec/models/ai_tool_spec.rb
+++ b/plugins/discourse-ai/spec/models/ai_tool_spec.rb
@@ -213,7 +213,7 @@ RSpec.describe AiTool do
},
)
- expect { runner.invoke }.to raise_error(DiscourseAi::Personas::ToolRunner::TooManyRequestsError)
+ expect { runner.invoke }.to raise_error(DiscourseAi::Agents::ToolRunner::TooManyRequestsError)
end
it "can perform GET HTTP requests" do
@@ -658,15 +658,13 @@ RSpec.describe AiTool do
end
end
- context "when updating personas" do
- fab!(:ai_persona) do
- Fabricate(:ai_persona, name: "TestPersona", system_prompt: "Original prompt")
- end
+ context "when updating agents" do
+ fab!(:ai_agent) { Fabricate(:ai_agent, name: "TestAgent", system_prompt: "Original prompt") }
- it "can update a persona with proper permissions" do
+ it "can update a agent with proper permissions" do
script = <<~JS
function invoke(params) {
- return discourse.updatePersona(params.persona_name, {
+ return discourse.updateAgent(params.agent_name, {
system_prompt: params.new_prompt,
temperature: 0.7,
top_p: 0.9
@@ -677,28 +675,28 @@ RSpec.describe AiTool do
tool = create_tool(script: script)
runner =
tool.runner(
- { persona_name: "TestPersona", new_prompt: "Updated system prompt" },
+ { agent_name: "TestAgent", new_prompt: "Updated system prompt" },
llm: nil,
bot_user: bot_user,
)
result = runner.invoke
expect(result["success"]).to eq(true)
- expect(result["persona"]["system_prompt"]).to eq("Updated system prompt")
- expect(result["persona"]["temperature"]).to eq(0.7)
+ expect(result["agent"]["system_prompt"]).to eq("Updated system prompt")
+ expect(result["agent"]["temperature"]).to eq(0.7)
- ai_persona.reload
- expect(ai_persona.system_prompt).to eq("Updated system prompt")
- expect(ai_persona.temperature).to eq(0.7)
- expect(ai_persona.top_p).to eq(0.9)
+ ai_agent.reload
+ expect(ai_agent.system_prompt).to eq("Updated system prompt")
+ expect(ai_agent.temperature).to eq(0.7)
+ expect(ai_agent.top_p).to eq(0.9)
end
end
- context "when fetching persona information" do
- fab!(:ai_persona) do
+ context "when fetching agent information" do
+ fab!(:ai_agent) do
Fabricate(
- :ai_persona,
- name: "TestPersona",
+ :ai_agent,
+ name: "TestAgent",
description: "Test description",
system_prompt: "Test system prompt",
temperature: 0.8,
@@ -708,21 +706,21 @@ RSpec.describe AiTool do
)
end
- it "can fetch a persona by name" do
+ it "can fetch a agent by name" do
script = <<~JS
function invoke(params) {
- const persona = discourse.getPersona(params.persona_name);
- return persona;
+ const agent = discourse.getAgent(params.agent_name);
+ return agent;
}
JS
tool = create_tool(script: script)
- runner = tool.runner({ persona_name: "TestPersona" }, llm: nil, bot_user: bot_user)
+ runner = tool.runner({ agent_name: "TestAgent" }, llm: nil, bot_user: bot_user)
result = runner.invoke
- expect(result["id"]).to eq(ai_persona.id)
- expect(result["name"]).to eq("TestPersona")
+ expect(result["id"]).to eq(ai_agent.id)
+ expect(result["name"]).to eq("TestAgent")
expect(result["description"]).to eq("Test description")
expect(result["system_prompt"]).to eq("Test system prompt")
expect(result["temperature"]).to eq(0.8)
@@ -732,25 +730,25 @@ RSpec.describe AiTool do
expect(result["tools"][1]).to be_a(Array)
end
- it "raises an error when the persona doesn't exist" do
+ it "raises an error when the agent doesn't exist" do
script = <<~JS
function invoke(params) {
- return discourse.getPersona("NonExistentPersona");
+ return discourse.getAgent("NonExistentAgent");
}
JS
tool = create_tool(script: script)
runner = tool.runner({}, llm: nil, bot_user: bot_user)
- expect { runner.invoke }.to raise_error(MiniRacer::RuntimeError, /Persona not found/)
+ expect { runner.invoke }.to raise_error(MiniRacer::RuntimeError, /Agent not found/)
end
- it "can update a persona after fetching it" do
+ it "can update a agent after fetching it" do
script = <<~JS
function invoke(params) {
- const persona = discourse.getPersona("TestPersona");
- return persona.update({
- system_prompt: "Updated through getPersona().update()",
+ const agent = discourse.getAgent("TestAgent");
+ return agent.update({
+ system_prompt: "Updated through getAgent().update()",
temperature: 0.5
});
}
@@ -762,9 +760,9 @@ RSpec.describe AiTool do
result = runner.invoke
expect(result["success"]).to eq(true)
- ai_persona.reload
- expect(ai_persona.system_prompt).to eq("Updated through getPersona().update()")
- expect(ai_persona.temperature).to eq(0.5)
+ ai_agent.reload
+ expect(ai_agent.system_prompt).to eq("Updated through getAgent().update()")
+ expect(ai_agent.temperature).to eq(0.5)
end
end
diff --git a/plugins/discourse-ai/spec/models/rag_document_fragment_spec.rb b/plugins/discourse-ai/spec/models/rag_document_fragment_spec.rb
index 1797f124b34..d1a3eb418f7 100644
--- a/plugins/discourse-ai/spec/models/rag_document_fragment_spec.rb
+++ b/plugins/discourse-ai/spec/models/rag_document_fragment_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe RagDocumentFragment do
- fab!(:persona, :ai_persona)
+ fab!(:agent, :ai_agent)
fab!(:upload_1, :upload)
fab!(:upload_2, :upload)
fab!(:vector_def, :embedding_definition)
@@ -12,8 +12,8 @@ RSpec.describe RagDocumentFragment do
SiteSetting.ai_embeddings_enabled = true
end
- describe ".link_uploads_and_persona" do
- it "does nothing if there is no persona" do
+ describe ".link_uploads_and_agent" do
+ it "does nothing if there is no agent" do
expect { described_class.link_target_and_uploads(nil, [upload_1.id]) }.not_to change(
Jobs::DigestRagUpload.jobs,
:size,
@@ -21,7 +21,7 @@ RSpec.describe RagDocumentFragment do
end
it "does nothing if there are no uploads" do
- expect { described_class.link_target_and_uploads(persona, []) }.not_to change(
+ expect { described_class.link_target_and_uploads(agent, []) }.not_to change(
Jobs::DigestRagUpload.jobs,
:size,
)
@@ -29,21 +29,21 @@ RSpec.describe RagDocumentFragment do
it "queues a job for each upload to generate fragments" do
expect {
- described_class.link_target_and_uploads(persona, [upload_1.id, upload_2.id])
+ described_class.link_target_and_uploads(agent, [upload_1.id, upload_2.id])
}.to change(Jobs::DigestRagUpload.jobs, :size).by(2)
end
- it "creates references between the persona an each upload" do
- described_class.link_target_and_uploads(persona, [upload_1.id, upload_2.id])
+ it "creates references between the agent an each upload" do
+ described_class.link_target_and_uploads(agent, [upload_1.id, upload_2.id])
- refs = UploadReference.where(target: persona).pluck(:upload_id)
+ refs = UploadReference.where(target: agent).pluck(:upload_id)
expect(refs).to contain_exactly(upload_1.id, upload_2.id)
end
end
describe ".update_target_uploads" do
- it "does nothing if there is no persona" do
+ it "does nothing if there is no agent" do
expect { described_class.update_target_uploads(nil, [upload_1.id]) }.not_to change(
Jobs::DigestRagUpload.jobs,
:size,
@@ -51,24 +51,24 @@ RSpec.describe RagDocumentFragment do
end
it "deletes the fragment if its not present in the uploads list" do
- fragment = Fabricate(:rag_document_fragment, target: persona)
+ fragment = Fabricate(:rag_document_fragment, target: agent)
- described_class.update_target_uploads(persona, [])
+ described_class.update_target_uploads(agent, [])
expect { fragment.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
- it "delete references between the upload and the persona" do
- described_class.link_target_and_uploads(persona, [upload_1.id, upload_2.id])
- described_class.update_target_uploads(persona, [upload_2.id])
+ it "delete references between the upload and the agent" do
+ described_class.link_target_and_uploads(agent, [upload_1.id, upload_2.id])
+ described_class.update_target_uploads(agent, [upload_2.id])
- refs = UploadReference.where(target: persona).pluck(:upload_id)
+ refs = UploadReference.where(target: agent).pluck(:upload_id)
expect(refs).to contain_exactly(upload_2.id)
end
it "queues jobs to generate new fragments" do
- expect { described_class.update_target_uploads(persona, [upload_1.id]) }.to change(
+ expect { described_class.update_target_uploads(agent, [upload_1.id]) }.to change(
Jobs::DigestRagUpload.jobs,
:size,
).by(1)
@@ -79,11 +79,11 @@ RSpec.describe RagDocumentFragment do
let(:vector) { DiscourseAi::Embeddings::Vector.instance }
let(:rag_document_fragment_1) do
- Fabricate(:rag_document_fragment, upload: upload_1, target: persona)
+ Fabricate(:rag_document_fragment, upload: upload_1, target: agent)
end
let(:rag_document_fragment_2) do
- Fabricate(:rag_document_fragment, upload: upload_1, target: persona)
+ Fabricate(:rag_document_fragment, upload: upload_1, target: agent)
end
let(:expected_embedding) { [0.0038493] * vector_def.dimensions }
@@ -104,8 +104,8 @@ RSpec.describe RagDocumentFragment do
it "regenerates all embeddings if ai_embeddings_selected_model changes" do
old_id = rag_document_fragment_1.id
- UploadReference.create!(upload_id: upload_1.id, target: persona)
- UploadReference.create!(upload_id: upload_2.id, target: persona)
+ UploadReference.create!(upload_id: upload_1.id, target: agent)
+ UploadReference.create!(upload_id: upload_2.id, target: agent)
Sidekiq::Testing.fake! do
SiteSetting.ai_embeddings_selected_model = Fabricate(:open_ai_embedding_def).id
@@ -115,7 +115,7 @@ RSpec.describe RagDocumentFragment do
end
it "returns total, indexed and unindexed fragments for each upload" do
- results = described_class.indexing_status(persona, [upload_1, upload_2])
+ results = described_class.indexing_status(agent, [upload_1, upload_2])
upload_1_status = results[upload_1.id]
expect(upload_1_status[:total]).to eq(2)
diff --git a/plugins/discourse-ai/spec/models/user_option_spec.rb b/plugins/discourse-ai/spec/models/user_option_spec.rb
index 50d80462366..6fd1571ff40 100644
--- a/plugins/discourse-ai/spec/models/user_option_spec.rb
+++ b/plugins/discourse-ai/spec/models/user_option_spec.rb
@@ -4,8 +4,8 @@ RSpec.describe UserOption do
fab!(:user)
fab!(:llm_model)
fab!(:group)
- fab!(:ai_persona) do
- Fabricate(:ai_persona, allowed_group_ids: [group.id], default_llm_id: llm_model.id)
+ fab!(:ai_agent) do
+ Fabricate(:ai_agent, allowed_group_ids: [group.id], default_llm_id: llm_model.id)
end
before do
@@ -16,7 +16,7 @@ RSpec.describe UserOption do
describe "#ai_search_discoveries" do
before do
- SiteSetting.ai_discover_persona = ai_persona.id
+ SiteSetting.ai_discover_agent = ai_agent.id
group.add(user)
end
diff --git a/plugins/discourse-ai/spec/plugin_helper.rb b/plugins/discourse-ai/spec/plugin_helper.rb
index 177ebfa1863..9ac1e685732 100644
--- a/plugins/discourse-ai/spec/plugin_helper.rb
+++ b/plugins/discourse-ai/spec/plugin_helper.rb
@@ -13,8 +13,8 @@ module DiscourseAi::ChatBotHelper
end
end
- def assign_persona_to(setting_name, allowed_group_ids)
- Fabricate(:ai_persona, allowed_group_ids: allowed_group_ids).tap do |p|
+ def assign_agent_to(setting_name, allowed_group_ids)
+ Fabricate(:ai_agent, allowed_group_ids: allowed_group_ids).tap do |p|
SiteSetting.public_send("#{setting_name}=", p.id)
end
end
diff --git a/plugins/discourse-ai/spec/requests/admin/ai_personas_controller_spec.rb b/plugins/discourse-ai/spec/requests/admin/ai_agents_controller_spec.rb
similarity index 68%
rename from plugins/discourse-ai/spec/requests/admin/ai_personas_controller_spec.rb
rename to plugins/discourse-ai/spec/requests/admin/ai_agents_controller_spec.rb
index bc7327bd2b9..7acf51310a6 100644
--- a/plugins/discourse-ai/spec/requests/admin/ai_personas_controller_spec.rb
+++ b/plugins/discourse-ai/spec/requests/admin/ai_agents_controller_spec.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::Admin::AiPersonasController do
+RSpec.describe DiscourseAi::Admin::AiAgentsController do
fab!(:admin)
fab!(:admin_2, :admin)
- fab!(:ai_persona)
+ fab!(:ai_agent)
fab!(:embedding_definition)
fab!(:llm_model)
@@ -16,12 +16,12 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
describe "GET #index" do
it "returns a success response" do
- get "/admin/plugins/discourse-ai/ai-personas.json"
+ get "/admin/plugins/discourse-ai/ai-agents.json"
expect(response).to be_successful
- expect(response.parsed_body["ai_personas"].length).to eq(AiPersona.count)
+ expect(response.parsed_body["ai_agents"].length).to eq(AiAgent.count)
expect(response.parsed_body["meta"]["tools"].length).to eq(
- DiscourseAi::Personas::Persona.all_available_tools.length,
+ DiscourseAi::Agents::Agent.all_available_tools.length,
)
end
@@ -38,7 +38,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
enabled: true,
)
- get "/admin/plugins/discourse-ai/ai-personas.json"
+ get "/admin/plugins/discourse-ai/ai-agents.json"
expect(response).to be_successful
tools = response.parsed_body["meta"]["tools"]
@@ -48,7 +48,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
it "sideloads llms" do
- get "/admin/plugins/discourse-ai/ai-personas.json"
+ get "/admin/plugins/discourse-ai/ai-agents.json"
expect(response).to be_successful
expect(response.parsed_body["meta"]["llms"]).to eq(
@@ -63,10 +63,10 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
it "returns tool options with each tool" do
- persona1 = Fabricate(:ai_persona, name: "search1", tools: ["SearchCommand"])
- persona2 =
+ agent1 = Fabricate(:ai_agent, name: "search1", tools: ["SearchCommand"])
+ agent2 =
Fabricate(
- :ai_persona,
+ :ai_agent,
name: "search2",
tools: [["SearchCommand", { base_query: "test" }, true]],
allow_topic_mentions: true,
@@ -77,24 +77,24 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
question_consolidator_llm_id: llm_model.id,
forced_tool_count: 2,
)
- persona2.create_user!
+ agent2.create_user!
- get "/admin/plugins/discourse-ai/ai-personas.json"
+ get "/admin/plugins/discourse-ai/ai-agents.json"
expect(response).to be_successful
- serializer_persona1 = response.parsed_body["ai_personas"].find { |p| p["id"] == persona1.id }
- serializer_persona2 = response.parsed_body["ai_personas"].find { |p| p["id"] == persona2.id }
+ serializer_agent1 = response.parsed_body["ai_agents"].find { |p| p["id"] == agent1.id }
+ serializer_agent2 = response.parsed_body["ai_agents"].find { |p| p["id"] == agent2.id }
- expect(serializer_persona2["allow_topic_mentions"]).to eq(true)
- expect(serializer_persona2["allow_personal_messages"]).to eq(true)
- expect(serializer_persona2["allow_chat_channel_mentions"]).to eq(true)
- expect(serializer_persona2["allow_chat_direct_messages"]).to eq(true)
+ expect(serializer_agent2["allow_topic_mentions"]).to eq(true)
+ expect(serializer_agent2["allow_personal_messages"]).to eq(true)
+ expect(serializer_agent2["allow_chat_channel_mentions"]).to eq(true)
+ expect(serializer_agent2["allow_chat_direct_messages"]).to eq(true)
- expect(serializer_persona2["default_llm_id"]).to eq(llm_model.id)
- expect(serializer_persona2["question_consolidator_llm_id"]).to eq(llm_model.id)
- expect(serializer_persona2["user_id"]).to eq(persona2.user_id)
- expect(serializer_persona2["user"]["id"]).to eq(persona2.user_id)
- expect(serializer_persona2["forced_tool_count"]).to eq(2)
+ expect(serializer_agent2["default_llm_id"]).to eq(llm_model.id)
+ expect(serializer_agent2["question_consolidator_llm_id"]).to eq(llm_model.id)
+ expect(serializer_agent2["user_id"]).to eq(agent2.user_id)
+ expect(serializer_agent2["user"]["id"]).to eq(agent2.user_id)
+ expect(serializer_agent2["forced_tool_count"]).to eq(2)
tools = response.parsed_body["meta"]["tools"]
search_tool = tools.find { |c| c["id"] == "Search" }
@@ -126,8 +126,8 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
},
)
- expect(serializer_persona1["tools"]).to eq(["SearchCommand"])
- expect(serializer_persona2["tools"]).to eq(
+ expect(serializer_agent1["tools"]).to eq(["SearchCommand"])
+ expect(serializer_agent2["tools"]).to eq(
[["SearchCommand", { "base_query" => "test" }, true]],
)
end
@@ -138,12 +138,12 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
TranslationOverride.upsert!(
SiteSetting.default_locale,
- "discourse_ai.ai_bot.personas.general.name",
+ "discourse_ai.ai_bot.agents.general.name",
"Général",
)
TranslationOverride.upsert!(
SiteSetting.default_locale,
- "discourse_ai.ai_bot.personas.general.description",
+ "discourse_ai.ai_bot.agents.general.description",
"Général Description",
)
end
@@ -151,44 +151,50 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
after do
TranslationOverride.revert!(
SiteSetting.default_locale,
- "discourse_ai.ai_bot.personas.general.name",
+ "discourse_ai.ai_bot.agents.general.name",
)
TranslationOverride.revert!(
SiteSetting.default_locale,
- "discourse_ai.ai_bot.personas.general.description",
+ "discourse_ai.ai_bot.agents.general.description",
)
end
- it "returns localized persona names and descriptions" do
- get "/admin/plugins/discourse-ai/ai-personas.json"
+ it "returns localized agent names and descriptions" do
+ get "/admin/plugins/discourse-ai/ai-agents.json"
- id = DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::General]
- persona = response.parsed_body["ai_personas"].find { |p| p["id"] == id }
+ id = DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::General]
+ agent = response.parsed_body["ai_agents"].find { |p| p["id"] == id }
- expect(persona["name"]).to eq("Général")
- expect(persona["description"]).to eq("Général Description")
+ expect(agent["name"]).to eq("Général")
+ expect(agent["description"]).to eq("Général Description")
end
end
end
describe "GET #edit" do
it "returns a success response" do
- get "/admin/plugins/discourse-ai/ai-personas/#{ai_persona.id}/edit.json"
+ get "/admin/plugins/discourse-ai/ai-agents/#{ai_agent.id}/edit.json"
expect(response).to be_successful
- expect(response.parsed_body["ai_persona"]["name"]).to eq(ai_persona.name)
+ expect(response.parsed_body["ai_agent"]["name"]).to eq(ai_agent.name)
end
- it "includes rag uploads for each persona" do
+ it "supports ai-agents edit endpoint and payload root" do
+ get "/admin/plugins/discourse-ai/ai-agents/#{ai_agent.id}/edit.json"
+ expect(response).to be_successful
+ expect(response.parsed_body["ai_agent"]["name"]).to eq(ai_agent.name)
+ end
+
+ it "includes rag uploads for each agent" do
upload = Fabricate(:upload)
- RagDocumentFragment.link_target_and_uploads(ai_persona, [upload.id])
+ RagDocumentFragment.link_target_and_uploads(ai_agent, [upload.id])
- get "/admin/plugins/discourse-ai/ai-personas/#{ai_persona.id}/edit.json"
+ get "/admin/plugins/discourse-ai/ai-agents/#{ai_agent.id}/edit.json"
expect(response).to be_successful
- serialized_persona = response.parsed_body["ai_persona"]
+ serialized_agent = response.parsed_body["ai_agent"]
- expect(serialized_persona.dig("rag_uploads", 0, "id")).to eq(upload.id)
- expect(serialized_persona.dig("rag_uploads", 0, "original_filename")).to eq(
+ expect(serialized_agent.dig("rag_uploads", 0, "id")).to eq(upload.id)
+ expect(serialized_agent.dig("rag_uploads", 0, "original_filename")).to eq(
upload.original_filename,
)
end
@@ -219,47 +225,58 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
}
end
- it "creates a new AiPersona" do
+ it "creates a new AiAgent" do
expect {
- post "/admin/plugins/discourse-ai/ai-personas.json",
- params: { ai_persona: valid_attributes }.to_json,
+ post "/admin/plugins/discourse-ai/ai-agents.json",
+ params: { ai_agent: valid_attributes }.to_json,
headers: {
"CONTENT_TYPE" => "application/json",
}
expect(response).to be_successful
- persona_json = response.parsed_body["ai_persona"]
-
- expect(persona_json["name"]).to eq("superbot")
- expect(persona_json["top_p"]).to eq(0.1)
- expect(persona_json["temperature"]).to eq(0.5)
- expect(persona_json["default_llm_id"]).to eq(llm_model.id)
- expect(persona_json["forced_tool_count"]).to eq(2)
- expect(persona_json["execution_mode"]).to eq("agentic")
- expect(persona_json["max_turn_tokens"]).to eq(5000)
-
- expect(persona_json["allow_topic_mentions"]).to eq(true)
- expect(persona_json["allow_personal_messages"]).to eq(true)
- expect(persona_json["allow_chat_channel_mentions"]).to eq(true)
- expect(persona_json["allow_chat_direct_messages"]).to eq(true)
- expect(persona_json["question_consolidator_llm_id"]).to eq(llm_model.id)
- expect(persona_json["response_format"].map { |rf| rf["key"] }).to contain_exactly(
- "summary",
- )
- expect(persona_json["examples"]).to eq(valid_attributes[:examples])
+ agent_json = response.parsed_body["ai_agent"]
+
+ expect(agent_json["name"]).to eq("superbot")
+ expect(agent_json["top_p"]).to eq(0.1)
+ expect(agent_json["temperature"]).to eq(0.5)
+ expect(agent_json["default_llm_id"]).to eq(llm_model.id)
+ expect(agent_json["forced_tool_count"]).to eq(2)
+ expect(agent_json["execution_mode"]).to eq("agentic")
+ expect(agent_json["max_turn_tokens"]).to eq(5000)
+
+ expect(agent_json["allow_topic_mentions"]).to eq(true)
+ expect(agent_json["allow_personal_messages"]).to eq(true)
+ expect(agent_json["allow_chat_channel_mentions"]).to eq(true)
+ expect(agent_json["allow_chat_direct_messages"]).to eq(true)
+ expect(agent_json["question_consolidator_llm_id"]).to eq(llm_model.id)
+ expect(agent_json["response_format"].map { |rf| rf["key"] }).to contain_exactly("summary")
+ expect(agent_json["examples"]).to eq(valid_attributes[:examples])
+
+ agent = AiAgent.find(agent_json["id"])
+
+ expect(agent.tools).to eq([["search", { "base_query" => "test" }, true]])
+ expect(agent.top_p).to eq(0.1)
+ expect(agent.temperature).to eq(0.5)
+ }.to change(AiAgent, :count).by(1)
+ end
- persona = AiPersona.find(persona_json["id"])
+ it "creates with ai_agent payload on ai-agents endpoint" do
+ expect {
+ post "/admin/plugins/discourse-ai/ai-agents.json",
+ params: { ai_agent: valid_attributes }.to_json,
+ headers: {
+ "CONTENT_TYPE" => "application/json",
+ }
- expect(persona.tools).to eq([["search", { "base_query" => "test" }, true]])
- expect(persona.top_p).to eq(0.1)
- expect(persona.temperature).to eq(0.5)
- }.to change(AiPersona, :count).by(1)
+ expect(response).to be_successful
+ expect(response.parsed_body.dig("ai_agent", "name")).to eq("superbot")
+ }.to change(AiAgent, :count).by(1)
end
- it "logs staff action when creating a persona" do
- # Create the persona
- post "/admin/plugins/discourse-ai/ai-personas.json",
- params: { ai_persona: valid_attributes }.to_json,
+ it "logs staff action when creating a agent" do
+ # Create the agent
+ post "/admin/plugins/discourse-ai/ai-agents.json",
+ params: { ai_agent: valid_attributes }.to_json,
headers: {
"CONTENT_TYPE" => "application/json",
}
@@ -270,7 +287,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
history =
UserHistory.where(
action: UserHistory.actions[:custom_staff],
- custom_type: "create_ai_persona",
+ custom_type: "create_ai_agent",
).last
expect(history).to be_present
expect(history.subject).to eq("superbot") # Verify subject is set to name
@@ -278,8 +295,8 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
context "with invalid params" do
- it "renders a JSON response with errors for the new ai_persona" do
- post "/admin/plugins/discourse-ai/ai-personas.json", params: { ai_persona: { foo: "" } } # invalid attribute
+ it "renders a JSON response with errors for the new ai_agent" do
+ post "/admin/plugins/discourse-ai/ai-agents.json", params: { ai_agent: { foo: "" } } # invalid attribute
expect(response).to have_http_status(:unprocessable_entity)
expect(response.content_type).to include("application/json")
end
@@ -287,12 +304,12 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
describe "POST #create_user" do
- it "creates a user for the persona" do
- post "/admin/plugins/discourse-ai/ai-personas/#{ai_persona.id}/create-user.json"
- ai_persona.reload
+ it "creates a user for the agent" do
+ post "/admin/plugins/discourse-ai/ai-agents/#{ai_agent.id}/create-user.json"
+ ai_agent.reload
expect(response).to be_successful
- expect(response.parsed_body["user"]["id"]).to eq(ai_persona.user_id)
+ expect(response.parsed_body["user"]["id"]).to eq(ai_agent.user_id)
end
end
@@ -304,15 +321,15 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
scope =
ApiKeyScope.create!(
resource: "discourse_ai",
- action: "update_personas",
+ action: "update_agents",
api_key_id: api_key.id,
allowed_parameters: {
},
)
- put "/admin/plugins/discourse-ai/ai-personas/#{ai_persona.id}.json",
+ put "/admin/plugins/discourse-ai/ai-agents/#{ai_agent.id}.json",
params: {
- ai_persona: {
+ ai_agent: {
name: "UpdatedByAPI",
description: "Updated via API key",
},
@@ -323,15 +340,15 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
}
expect(response).to have_http_status(:ok)
- ai_persona.reload
- expect(ai_persona.name).to eq("UpdatedByAPI")
- expect(ai_persona.description).to eq("Updated via API key")
+ ai_agent.reload
+ expect(ai_agent.name).to eq("UpdatedByAPI")
+ expect(ai_agent.description).to eq("Updated via API key")
scope.update!(action: "fake")
- put "/admin/plugins/discourse-ai/ai-personas/#{ai_persona.id}.json",
+ put "/admin/plugins/discourse-ai/ai-agents/#{ai_agent.id}.json",
params: {
- ai_persona: {
+ ai_agent: {
name: "UpdatedByAPI 2",
description: "Updated via API key",
},
@@ -346,55 +363,55 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
it "allows us to trivially clear top_p and temperature" do
- persona = Fabricate(:ai_persona, name: "test_bot2", top_p: 0.5, temperature: 0.1)
- put "/admin/plugins/discourse-ai/ai-personas/#{persona.id}.json",
+ agent = Fabricate(:ai_agent, name: "test_bot2", top_p: 0.5, temperature: 0.1)
+ put "/admin/plugins/discourse-ai/ai-agents/#{agent.id}.json",
params: {
- ai_persona: {
+ ai_agent: {
top_p: "",
temperature: "",
},
}
expect(response).to have_http_status(:ok)
- persona.reload
+ agent.reload
- expect(persona.top_p).to eq(nil)
- expect(persona.temperature).to eq(nil)
+ expect(agent.top_p).to eq(nil)
+ expect(agent.temperature).to eq(nil)
end
- it "logs staff action when updating a persona" do
- persona = Fabricate(:ai_persona, name: "original_name", description: "original description")
+ it "logs staff action when updating a agent" do
+ agent = Fabricate(:ai_agent, name: "original_name", description: "original description")
- # Update the persona
- put "/admin/plugins/discourse-ai/ai-personas/#{persona.id}.json",
+ # Update the agent
+ put "/admin/plugins/discourse-ai/ai-agents/#{agent.id}.json",
params: {
- ai_persona: {
+ ai_agent: {
name: "updated_name",
description: "updated description",
},
}
expect(response).to have_http_status(:ok)
- persona.reload
- expect(persona.name).to eq("updated_name")
- expect(persona.description).to eq("updated description")
+ agent.reload
+ expect(agent.name).to eq("updated_name")
+ expect(agent.description).to eq("updated description")
# Now verify the log was created with the right subject
history =
UserHistory.where(
action: UserHistory.actions[:custom_staff],
- custom_type: "update_ai_persona",
+ custom_type: "update_ai_agent",
).last
expect(history).to be_present
expect(history.subject).to eq("updated_name") # Verify subject is set to the new name
end
it "supports updating rag params" do
- persona = Fabricate(:ai_persona, name: "test_bot2")
+ agent = Fabricate(:ai_agent, name: "test_bot2")
- put "/admin/plugins/discourse-ai/ai-personas/#{persona.id}.json",
+ put "/admin/plugins/discourse-ai/ai-agents/#{agent.id}.json",
params: {
- ai_persona: {
+ ai_agent: {
rag_chunk_tokens: "102",
rag_chunk_overlap_tokens: "12",
rag_conversation_chunks: "13",
@@ -404,21 +421,21 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
}
expect(response).to have_http_status(:ok)
- persona.reload
+ agent.reload
- expect(persona.rag_chunk_tokens).to eq(102)
- expect(persona.rag_chunk_overlap_tokens).to eq(12)
- expect(persona.rag_conversation_chunks).to eq(13)
- expect(persona.rag_llm_model_id).to eq(llm_model.id)
- expect(persona.question_consolidator_llm_id).to eq(llm_model.id)
+ expect(agent.rag_chunk_tokens).to eq(102)
+ expect(agent.rag_chunk_overlap_tokens).to eq(12)
+ expect(agent.rag_conversation_chunks).to eq(13)
+ expect(agent.rag_llm_model_id).to eq(llm_model.id)
+ expect(agent.question_consolidator_llm_id).to eq(llm_model.id)
end
it "supports updating agentic params" do
- persona = Fabricate(:ai_persona, name: "test_bot2")
+ agent = Fabricate(:ai_agent, name: "test_bot2")
- put "/admin/plugins/discourse-ai/ai-personas/#{persona.id}.json",
+ put "/admin/plugins/discourse-ai/ai-agents/#{agent.id}.json",
params: {
- ai_persona: {
+ ai_agent: {
execution_mode: "agentic",
max_turn_tokens: 8000,
compression_threshold: 75,
@@ -426,35 +443,35 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
}
expect(response).to have_http_status(:ok)
- persona.reload
+ agent.reload
- expect(persona.execution_mode).to eq("agentic")
- expect(persona.max_turn_tokens).to eq(8000)
+ expect(agent.execution_mode).to eq("agentic")
+ expect(agent.max_turn_tokens).to eq(8000)
- expect(persona.compression_threshold).to eq(75)
+ expect(agent.compression_threshold).to eq(75)
end
it "supports updating vision params" do
- persona = Fabricate(:ai_persona, name: "test_bot2")
- put "/admin/plugins/discourse-ai/ai-personas/#{persona.id}.json",
+ agent = Fabricate(:ai_agent, name: "test_bot2")
+ put "/admin/plugins/discourse-ai/ai-agents/#{agent.id}.json",
params: {
- ai_persona: {
+ ai_agent: {
vision_enabled: true,
vision_max_pixels: 512 * 512,
},
}
expect(response).to have_http_status(:ok)
- persona.reload
+ agent.reload
- expect(persona.vision_enabled).to eq(true)
- expect(persona.vision_max_pixels).to eq(512 * 512)
+ expect(agent.vision_enabled).to eq(true)
+ expect(agent.vision_max_pixels).to eq(512 * 512)
end
- it "does not allow temperature and top p changes on stock personas" do
- put "/admin/plugins/discourse-ai/ai-personas/#{DiscourseAi::Personas::Persona.system_personas.values.first}.json",
+ it "does not allow temperature and top p changes on stock agents" do
+ put "/admin/plugins/discourse-ai/ai-agents/#{DiscourseAi::Agents::Agent.system_agents.values.first}.json",
params: {
- ai_persona: {
+ ai_agent: {
top_p: 0.5,
temperature: 0.1,
},
@@ -464,10 +481,10 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
context "with valid params" do
- it "updates the requested ai_persona" do
- put "/admin/plugins/discourse-ai/ai-personas/#{ai_persona.id}.json",
+ it "updates the requested ai_agent" do
+ put "/admin/plugins/discourse-ai/ai-agents/#{ai_agent.id}.json",
params: {
- ai_persona: {
+ ai_agent: {
name: "SuperBot",
enabled: false,
tools: ["search"],
@@ -477,18 +494,18 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
expect(response).to have_http_status(:ok)
expect(response.content_type).to include("application/json")
- ai_persona.reload
- expect(ai_persona.name).to eq("SuperBot")
- expect(ai_persona.enabled).to eq(false)
- expect(ai_persona.tools).to eq([["search", nil, false]])
+ ai_agent.reload
+ expect(ai_agent.name).to eq("SuperBot")
+ expect(ai_agent.enabled).to eq(false)
+ expect(ai_agent.tools).to eq([["search", nil, false]])
end
end
- context "with system personas" do
+ context "with system agents" do
it "does not allow editing of system prompts" do
- put "/admin/plugins/discourse-ai/ai-personas/#{DiscourseAi::Personas::Persona.system_personas.values.first}.json",
+ put "/admin/plugins/discourse-ai/ai-agents/#{DiscourseAi::Agents::Agent.system_agents.values.first}.json",
params: {
- ai_persona: {
+ ai_agent: {
system_prompt: "you are not a helpful bot",
},
}
@@ -499,9 +516,9 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
it "does not allow editing of tools" do
- put "/admin/plugins/discourse-ai/ai-personas/#{DiscourseAi::Personas::Persona.system_personas.values.first}.json",
+ put "/admin/plugins/discourse-ai/ai-agents/#{DiscourseAi::Agents::Agent.system_agents.values.first}.json",
params: {
- ai_persona: {
+ ai_agent: {
tools: %w[SearchCommand ImageCommand],
},
}
@@ -512,9 +529,9 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
it "does not allow editing of name and description cause it is localized" do
- put "/admin/plugins/discourse-ai/ai-personas/#{DiscourseAi::Personas::Persona.system_personas.values.first}.json",
+ put "/admin/plugins/discourse-ai/ai-agents/#{DiscourseAi::Agents::Agent.system_agents.values.first}.json",
params: {
- ai_persona: {
+ ai_agent: {
name: "bob",
description: "the bob",
},
@@ -526,9 +543,9 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
it "does allow some actions" do
- put "/admin/plugins/discourse-ai/ai-personas/#{DiscourseAi::Personas::Persona.system_personas.values.first}.json",
+ put "/admin/plugins/discourse-ai/ai-agents/#{DiscourseAi::Agents::Agent.system_agents.values.first}.json",
params: {
- ai_persona: {
+ ai_agent: {
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_1]],
enabled: false,
priority: 989,
@@ -540,10 +557,10 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
context "with invalid params" do
- it "renders a JSON response with errors for the ai_persona" do
- put "/admin/plugins/discourse-ai/ai-personas/#{ai_persona.id}.json",
+ it "renders a JSON response with errors for the ai_agent" do
+ put "/admin/plugins/discourse-ai/ai-agents/#{ai_agent.id}.json",
params: {
- ai_persona: {
+ ai_agent: {
name: "",
},
} # invalid attribute
@@ -566,10 +583,10 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
)
end
- fab!(:persona_with_tools) do
- AiPersona.create!(
+ fab!(:agent_with_tools) do
+ AiAgent.create!(
name: "ToolMaster",
- description: "A persona with custom tools",
+ description: "A agent with custom tools",
system_prompt: "You are a tool master",
tools: [
["SearchCommand", { "base_query" => "test" }, true],
@@ -583,8 +600,8 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
)
end
- it "exports a persona as JSON" do
- get "/admin/plugins/discourse-ai/ai-personas/#{persona_with_tools.id}/export.json"
+ it "exports a agent as JSON" do
+ get "/admin/plugins/discourse-ai/ai-agents/#{agent_with_tools.id}/export.json"
expect(response).to be_successful
expect(response.headers["Content-Disposition"]).to include("attachment")
@@ -594,17 +611,17 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
expect(json["meta"]["version"]).to eq("1.0")
expect(json["meta"]["exported_at"]).to be_present
- persona_data = json["persona"]
- expect(persona_data["name"]).to eq("ToolMaster")
- expect(persona_data["description"]).to eq("A persona with custom tools")
- expect(persona_data["system_prompt"]).to eq("You are a tool master")
- expect(persona_data["temperature"]).to eq(0.8)
- expect(persona_data["top_p"]).to eq(0.9)
- expect(persona_data["response_format"]).to eq([{ "type" => "string", "key" => "summary" }])
- expect(persona_data["examples"]).to eq([["user example", "assistant example"]])
+ agent_data = json["agent"]
+ expect(agent_data["name"]).to eq("ToolMaster")
+ expect(agent_data["description"]).to eq("A agent with custom tools")
+ expect(agent_data["system_prompt"]).to eq("You are a tool master")
+ expect(agent_data["temperature"]).to eq(0.8)
+ expect(agent_data["top_p"]).to eq(0.9)
+ expect(agent_data["response_format"]).to eq([{ "type" => "string", "key" => "summary" }])
+ expect(agent_data["examples"]).to eq([["user example", "assistant example"]])
# Check that custom tool ID is replaced with tool_name
- expect(persona_data["tools"]).to include(
+ expect(agent_data["tools"]).to include(
["SearchCommand", { "base_query" => "test" }, true],
["custom-test_tool", { "max_results" => 10 }, false],
)
@@ -623,19 +640,19 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
)
end
- it "handles personas without custom tools" do
- persona = Fabricate(:ai_persona, tools: ["SearchCommand"])
+ it "handles agents without custom tools" do
+ agent = Fabricate(:ai_agent, tools: ["SearchCommand"])
- get "/admin/plugins/discourse-ai/ai-personas/#{persona.id}/export.json"
+ get "/admin/plugins/discourse-ai/ai-agents/#{agent.id}/export.json"
expect(response).to be_successful
json = response.parsed_body
expect(json["custom_tools"]).to eq([])
- expect(json["persona"]["tools"]).to eq(["SearchCommand"])
+ expect(json["agent"]["tools"]).to eq(["SearchCommand"])
end
- it "returns 404 for non-existent persona" do
- get "/admin/plugins/discourse-ai/ai-personas/999999/export.json"
+ it "returns 404 for non-existent agent" do
+ get "/admin/plugins/discourse-ai/ai-agents/999999/export.json"
expect(response).to have_http_status(:not_found)
end
end
@@ -647,9 +664,9 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
version: "1.0",
exported_at: Time.zone.now.iso8601,
},
- persona: {
- name: "ImportedPersona",
- description: "An imported persona",
+ agent: {
+ name: "ImportedAgent",
+ description: "An imported agent",
system_prompt: "You are an imported assistant",
temperature: 0.7,
top_p: 0.8,
@@ -661,30 +678,28 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
}
end
- it "imports a new persona successfully" do
+ it "imports a new agent successfully" do
expect {
- post "/admin/plugins/discourse-ai/ai-personas/import.json",
+ post "/admin/plugins/discourse-ai/ai-agents/import.json",
params: valid_import_data,
as: :json
expect(response).to have_http_status(:created)
- }.to change(AiPersona, :count).by(1)
-
- persona = AiPersona.find_by(name: "ImportedPersona")
- expect(persona).to be_present
- expect(persona.description).to eq("An imported persona")
- expect(persona.system_prompt).to eq("You are an imported assistant")
- expect(persona.temperature).to eq(0.7)
- expect(persona.top_p).to eq(0.8)
- expect(persona.response_format).to eq([{ "type" => "string", "key" => "answer" }])
- expect(persona.examples).to eq([["hello", "hi there"]])
- expect(persona.tools).to eq(
- ["SearchCommand", ["ReadCommand", { "max_length" => 1000 }, true]],
- )
+ }.to change(AiAgent, :count).by(1)
+
+ agent = AiAgent.find_by(name: "ImportedAgent")
+ expect(agent).to be_present
+ expect(agent.description).to eq("An imported agent")
+ expect(agent.system_prompt).to eq("You are an imported assistant")
+ expect(agent.temperature).to eq(0.7)
+ expect(agent.top_p).to eq(0.8)
+ expect(agent.response_format).to eq([{ "type" => "string", "key" => "answer" }])
+ expect(agent.examples).to eq([["hello", "hi there"]])
+ expect(agent.tools).to eq(["SearchCommand", ["ReadCommand", { "max_length" => 1000 }, true]])
end
- it "imports a persona with custom tools" do
+ it "imports a agent with custom tools" do
import_data_with_tools = valid_import_data.deep_dup
- import_data_with_tools[:persona][:tools] = [
+ import_data_with_tools[:agent][:tools] = [
"SearchCommand",
["custom-my_custom_tool", { param1: "value1" }, false],
]
@@ -701,15 +716,15 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
]
expect {
- post "/admin/plugins/discourse-ai/ai-personas/import.json",
+ post "/admin/plugins/discourse-ai/ai-agents/import.json",
params: import_data_with_tools,
as: :json
- }.to change(AiPersona, :count).by(1).and change(AiTool, :count).by(1)
+ }.to change(AiAgent, :count).by(1).and change(AiTool, :count).by(1)
expect(response).to have_http_status(:created)
- persona = AiPersona.find_by(name: "ImportedPersona")
- expect(persona).to be_present
+ agent = AiAgent.find_by(name: "ImportedAgent")
+ expect(agent).to be_present
tool = AiTool.find_by(tool_name: "my_custom_tool")
expect(tool).to be_present
@@ -718,128 +733,181 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
expect(tool.script).to eq("function invoke(params) { return params.param1; }")
# Check that the tool reference uses the ID
- expect(persona.tools).to include(
+ expect(agent.tools).to include(
"SearchCommand",
["custom-#{tool.id}", { "param1" => "value1" }, false],
)
end
- it "prevents importing duplicate personas by default" do
- _existing_persona = Fabricate(:ai_persona, name: "ImportedPersona")
+ it "prevents importing duplicate agents by default" do
+ _existing_agent = Fabricate(:ai_agent, name: "ImportedAgent")
- post "/admin/plugins/discourse-ai/ai-personas/import.json",
- params: valid_import_data,
- as: :json
+ post "/admin/plugins/discourse-ai/ai-agents/import.json", params: valid_import_data, as: :json
expect(response).to have_http_status(:unprocessable_entity)
- expect(response.parsed_body["errors"].join).to include("ImportedPersona")
+ expect(response.parsed_body["errors"].join).to include("ImportedAgent")
end
- it "allows overwriting existing personas with force=true" do
- existing_persona =
- Fabricate(:ai_persona, name: "ImportedPersona", description: "Old description")
+ it "allows overwriting existing agents with force=true" do
+ existing_agent = Fabricate(:ai_agent, name: "ImportedAgent", description: "Old description")
import_data = valid_import_data.merge(force: true)
expect {
- post "/admin/plugins/discourse-ai/ai-personas/import.json", params: import_data, as: :json
- }.not_to change(AiPersona, :count)
+ post "/admin/plugins/discourse-ai/ai-agents/import.json", params: import_data, as: :json
+ }.not_to change(AiAgent, :count)
expect(response).to have_http_status(:ok)
- existing_persona.reload
- expect(existing_persona.description).to eq("An imported persona")
- expect(existing_persona.system_prompt).to eq("You are an imported assistant")
+ existing_agent.reload
+ expect(existing_agent.description).to eq("An imported agent")
+ expect(existing_agent.system_prompt).to eq("You are an imported assistant")
end
it "handles invalid import data gracefully" do
invalid_data = { invalid: "data" }
- post "/admin/plugins/discourse-ai/ai-personas/import.json", params: invalid_data, as: :json
+ post "/admin/plugins/discourse-ai/ai-agents/import.json", params: invalid_data, as: :json
expect(response).to have_http_status(:unprocessable_entity)
expect(response.parsed_body["errors"]).to be_present
end
- it "handles missing persona data" do
+ it "handles missing agent data" do
invalid_data = { meta: { version: "1.0" } }
- post "/admin/plugins/discourse-ai/ai-personas/import.json", params: invalid_data, as: :json
+ post "/admin/plugins/discourse-ai/ai-agents/import.json", params: invalid_data, as: :json
expect(response).to have_http_status(:unprocessable_entity)
end
- it "logs staff action when importing a new persona" do
- post "/admin/plugins/discourse-ai/ai-personas/import.json",
- params: valid_import_data,
- as: :json
+ context "with legacy persona format" do
+ let(:legacy_import_data) do
+ {
+ meta: {
+ version: "1.0",
+ exported_at: Time.zone.now.iso8601,
+ },
+ persona: {
+ name: "LegacyPersona",
+ description: "A legacy persona import",
+ system_prompt: "You are a legacy assistant",
+ temperature: 0.5,
+ top_p: 0.9,
+ response_format: [],
+ examples: [],
+ tools: ["SearchCommand"],
+ },
+ custom_tools: [],
+ }
+ end
+
+ it "imports a legacy persona payload" do
+ expect {
+ post "/admin/plugins/discourse-ai/ai-agents/import.json",
+ params: legacy_import_data,
+ as: :json
+ expect(response).to have_http_status(:created)
+ }.to change(AiAgent, :count).by(1)
+
+ agent = AiAgent.find_by(name: "LegacyPersona")
+ expect(agent).to be_present
+ expect(agent.description).to eq("A legacy persona import")
+ end
+
+ it "detects conflicts with legacy persona payload" do
+ Fabricate(:ai_agent, name: "LegacyPersona")
+
+ post "/admin/plugins/discourse-ai/ai-agents/import.json",
+ params: legacy_import_data,
+ as: :json
+
+ expect(response).to have_http_status(:unprocessable_entity)
+ expect(response.parsed_body["errors"].join).to include("LegacyPersona")
+ end
+
+ it "overwrites with force=true on legacy persona payload" do
+ existing = Fabricate(:ai_agent, name: "LegacyPersona", description: "Old")
+
+ post "/admin/plugins/discourse-ai/ai-agents/import.json",
+ params: legacy_import_data.merge(force: true),
+ as: :json
+
+ expect(response).to have_http_status(:ok)
+ existing.reload
+ expect(existing.description).to eq("A legacy persona import")
+ end
+ end
+
+ it "logs staff action when importing a new agent" do
+ post "/admin/plugins/discourse-ai/ai-agents/import.json", params: valid_import_data, as: :json
expect(response).to have_http_status(:created)
history =
UserHistory.where(
action: UserHistory.actions[:custom_staff],
- custom_type: "create_ai_persona",
+ custom_type: "create_ai_agent",
).last
expect(history).to be_present
- expect(history.subject).to eq("ImportedPersona")
+ expect(history.subject).to eq("ImportedAgent")
end
- it "logs staff action when updating an existing persona" do
- _existing_persona = Fabricate(:ai_persona, name: "ImportedPersona")
+ it "logs staff action when updating an existing agent" do
+ _existing_agent = Fabricate(:ai_agent, name: "ImportedAgent")
import_data = valid_import_data.merge(force: true)
- post "/admin/plugins/discourse-ai/ai-personas/import.json", params: import_data, as: :json
+ post "/admin/plugins/discourse-ai/ai-agents/import.json", params: import_data, as: :json
expect(response).to have_http_status(:ok)
history =
UserHistory.where(
action: UserHistory.actions[:custom_staff],
- custom_type: "update_ai_persona",
+ custom_type: "update_ai_agent",
).last
expect(history).to be_present
- expect(history.subject).to eq("ImportedPersona")
+ expect(history.subject).to eq("ImportedAgent")
end
end
describe "DELETE #destroy" do
- it "destroys the requested ai_persona" do
+ it "destroys the requested ai_agent" do
expect {
- delete "/admin/plugins/discourse-ai/ai-personas/#{ai_persona.id}.json"
+ delete "/admin/plugins/discourse-ai/ai-agents/#{ai_agent.id}.json"
expect(response).to have_http_status(:no_content)
- }.to change(AiPersona, :count).by(-1)
+ }.to change(AiAgent, :count).by(-1)
end
- it "logs staff action when deleting a persona" do
- # Capture persona details before deletion
- _persona_id = ai_persona.id
- persona_name = ai_persona.name
+ it "logs staff action when deleting a agent" do
+ # Capture agent details before deletion
+ _agent_id = ai_agent.id
+ agent_name = ai_agent.name
- # Delete the persona
- delete "/admin/plugins/discourse-ai/ai-personas/#{ai_persona.id}.json"
+ # Delete the agent
+ delete "/admin/plugins/discourse-ai/ai-agents/#{ai_agent.id}.json"
expect(response).to have_http_status(:no_content)
# Now verify the log was created with the right subject
history =
UserHistory.where(
action: UserHistory.actions[:custom_staff],
- custom_type: "delete_ai_persona",
+ custom_type: "delete_ai_agent",
).last
expect(history).to be_present
- expect(history.subject).to eq(persona_name) # Verify subject is set to name
+ expect(history.subject).to eq(agent_name) # Verify subject is set to name
end
- it "is not allowed to delete system personas" do
+ it "is not allowed to delete system agents" do
expect {
- delete "/admin/plugins/discourse-ai/ai-personas/#{DiscourseAi::Personas::Persona.system_personas.values.first}.json"
+ delete "/admin/plugins/discourse-ai/ai-agents/#{DiscourseAi::Agents::Agent.system_agents.values.first}.json"
expect(response).to have_http_status(:unprocessable_entity)
expect(response.parsed_body["errors"].join).not_to be_blank
# let's make sure this is translated
expect(response.parsed_body["errors"].join).not_to include("en.discourse")
- }.not_to change(AiPersona, :count)
+ }.not_to change(AiAgent, :count)
end
end
@@ -851,31 +919,31 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
after { fake_endpoint.reset! }
- it "ensures persona exists" do
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json"
+ it "ensures agent exists" do
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json"
expect(response).to have_http_status(:unprocessable_entity)
# this ensures localization key is actually in the yaml
- expect(response.body).to include("persona_name")
+ expect(response.body).to include("agent_name")
end
it "ensures question exists" do
- ai_persona.update!(default_llm_id: llm.id)
+ ai_agent.update!(default_llm_id: llm.id)
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
- persona_id: ai_persona.id,
+ agent_id: ai_agent.id,
user_unique_id: "site:test.com:user_id:1",
}
expect(response).to have_http_status(:unprocessable_entity)
expect(response.body).to include("query")
end
- it "ensure persona has a user specified" do
- ai_persona.update!(default_llm_id: llm.id)
+ it "ensure agent has a user specified" do
+ ai_agent.update!(default_llm_id: llm.id)
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
- persona_id: ai_persona.id,
+ agent_id: ai_agent.id,
query: "how are you today?",
user_unique_id: "site:test.com:user_id:1",
}
@@ -935,8 +1003,8 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
fake_endpoint.fake_content = ["This is a test! Testing!", "An amazing title"]
- ai_persona.create_user!
- ai_persona.update!(
+ ai_agent.create_user!
+ ai_agent.update!(
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
default_llm_id: llm.id,
allow_personal_messages: true,
@@ -945,9 +1013,9 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
- persona_name: ai_persona.name,
+ agent_name: ai_agent.name,
query: "how are you today?",
user_unique_id: "site:test.com:user_id:1",
preferred_username: "test_user",
@@ -975,7 +1043,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
user_post = topic.posts.find_by(post_number: 1)
expect(user_post.raw).to eq("how are you today?")
- # need ai persona and user
+ # need ai agent and user
expect(topic.topic_allowed_users.count).to eq(2)
expect(topic.archetype).to eq(Archetype.private_message)
expect(topic.title).to eq("An amazing title")
@@ -988,7 +1056,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
# this simplifies function calls
fake_endpoint.chunk_count = 1
- ai_persona.update!(tools: ["Categories"], show_thinking: true)
+ ai_agent.update!(tools: ["Categories"], show_thinking: true)
# lets also unstage the user and add the user to tl0
# this will ensure there are no feedback loops
@@ -997,14 +1065,14 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
Group.user_trust_level_change!(new_user.id, new_user.trust_level)
# double check this happened and user is in group
- personas = AiPersona.allowed_modalities(user: new_user.reload, allow_personal_messages: true)
- expect(personas.count).to eq(1)
+ agents = AiAgent.allowed_modalities(user: new_user.reload, allow_personal_messages: true)
+ expect(agents.count).to eq(1)
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
- persona_id: ai_persona.id,
+ agent_id: ai_agent.id,
query: "how are you now?",
user_unique_id: "site:test.com:user_id:1",
preferred_username: "test_user",
@@ -1042,8 +1110,8 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
Jobs.run_immediately!
SiteSetting.ai_bot_allowed_groups = "10"
- ai_persona.create_user!
- ai_persona.update!(
+ ai_agent.create_user!
+ ai_agent.update!(
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
default_llm_id: llm.id,
allow_personal_messages: true,
@@ -1065,9 +1133,9 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
- persona_id: ai_persona.id,
+ agent_id: ai_agent.id,
query: "What's the weather?",
user_unique_id: "site:test.com:user_id:42",
preferred_username: "tool_user",
@@ -1108,7 +1176,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
resume_token: tool_event["resume_token"],
tool_results: [{ tool_call_id: "tool_1", content: { temperature_c: 23 } }],
@@ -1138,7 +1206,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
{ prompt: { messages: [], tools: [] } }.to_json,
)
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
resume_token: resume_token,
}
@@ -1151,8 +1219,8 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
Jobs.run_immediately!
SiteSetting.ai_bot_allowed_groups = "10"
- ai_persona.create_user!
- ai_persona.update!(
+ ai_agent.create_user!
+ ai_agent.update!(
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
default_llm_id: llm.id,
allow_personal_messages: true,
@@ -1167,7 +1235,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
user,
title: "Parallel Tool Topic",
archetype: Archetype.private_message,
- target_usernames: ai_persona.user.username,
+ target_usernames: ai_agent.user.username,
raw: "Initial context message",
custom_fields: {
DiscourseAi::AiBot::Playground::BYPASS_AI_REPLY_CUSTOM_FIELD => true,
@@ -1197,9 +1265,9 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
- persona_id: ai_persona.id,
+ agent_id: ai_agent.id,
username: user.username,
topic_id: topic.id,
query: "Need weather and local time.",
@@ -1250,7 +1318,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
resume_token: tool_event["resume_token"],
tool_results: [
@@ -1278,7 +1346,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
{ name: "tool_#{index}", description: "test tool #{index}", parameters: [] }
end
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
custom_tools: tools,
}
@@ -1288,7 +1356,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
it "rejects ambiguous tool_results params" do
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
tool_result: {
tool_call_id: "tool_1",
@@ -1302,7 +1370,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
it "rejects oversized tool result content" do
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
resume_token: "ignored-by-validation",
tool_results: [{ tool_call_id: "tool_1", content: "a" * 103_000 }],
@@ -1313,7 +1381,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
end
it "rejects nil tool result content" do
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
tool_results: [{ tool_call_id: "tool_1", content: nil }],
}
@@ -1332,7 +1400,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
resume_token: "toctou-token",
tool_results: [{ tool_call_id: "tool_1", content: { ok: true } }],
@@ -1354,8 +1422,8 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
Jobs.run_immediately!
SiteSetting.ai_bot_allowed_groups = "10"
- ai_persona.create_user!
- ai_persona.update!(
+ ai_agent.create_user!
+ ai_agent.update!(
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
default_llm_id: llm.id,
allow_personal_messages: true,
@@ -1374,9 +1442,9 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
- persona_id: ai_persona.id,
+ agent_id: ai_agent.id,
query: "Need weather",
user_unique_id: "site:test.com:user_id:mismatch",
preferred_username: "mismatch_user",
@@ -1406,7 +1474,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
sign_in(admin_2)
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
resume_token: resume_token,
tool_results: [{ tool_call_id: "tool_1", content: { temp_c: 22 } }],
@@ -1427,8 +1495,8 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
Jobs.run_immediately!
SiteSetting.ai_bot_allowed_groups = "10"
- ai_persona.create_user!
- ai_persona.update!(
+ ai_agent.create_user!
+ ai_agent.update!(
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
default_llm_id: llm.id,
allow_personal_messages: true,
@@ -1445,9 +1513,9 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
]
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
- persona_id: ai_persona.id,
+ agent_id: ai_agent.id,
query: "Need weather",
user_unique_id: "site:test.com:user_id:unexpected",
preferred_username: "unexpected_user",
@@ -1468,7 +1536,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
resume_token = parsed[:chunks].find { |chunk| chunk["event"] == "tool_calls" }["resume_token"]
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
resume_token: resume_token,
tool_results: [
@@ -1492,8 +1560,8 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
Jobs.run_immediately!
SiteSetting.ai_bot_allowed_groups = "10"
- ai_persona.create_user!
- ai_persona.update!(
+ ai_agent.create_user!
+ ai_agent.update!(
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
default_llm_id: llm.id,
allow_personal_messages: true,
@@ -1508,7 +1576,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
user,
title: "Multi Round Tool Topic",
archetype: Archetype.private_message,
- target_usernames: ai_persona.user.username,
+ target_usernames: ai_agent.user.username,
raw: "Initial context message",
custom_fields: {
DiscourseAi::AiBot::Playground::BYPASS_AI_REPLY_CUSTOM_FIELD => true,
@@ -1528,9 +1596,9 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
]
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
- persona_id: ai_persona.id,
+ agent_id: ai_agent.id,
username: user.username,
topic_id: topic.id,
query: "Need weather and time.",
@@ -1558,7 +1626,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
expect(first_tool_event.dig("tool_calls", 0, "id")).to eq("tool_1")
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
resume_token: first_tool_event["resume_token"],
tool_results: [{ tool_call_id: "tool_1", content: { temp_c: 22 } }],
@@ -1574,7 +1642,7 @@ RSpec.describe DiscourseAi::Admin::AiPersonasController do
expect(second_tool_event.dig("tool_calls", 0, "id")).to eq("tool_2")
io_out, io_in = IO.pipe
- post "/admin/plugins/discourse-ai/ai-personas/stream-reply.json",
+ post "/admin/plugins/discourse-ai/ai-agents/stream-reply.json",
params: {
resume_token: second_tool_event["resume_token"],
tool_results: [{ tool_call_id: "tool_2", content: { time: "10:15" } }],
diff --git a/plugins/discourse-ai/spec/requests/admin/ai_features_controller_spec.rb b/plugins/discourse-ai/spec/requests/admin/ai_features_controller_spec.rb
index 4de5c1511a1..6a1a60fdd8d 100644
--- a/plugins/discourse-ai/spec/requests/admin/ai_features_controller_spec.rb
+++ b/plugins/discourse-ai/spec/requests/admin/ai_features_controller_spec.rb
@@ -5,8 +5,8 @@ RSpec.describe DiscourseAi::Admin::AiFeaturesController do
fab!(:admin)
fab!(:group)
fab!(:llm_model)
- fab!(:summarizer_persona, :ai_persona)
- fab!(:alternate_summarizer_persona, :ai_persona)
+ fab!(:summarizer_agent, :ai_agent)
+ fab!(:alternate_summarizer_agent, :ai_agent)
before do
enable_current_plugin
@@ -16,7 +16,7 @@ RSpec.describe DiscourseAi::Admin::AiFeaturesController do
end
describe "#index" do
- it "lists all features backed by personas" do
+ it "lists all features backed by agents" do
get "/admin/plugins/discourse-ai/ai-features.json"
expect(response.status).to eq(200)
diff --git a/plugins/discourse-ai/spec/requests/admin/ai_llms_controller_spec.rb b/plugins/discourse-ai/spec/requests/admin/ai_llms_controller_spec.rb
index bef81bd6f0a..4e54c6cb63c 100644
--- a/plugins/discourse-ai/spec/requests/admin/ai_llms_controller_spec.rb
+++ b/plugins/discourse-ai/spec/requests/admin/ai_llms_controller_spec.rb
@@ -12,10 +12,10 @@ RSpec.describe DiscourseAi::Admin::AiLlmsController do
describe "GET #index" do
fab!(:llm_model)
fab!(:llm_model2, :llm_model)
- fab!(:ai_persona) do
+ fab!(:ai_agent) do
Fabricate(
- :ai_persona,
- name: "Cool persona",
+ :ai_agent,
+ name: "Cool agent",
force_default_llm: true,
default_llm_id: llm_model2.id,
)
@@ -55,7 +55,7 @@ RSpec.describe DiscourseAi::Admin::AiLlmsController do
# setting the setting calls the model
DiscourseAi::Completions::Llm.with_prepared_responses(["OK"]) do
- SiteSetting.ai_helper_proofreader_persona = ai_persona.id
+ SiteSetting.ai_helper_proofreader_agent = ai_agent.id
SiteSetting.ai_helper_enabled = true
end
@@ -77,7 +77,7 @@ RSpec.describe DiscourseAi::Admin::AiLlmsController do
model2_json = llms.find { |m| m["id"] == llm_model2.id }
expect(model2_json["used_by"]).to contain_exactly(
- { "type" => "ai_persona", "name" => "Cool persona", "id" => ai_persona.id },
+ { "type" => "ai_agent", "name" => "Cool agent", "id" => ai_agent.id },
{ "type" => "ai_helper", "name" => "Proofread text" },
)
@@ -600,7 +600,7 @@ RSpec.describe DiscourseAi::Admin::AiLlmsController do
describe "DELETE #destroy" do
fab!(:llm_model)
- it "destroys the requested ai_persona" do
+ it "destroys the requested ai_agent" do
expect {
delete "/admin/plugins/discourse-ai/ai-llms/#{llm_model.id}.json"
@@ -627,7 +627,7 @@ RSpec.describe DiscourseAi::Admin::AiLlmsController do
end
context "with llms configured" do
- fab!(:ai_persona) { Fabricate(:ai_persona, default_llm_id: llm_model.id) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, default_llm_id: llm_model.id) }
it "validates the model is not in use" do
delete "/admin/plugins/discourse-ai/ai-llms/#{llm_model.id}.json"
diff --git a/plugins/discourse-ai/spec/requests/admin/ai_spam_controller_spec.rb b/plugins/discourse-ai/spec/requests/admin/ai_spam_controller_spec.rb
index 350746dd8c1..87fefa96716 100644
--- a/plugins/discourse-ai/spec/requests/admin/ai_spam_controller_spec.rb
+++ b/plugins/discourse-ai/spec/requests/admin/ai_spam_controller_spec.rb
@@ -16,45 +16,45 @@ RSpec.describe DiscourseAi::Admin::AiSpamController do
params: {
is_enabled: true,
llm_model_id: llm_model.id,
- ai_persona_id:
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::SpamDetector],
+ ai_agent_id:
+ DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::SpamDetector],
custom_instructions: "custom instructions",
}
expect(response.status).to eq(200)
expect(SiteSetting.ai_spam_detection_enabled).to eq(true)
expect(AiModerationSetting.spam.llm_model_id).to eq(llm_model.id)
- expect(AiModerationSetting.spam.ai_persona_id).to eq(
- DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::SpamDetector],
+ expect(AiModerationSetting.spam.ai_agent_id).to eq(
+ DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::SpamDetector],
)
expect(AiModerationSetting.spam.data["custom_instructions"]).to eq("custom instructions")
end
- it "validates the selected persona has a valid response format" do
- ai_persona = Fabricate(:ai_persona, response_format: nil)
+ it "validates the selected agent has a valid response format" do
+ ai_agent = Fabricate(:ai_agent, response_format: nil)
put "/admin/plugins/discourse-ai/ai-spam.json",
params: {
is_enabled: true,
llm_model_id: llm_model.id,
- ai_persona_id: ai_persona.id,
+ ai_agent_id: ai_agent.id,
custom_instructions: "custom instructions",
}
expect(response.status).to eq(422)
- ai_persona.update!(response_format: [{ "key" => "spam", "type" => "boolean" }])
+ ai_agent.update!(response_format: [{ "key" => "spam", "type" => "boolean" }])
put "/admin/plugins/discourse-ai/ai-spam.json",
params: {
is_enabled: true,
llm_model_id: llm_model.id,
- ai_persona_id: ai_persona.id,
+ ai_agent_id: ai_agent.id,
custom_instructions: "custom instructions",
}
expect(response.status).to eq(200)
- expect(AiModerationSetting.spam.ai_persona_id).to eq(ai_persona.id)
+ expect(AiModerationSetting.spam.ai_agent_id).to eq(ai_agent.id)
end
it "can not enable spam detection without a model selected" do
@@ -146,15 +146,15 @@ RSpec.describe DiscourseAi::Admin::AiSpamController do
expect(history.details).to include("llm_model_id")
end
- it "logs staff actio when ai_persona_id changes" do
- new_persona =
+ it "logs staff actio when ai_agent_id changes" do
+ new_agent =
Fabricate(
- :ai_persona,
- name: "Updated Persona",
+ :ai_agent,
+ name: "Updated Agent",
response_format: [{ "key" => "spam", "type" => "boolean" }],
)
- put "/admin/plugins/discourse-ai/ai-spam.json", params: { ai_persona_id: new_persona.id }
+ put "/admin/plugins/discourse-ai/ai-spam.json", params: { ai_agent_id: new_agent.id }
expect(response.status).to eq(200)
@@ -165,8 +165,8 @@ RSpec.describe DiscourseAi::Admin::AiSpamController do
custom_type: "update_ai_spam_settings",
).last
expect(history).to be_present
- expect(history.details).to include("ai_persona_id")
- expect(history.details).to include(new_persona.name)
+ expect(history.details).to include("ai_agent_id")
+ expect(history.details).to include(new_agent.name)
end
it "does not log staff action when only is_enabled changes" do
diff --git a/plugins/discourse-ai/spec/requests/admin/rag_document_fragments_controller_spec.rb b/plugins/discourse-ai/spec/requests/admin/rag_document_fragments_controller_spec.rb
index f911b36e947..7bfe371ff98 100644
--- a/plugins/discourse-ai/spec/requests/admin/rag_document_fragments_controller_spec.rb
+++ b/plugins/discourse-ai/spec/requests/admin/rag_document_fragments_controller_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe DiscourseAi::Admin::RagDocumentFragmentsController do
fab!(:admin)
- fab!(:ai_persona)
+ fab!(:ai_agent)
fab!(:vector_def, :embedding_definition)
@@ -16,8 +16,8 @@ RSpec.describe DiscourseAi::Admin::RagDocumentFragmentsController do
after { @cleanup_files&.each(&:unlink) }
describe "GET #indexing_status_check" do
- it "works for AiPersona" do
- get "/admin/plugins/discourse-ai/rag-document-fragments/files/status.json?target_type=AiPersona&target_id=#{ai_persona.id}"
+ it "works for AiAgent" do
+ get "/admin/plugins/discourse-ai/rag-document-fragments/files/status.json?target_type=AiAgent&target_id=#{ai_agent.id}"
expect(response.parsed_body).to eq({})
expect(response.status).to eq(200)
diff --git a/plugins/discourse-ai/spec/requests/ai_bot/bot_controller_spec.rb b/plugins/discourse-ai/spec/requests/ai_bot/bot_controller_spec.rb
index 3da520a6f6a..75958c63fbe 100644
--- a/plugins/discourse-ai/spec/requests/ai_bot/bot_controller_spec.rb
+++ b/plugins/discourse-ai/spec/requests/ai_bot/bot_controller_spec.rb
@@ -140,16 +140,16 @@ RSpec.describe DiscourseAi::AiBot::BotController do
describe "#retry_response" do
fab!(:bot_user, :user)
let!(:llm_model) { Fabricate(:llm_model, user: bot_user) }
- let!(:ai_persona) do
+ let!(:ai_agent) do
Fabricate(
- :ai_persona,
+ :ai_agent,
user: bot_user,
default_llm_id: llm_model.id,
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
)
end
- let(:persona) { ai_persona.class_instance.new }
- let(:bot) { DiscourseAi::Personas::Bot.as(bot_user, persona: persona) }
+ let(:agent) { ai_agent.class_instance.new }
+ let(:bot) { DiscourseAi::Agents::Bot.as(bot_user, agent: agent) }
let!(:prompt_post) do
Fabricate(:post, topic: pm_topic, user: user, raw: "Hello @#{bot_user.username}")
@@ -167,7 +167,7 @@ RSpec.describe DiscourseAi::AiBot::BotController do
Group.refresh_automatic_groups!
SiteSetting.ai_bot_enabled = true
SiteSetting.ai_bot_allowed_groups = Group::AUTO_GROUPS[:trust_level_0].to_s
- AiPersona.persona_cache.flush!
+ AiAgent.agent_cache.flush!
tl0_group =
Group.find_by(name: "trust_level_0") || Group.find(Group::AUTO_GROUPS[:trust_level_0])
@@ -206,15 +206,15 @@ RSpec.describe DiscourseAi::AiBot::BotController do
Jobs::CreateAiReply.new.execute(
post_id: prompt_post.id,
bot_user_id: bot_user.id,
- persona_id: reply_post.custom_fields[DiscourseAi::AiBot::POST_AI_PERSONA_ID_FIELD].to_i,
+ agent_id: reply_post.custom_fields[DiscourseAi::AiBot::POST_AI_AGENT_ID_FIELD].to_i,
reply_post_id: reply_post.id,
)
end
expect(response.status).to eq(200)
expect(reply_post.reload.raw).to eq(retry_text)
- expect(reply_post.custom_fields[DiscourseAi::AiBot::POST_AI_PERSONA_ID_FIELD].to_i).to eq(
- persona.id,
+ expect(reply_post.custom_fields[DiscourseAi::AiBot::POST_AI_AGENT_ID_FIELD].to_i).to eq(
+ agent.id,
)
end
@@ -232,7 +232,7 @@ RSpec.describe DiscourseAi::AiBot::BotController do
it "allows retrying if LLM model has a negative id (seeded)" do
seeded_llm_model = Fabricate(:llm_model, id: -9999, user: bot_user, name: "second-model")
- bot = DiscourseAi::Personas::Bot.as(bot_user, persona: persona, model: seeded_llm_model)
+ bot = DiscourseAi::Agents::Bot.as(bot_user, agent: agent, model: seeded_llm_model)
DiscourseAi::Completions::Llm.with_prepared_responses(["first try"], llm: seeded_llm_model) do
DiscourseAi::AiBot::Playground.new(bot).reply_to(prompt_post)
end
@@ -257,7 +257,7 @@ RSpec.describe DiscourseAi::AiBot::BotController do
expect(reply.reload.raw).to eq(retry_text)
end
- it "uses the original LLM model when retrying even if persona default changed" do
+ it "uses the original LLM model when retrying even if agent default changed" do
second_bot_user = Fabricate(:user)
second_llm_model = Fabricate(:llm_model, user: second_bot_user, name: "second-model")
@@ -269,8 +269,8 @@ RSpec.describe DiscourseAi::AiBot::BotController do
expect(original_llm_name).to be_present
expect(original_llm_id.to_i).to eq(llm_model.id)
- ai_persona.update!(default_llm_id: second_llm_model.id)
- AiPersona.persona_cache.flush!
+ ai_agent.update!(default_llm_id: second_llm_model.id)
+ AiAgent.agent_cache.flush!
retry_text = "retry with original model"
diff --git a/plugins/discourse-ai/spec/requests/ai_credits_controller_spec.rb b/plugins/discourse-ai/spec/requests/ai_credits_controller_spec.rb
index 9085727b04c..331420952c6 100644
--- a/plugins/discourse-ai/spec/requests/ai_credits_controller_spec.rb
+++ b/plugins/discourse-ai/spec/requests/ai_credits_controller_spec.rb
@@ -20,14 +20,12 @@ RSpec.describe DiscourseAi::AiCreditsController do
get "/discourse-ai/credits/status.json"
expect(response.status).to eq(200)
- expect(response.parsed_body).to eq(
- { "personas" => {}, "features" => {}, "llm_models" => {} },
- )
+ expect(response.parsed_body).to eq({ "agents" => {}, "features" => {}, "llm_models" => {} })
end
context "when validating parameters" do
- it "returns 400 when persona_ids exceeds maximum" do
- get "/discourse-ai/credits/status.json", params: { persona_ids: (1..101).to_a }
+ it "returns 400 when agent_ids exceeds maximum" do
+ get "/discourse-ai/credits/status.json", params: { agent_ids: (1..101).to_a }
expect(response.status).to eq(400)
end
@@ -48,39 +46,39 @@ RSpec.describe DiscourseAi::AiCreditsController do
end
it "accepts exactly 100 items" do
- get "/discourse-ai/credits/status.json", params: { persona_ids: (1..100).to_a }
+ get "/discourse-ai/credits/status.json", params: { agent_ids: (1..100).to_a }
expect(response.status).to eq(200)
end
it "handles non-existent IDs gracefully" do
- get "/discourse-ai/credits/status.json", params: { persona_ids: [99_999, 88_888] }
+ get "/discourse-ai/credits/status.json", params: { agent_ids: [99_999, 88_888] }
expect(response.status).to eq(200)
- expect(response.parsed_body["personas"]).to eq({})
+ expect(response.parsed_body["agents"]).to eq({})
end
it "handles mixed valid and invalid IDs" do
llm_model = Fabricate(:llm_model, id: -10)
- ai_persona = Fabricate(:ai_persona, default_llm_id: llm_model.id)
+ ai_agent = Fabricate(:ai_agent, default_llm_id: llm_model.id)
Fabricate(:llm_credit_allocation, llm_model: llm_model, daily_credits: 1000)
- get "/discourse-ai/credits/status.json", params: { persona_ids: [ai_persona.id, 99_999] }
+ get "/discourse-ai/credits/status.json", params: { agent_ids: [ai_agent.id, 99_999] }
expect(response.status).to eq(200)
- expect(response.parsed_body["personas"].keys).to contain_exactly(ai_persona.id.to_s)
+ expect(response.parsed_body["agents"].keys).to contain_exactly(ai_agent.id.to_s)
end
end
- context "with persona_ids param" do
+ context "with agent_ids param" do
fab!(:llm_model) { Fabricate(:llm_model, id: -1) }
- fab!(:ai_persona) { Fabricate(:ai_persona, default_llm_id: llm_model.id) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, default_llm_id: llm_model.id) }
- it "returns empty for persona without credit allocation" do
- get "/discourse-ai/credits/status.json", params: { persona_ids: [ai_persona.id] }
+ it "returns empty for agent without credit allocation" do
+ get "/discourse-ai/credits/status.json", params: { agent_ids: [ai_agent.id] }
expect(response.status).to eq(200)
- expect(response.parsed_body["personas"]).to eq({})
+ expect(response.parsed_body["agents"]).to eq({})
end
context "with credit allocation" do
@@ -88,42 +86,42 @@ RSpec.describe DiscourseAi::AiCreditsController do
Fabricate(:llm_credit_allocation, llm_model: llm_model, daily_credits: 1000)
end
- it "returns credit status for persona" do
- get "/discourse-ai/credits/status.json", params: { persona_ids: [ai_persona.id] }
+ it "returns credit status for agent" do
+ get "/discourse-ai/credits/status.json", params: { agent_ids: [ai_agent.id] }
expect(response.status).to eq(200)
- persona_data = response.parsed_body.dig("personas", ai_persona.id.to_s)
-
- expect(persona_data).to be_present
- expect(persona_data["llm_model_id"]).to eq(llm_model.id)
- expect(persona_data["credit_status"]["available"]).to eq(true)
- expect(persona_data["credit_status"]["hard_limit_reached"]).to eq(false)
- expect(persona_data["credit_status"]["daily_credits"]).to eq(1000)
- expect(persona_data["credit_status"]["credits_remaining"]).to eq(1000)
+ agent_data = response.parsed_body.dig("agents", ai_agent.id.to_s)
+
+ expect(agent_data).to be_present
+ expect(agent_data["llm_model_id"]).to eq(llm_model.id)
+ expect(agent_data["credit_status"]["available"]).to eq(true)
+ expect(agent_data["credit_status"]["hard_limit_reached"]).to eq(false)
+ expect(agent_data["credit_status"]["daily_credits"]).to eq(1000)
+ expect(agent_data["credit_status"]["credits_remaining"]).to eq(1000)
end
it "returns hard_limit_reached when credits exhausted" do
llm_credit_allocation.deduct_credits!(1000)
- get "/discourse-ai/credits/status.json", params: { persona_ids: [ai_persona.id] }
+ get "/discourse-ai/credits/status.json", params: { agent_ids: [ai_agent.id] }
expect(response.status).to eq(200)
- persona_data = response.parsed_body.dig("personas", ai_persona.id.to_s)
+ agent_data = response.parsed_body.dig("agents", ai_agent.id.to_s)
- expect(persona_data["credit_status"]["available"]).to eq(false)
- expect(persona_data["credit_status"]["hard_limit_reached"]).to eq(true)
- expect(persona_data["credit_status"]["credits_remaining"]).to eq(0)
+ expect(agent_data["credit_status"]["available"]).to eq(false)
+ expect(agent_data["credit_status"]["hard_limit_reached"]).to eq(true)
+ expect(agent_data["credit_status"]["credits_remaining"]).to eq(0)
end
end
end
context "with features param" do
fab!(:llm_model) { Fabricate(:llm_model, id: -2) }
- fab!(:ai_persona) { Fabricate(:ai_persona, default_llm_id: llm_model.id) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, default_llm_id: llm_model.id) }
before do
SiteSetting.ai_discover_enabled = true
- SiteSetting.ai_discover_persona = ai_persona.id
+ SiteSetting.ai_discover_agent = ai_agent.id
end
it "returns empty for feature without credit allocation" do
@@ -164,27 +162,27 @@ RSpec.describe DiscourseAi::AiCreditsController do
end
end
- context "with both persona_ids and features params" do
+ context "with both agent_ids and features params" do
fab!(:llm_model) { Fabricate(:llm_model, id: -3) }
- fab!(:ai_persona) { Fabricate(:ai_persona, default_llm_id: llm_model.id) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, default_llm_id: llm_model.id) }
fab!(:llm_credit_allocation) do
Fabricate(:llm_credit_allocation, llm_model: llm_model, daily_credits: 1000)
end
before do
SiteSetting.ai_discover_enabled = true
- SiteSetting.ai_discover_persona = ai_persona.id
+ SiteSetting.ai_discover_agent = ai_agent.id
end
it "returns credit status for both" do
get "/discourse-ai/credits/status.json",
params: {
- persona_ids: [ai_persona.id],
+ agent_ids: [ai_agent.id],
features: ["discoveries"],
}
expect(response.status).to eq(200)
- expect(response.parsed_body["personas"]).to be_present
+ expect(response.parsed_body["agents"]).to be_present
expect(response.parsed_body["features"]).to be_present
end
end
diff --git a/plugins/discourse-ai/spec/requests/ai_helper/assistant_controller_spec.rb b/plugins/discourse-ai/spec/requests/ai_helper/assistant_controller_spec.rb
index d2a78b8c15d..cd9d0eb71da 100644
--- a/plugins/discourse-ai/spec/requests/ai_helper/assistant_controller_spec.rb
+++ b/plugins/discourse-ai/spec/requests/ai_helper/assistant_controller_spec.rb
@@ -110,16 +110,16 @@ RSpec.describe DiscourseAi::AiHelper::AssistantController do
)
end
- let(:post_illustrator_persona) do
- AiPersona.find_by(id: SiteSetting.ai_helper_post_illustrator_persona)
+ let(:post_illustrator_agent) do
+ AiAgent.find_by(id: SiteSetting.ai_helper_post_illustrator_agent)
end
before do
image_tool
- post_illustrator_persona.update_columns(system: false)
- post_illustrator_persona.update!(tools: [["custom-#{image_tool.id}", nil, true]])
+ post_illustrator_agent.update_columns(system: false)
+ post_illustrator_agent.update!(tools: [["custom-#{image_tool.id}", nil, true]])
- allow_any_instance_of(DiscourseAi::Personas::Bot).to receive(
+ allow_any_instance_of(DiscourseAi::Agents::Bot).to receive(
:reply,
) do |_bot, _context, &block|
block.call("", "![test](#{upload.short_url})", :partial_invoke)
@@ -364,7 +364,7 @@ RSpec.describe DiscourseAi::AiHelper::AssistantController do
end
end
- it "returns error when PostIllustrator persona has no image generation tool" do
+ it "returns error when PostIllustrator agent has no image generation tool" do
post "/discourse-ai/ai-helper/suggest",
params: {
mode: DiscourseAi::AiHelper::Assistant::ILLUSTRATE_POST,
@@ -374,12 +374,12 @@ RSpec.describe DiscourseAi::AiHelper::AssistantController do
expect(response.status).to eq(422)
expect(response.parsed_body["errors"].first).to include(
- "Post Illustrator persona must have an image generation tool",
+ "Post Illustrator agent must have an image generation tool",
)
end
- it "returns error when PostIllustrator persona is not found" do
- SiteSetting.ai_helper_post_illustrator_persona = 99_999
+ it "returns error when PostIllustrator agent is not found" do
+ SiteSetting.ai_helper_post_illustrator_agent = 99_999
post "/discourse-ai/ai-helper/suggest",
params: {
@@ -390,11 +390,11 @@ RSpec.describe DiscourseAi::AiHelper::AssistantController do
expect(response.status).to eq(404)
expect(response.parsed_body["errors"].first).to include(
- "Post Illustrator persona is not configured",
+ "Post Illustrator agent is not configured",
)
end
- context "when PostIllustrator persona has image generation tool" do
+ context "when PostIllustrator agent has image generation tool" do
let(:image_tool) do
AiTool.create!(
name: "Test Image Generator",
@@ -423,16 +423,16 @@ RSpec.describe DiscourseAi::AiHelper::AssistantController do
)
end
- let(:post_illustrator_persona) do
- AiPersona.find_by(id: SiteSetting.ai_helper_post_illustrator_persona)
+ let(:post_illustrator_agent) do
+ AiAgent.find_by(id: SiteSetting.ai_helper_post_illustrator_agent)
end
before do
image_tool
- post_illustrator_persona.update_columns(system: false) # Allow editing for test
- post_illustrator_persona.update!(tools: [["custom-#{image_tool.id}", nil, true]])
+ post_illustrator_agent.update_columns(system: false) # Allow editing for test
+ post_illustrator_agent.update!(tools: [["custom-#{image_tool.id}", nil, true]])
- allow_any_instance_of(DiscourseAi::Personas::Bot).to receive(
+ allow_any_instance_of(DiscourseAi::Agents::Bot).to receive(
:reply,
) do |_bot, _context, &block|
block.call("", "![test](#{upload.short_url})", :partial_invoke)
@@ -454,7 +454,7 @@ RSpec.describe DiscourseAi::AiHelper::AssistantController do
end
it "returns error when image generation fails" do
- allow_any_instance_of(DiscourseAi::Personas::Bot).to receive(:reply).and_return(nil)
+ allow_any_instance_of(DiscourseAi::Agents::Bot).to receive(:reply).and_return(nil)
post "/discourse-ai/ai-helper/suggest",
params: {
diff --git a/plugins/discourse-ai/spec/requests/discover/discoveries_controller_spec.rb b/plugins/discourse-ai/spec/requests/discover/discoveries_controller_spec.rb
index 846ac02184e..b4317b3f19b 100644
--- a/plugins/discourse-ai/spec/requests/discover/discoveries_controller_spec.rb
+++ b/plugins/discourse-ai/spec/requests/discover/discoveries_controller_spec.rb
@@ -11,11 +11,11 @@ RSpec.describe DiscourseAi::Discover::DiscoveriesController do
describe "#reply" do
fab!(:group)
- fab!(:ai_persona) { Fabricate(:ai_persona, allowed_group_ids: [group.id], default_llm_id: 1) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, allowed_group_ids: [group.id], default_llm_id: 1) }
- before { SiteSetting.ai_discover_persona = ai_persona.id }
+ before { SiteSetting.ai_discover_agent = ai_agent.id }
- context "when the user doesn't have access to the persona" do
+ context "when the user doesn't have access to the agent" do
it "returns a 403" do
post "/discourse-ai/discoveries/reply", params: { query: "What is Discourse?" }
@@ -25,7 +25,7 @@ RSpec.describe DiscourseAi::Discover::DiscoveriesController do
context "when the user is allowed to use discover" do
before do
- SiteSetting.ai_discover_persona = ai_persona.id
+ SiteSetting.ai_discover_agent = ai_agent.id
group.add(user)
end
@@ -48,17 +48,17 @@ RSpec.describe DiscourseAi::Discover::DiscoveriesController do
describe "#continue_convo" do
fab!(:group)
fab!(:llm_model)
- fab!(:ai_persona) do
- persona = Fabricate(:ai_persona, allowed_group_ids: [group.id], default_llm_id: llm_model.id)
- persona.create_user!
- persona
+ fab!(:ai_agent) do
+ agent = Fabricate(:ai_agent, allowed_group_ids: [group.id], default_llm_id: llm_model.id)
+ agent.create_user!
+ agent
end
let(:query) { "What is Discourse?" }
let(:context) { "Discourse is an open-source discussion platform." }
context "when the user is allowed to discover" do
before do
- SiteSetting.ai_discover_persona = ai_persona.id
+ SiteSetting.ai_discover_agent = ai_agent.id
group.add(user)
end
@@ -105,7 +105,7 @@ RSpec.describe DiscourseAi::Discover::DiscoveriesController do
describe "group-based restrictions" do
fab!(:staff_group) { Group[:staff] }
- before { ai_persona.update(allowed_group_ids: [staff_group.id]) }
+ before { ai_agent.update(allowed_group_ids: [staff_group.id]) }
it "forbid users without group access from creating conversations" do
expect(user.in_any_groups?([staff_group.id])).to be_falsey
diff --git a/plugins/discourse-ai/spec/requests/summarization/summary_controller_spec.rb b/plugins/discourse-ai/spec/requests/summarization/summary_controller_spec.rb
index 0d0ec10fbf8..d9955692200 100644
--- a/plugins/discourse-ai/spec/requests/summarization/summary_controller_spec.rb
+++ b/plugins/discourse-ai/spec/requests/summarization/summary_controller_spec.rb
@@ -151,7 +151,7 @@ RSpec.describe DiscourseAi::Summarization::SummaryController do
SiteSetting.ai_summary_gists_enabled = true
group.add(admin)
- assign_persona_to(:ai_summary_gists_persona, [group.id])
+ assign_agent_to(:ai_summary_gists_agent, [group.id])
Jobs.run_immediately!
end
@@ -221,7 +221,7 @@ RSpec.describe DiscourseAi::Summarization::SummaryController do
SiteSetting.ai_summarization_enabled = true
group.add(admin)
- assign_persona_to(:ai_summarization_persona, [group.id])
+ assign_agent_to(:ai_summarization_agent, [group.id])
end
context "when a single topic id is provided" do
diff --git a/plugins/discourse-ai/spec/serializers/ai_features_agent_serializer_spec.rb b/plugins/discourse-ai/spec/serializers/ai_features_agent_serializer_spec.rb
new file mode 100644
index 00000000000..e6159748134
--- /dev/null
+++ b/plugins/discourse-ai/spec/serializers/ai_features_agent_serializer_spec.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+RSpec.describe AiFeaturesAgentSerializer do
+ fab!(:admin)
+ fab!(:ai_agent)
+ fab!(:group)
+ fab!(:group_2, :group)
+
+ before { enable_current_plugin }
+
+ describe "serialized attributes" do
+ before do
+ ai_agent.allowed_group_ids = [group.id, group_2.id]
+ ai_agent.save!
+ end
+
+ context "when there is a agent with allowed groups" do
+ let(:allowed_groups) do
+ Group
+ .where(id: ai_agent.allowed_group_ids)
+ .pluck(:id, :name)
+ .map { |id, name| { id: id, name: name } }
+ end
+
+ it "display every participant" do
+ serialized = described_class.new(ai_agent, scope: Guardian.new(admin), root: nil)
+ expect(serialized.id).to eq(ai_agent.id)
+ expect(serialized.name).to eq(ai_agent.name)
+ expect(serialized.allowed_groups).to eq(allowed_groups)
+ end
+ end
+ end
+end
diff --git a/plugins/discourse-ai/spec/serializers/ai_features_persona_serializer_spec.rb b/plugins/discourse-ai/spec/serializers/ai_features_persona_serializer_spec.rb
deleted file mode 100644
index d9a5ac7f1d7..00000000000
--- a/plugins/discourse-ai/spec/serializers/ai_features_persona_serializer_spec.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe AiFeaturesPersonaSerializer do
- fab!(:admin)
- fab!(:ai_persona)
- fab!(:group)
- fab!(:group_2, :group)
-
- before { enable_current_plugin }
-
- describe "serialized attributes" do
- before do
- ai_persona.allowed_group_ids = [group.id, group_2.id]
- ai_persona.save!
- end
-
- context "when there is a persona with allowed groups" do
- let(:allowed_groups) do
- Group
- .where(id: ai_persona.allowed_group_ids)
- .pluck(:id, :name)
- .map { |id, name| { id: id, name: name } }
- end
-
- it "display every participant" do
- serialized = described_class.new(ai_persona, scope: Guardian.new(admin), root: nil)
- expect(serialized.id).to eq(ai_persona.id)
- expect(serialized.name).to eq(ai_persona.name)
- expect(serialized.allowed_groups).to eq(allowed_groups)
- end
- end
- end
-end
diff --git a/plugins/discourse-ai/spec/services/discourse_ai/agent_exporter_spec.rb b/plugins/discourse-ai/spec/services/discourse_ai/agent_exporter_spec.rb
new file mode 100644
index 00000000000..d28a656ac78
--- /dev/null
+++ b/plugins/discourse-ai/spec/services/discourse_ai/agent_exporter_spec.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+RSpec.describe DiscourseAi::AgentExporter do
+ before { enable_current_plugin }
+
+ describe "#export" do
+ subject(:export_json) { JSON.parse(exporter.export) }
+
+ context "when exporting a agent with a custom tool" do
+ fab!(:ai_tool) { Fabricate(:ai_tool, name: "Giphy Searcher", tool_name: "giphy_search") }
+ fab!(:ai_agent) { Fabricate(:ai_agent, tools: [["custom-#{ai_tool.id}", nil, false]]) }
+
+ let(:exporter) { described_class.new(agent: ai_agent) }
+
+ it "returns JSON containing the agent and its custom tool" do
+ expect(export_json["agent"]["name"]).to eq(ai_agent.name)
+ expect(export_json["agent"]["tools"].first.first).to eq("custom-#{ai_tool.tool_name}")
+
+ custom_tool = export_json["custom_tools"].first
+ expect(custom_tool["identifier"]).to eq(ai_tool.tool_name)
+ expect(custom_tool["name"]).to eq(ai_tool.name)
+ expect(custom_tool["secret_contracts"]).to eq(ai_tool.secret_contracts)
+ end
+ end
+
+ context "when the agent has no custom tools" do
+ fab!(:ai_agent) { Fabricate(:ai_agent, tools: []) }
+ let(:exporter) { described_class.new(agent: ai_agent) }
+
+ it "returns JSON with an empty custom_tools array" do
+ expect(export_json["custom_tools"]).to eq([])
+ end
+ end
+
+ context "when the agent does not exist" do
+ it "raises an error if initialized with a non agent" do
+ expect { described_class.new(agent: nil) }.to raise_error(
+ ArgumentError,
+ "Invalid agent provided",
+ )
+ end
+ end
+ end
+end
diff --git a/plugins/discourse-ai/spec/services/discourse_ai/persona_importer_spec.rb b/plugins/discourse-ai/spec/services/discourse_ai/agent_importer_spec.rb
similarity index 56%
rename from plugins/discourse-ai/spec/services/discourse_ai/persona_importer_spec.rb
rename to plugins/discourse-ai/spec/services/discourse_ai/agent_importer_spec.rb
index f6bcd05cd9f..dc295c88737 100644
--- a/plugins/discourse-ai/spec/services/discourse_ai/persona_importer_spec.rb
+++ b/plugins/discourse-ai/spec/services/discourse_ai/agent_importer_spec.rb
@@ -1,10 +1,10 @@
# frozen_string_literal: true
-RSpec.describe DiscourseAi::PersonaImporter do
+RSpec.describe DiscourseAi::AgentImporter do
before { enable_current_plugin }
describe "#import!" do
- context "when importing a persona with a custom tool" do
+ context "when importing a agent with a custom tool" do
fab!(:ai_tool) do
Fabricate(
:ai_tool,
@@ -13,21 +13,21 @@ RSpec.describe DiscourseAi::PersonaImporter do
secret_contracts: [{ alias: "giphy_api_key" }],
)
end
- fab!(:ai_persona) { Fabricate(:ai_persona, tools: [["custom-#{ai_tool.id}", nil, false]]) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, tools: [["custom-#{ai_tool.id}", nil, false]]) }
- let!(:export_json) { DiscourseAi::PersonaExporter.new(persona: ai_persona).export }
+ let!(:export_json) { DiscourseAi::AgentExporter.new(agent: ai_agent).export }
- it "creates the persona and its custom tool" do
- ai_persona.destroy
+ it "creates the agent and its custom tool" do
+ ai_agent.destroy
ai_tool.destroy
importer = described_class.new(json: export_json)
- persona = importer.import!
+ agent = importer.import!
- expect(persona).to be_persisted
- expect(persona.tools.first.first).to start_with("custom-")
+ expect(agent).to be_persisted
+ expect(agent.tools.first.first).to start_with("custom-")
- tool_id = persona.tools.first.first.split("-", 2).last.to_i
+ tool_id = agent.tools.first.first.split("-", 2).last.to_i
imported_tool = AiTool.find(tool_id)
expect(imported_tool.tool_name).to eq("giphy_search")
@@ -39,10 +39,10 @@ RSpec.describe DiscourseAi::PersonaImporter do
context "when conflicts exist" do
fab!(:existing_tool) { Fabricate(:ai_tool, name: "Web Browser", tool_name: "browse_web") }
fab!(:another_tool) { Fabricate(:ai_tool, name: "Calculator", tool_name: "calculator") }
- fab!(:ai_persona) do
+ fab!(:ai_agent) do
Fabricate(
- :ai_persona,
- name: "Test Persona",
+ :ai_agent,
+ name: "Test Agent",
tools: [
["custom-#{existing_tool.id}", nil, false],
["custom-#{another_tool.id}", nil, false],
@@ -50,17 +50,17 @@ RSpec.describe DiscourseAi::PersonaImporter do
)
end
- let(:export_json) { DiscourseAi::PersonaExporter.new(persona: ai_persona).export }
+ let(:export_json) { DiscourseAi::AgentExporter.new(agent: ai_agent).export }
- context "when persona already exists" do
- it "raises ImportError with persona conflict details" do
+ context "when agent already exists" do
+ it "raises ImportError with agent conflict details" do
importer = described_class.new(json: export_json)
expect { importer.import! }.to raise_error(
- DiscourseAi::PersonaImporter::ImportError,
+ DiscourseAi::AgentImporter::ImportError,
) do |error|
expect(error.conflicts).to eq(
- persona: "Test Persona",
+ agent: "Test Agent",
custom_tools: %w[browse_web calculator],
)
end
@@ -68,27 +68,27 @@ RSpec.describe DiscourseAi::PersonaImporter do
end
context "when custom tools already exist" do
- before { ai_persona.destroy }
+ before { ai_agent.destroy }
it "raises ImportError with custom tools conflict details" do
importer = described_class.new(json: export_json)
expect { importer.import! }.to raise_error(
- DiscourseAi::PersonaImporter::ImportError,
+ DiscourseAi::AgentImporter::ImportError,
) do |error|
expect(error.conflicts[:custom_tools]).to contain_exactly("browse_web", "calculator")
end
end
end
- context "when both persona and custom tools exist" do
+ context "when both agent and custom tools exist" do
it "raises ImportError with all conflicts" do
importer = described_class.new(json: export_json)
expect { importer.import! }.to raise_error(
- DiscourseAi::PersonaImporter::ImportError,
+ DiscourseAi::AgentImporter::ImportError,
) do |error|
- expect(error.conflicts[:persona]).to eq("Test Persona")
+ expect(error.conflicts[:agent]).to eq("Test Agent")
expect(error.conflicts[:custom_tools]).to contain_exactly("browse_web", "calculator")
end
end
@@ -97,20 +97,20 @@ RSpec.describe DiscourseAi::PersonaImporter do
context "with overwrite: true" do
fab!(:existing_tool) { Fabricate(:ai_tool, name: "Old Browser", tool_name: "browse_web") }
- fab!(:existing_persona) do
+ fab!(:existing_agent) do
Fabricate(
- :ai_persona,
- name: "Test Persona",
+ :ai_agent,
+ name: "Test Agent",
description: "Old description",
system_prompt: "Old prompt",
tools: [],
)
end
fab!(:new_tool) { Fabricate(:ai_tool, name: "New Tool", tool_name: "new_tool") }
- let(:export_persona) do
+ let(:export_agent) do
Fabricate.build(
- :ai_persona,
- name: "Test Persona",
+ :ai_agent,
+ name: "Test Agent",
description: "New description",
system_prompt: "New prompt",
tools: [
@@ -120,18 +120,18 @@ RSpec.describe DiscourseAi::PersonaImporter do
)
end
- let(:export_json) { DiscourseAi::PersonaExporter.new(persona: export_persona).export }
+ let(:export_json) { DiscourseAi::AgentExporter.new(agent: export_agent).export }
- before { export_persona.destroy }
+ before { export_agent.destroy }
- it "overwrites existing persona" do
+ it "overwrites existing agent" do
importer = described_class.new(json: export_json)
- persona = importer.import!(overwrite: true)
+ agent = importer.import!(overwrite: true)
- expect(persona.id).to eq(existing_persona.id)
- expect(persona.description).to eq("New description")
- expect(persona.system_prompt).to eq("New prompt")
- expect(persona.tools.length).to eq(2)
+ expect(agent.id).to eq(existing_agent.id)
+ expect(agent.description).to eq("New description")
+ expect(agent.system_prompt).to eq("New prompt")
+ expect(agent.tools.length).to eq(2)
end
it "overwrites existing custom tools" do
@@ -175,18 +175,76 @@ RSpec.describe DiscourseAi::PersonaImporter do
end
end
+ context "with legacy persona format" do
+ let(:legacy_hash) do
+ {
+ "meta" => {
+ "version" => "1.0",
+ },
+ "persona" => {
+ "name" => "Legacy Agent",
+ "description" => "A legacy persona",
+ "system_prompt" => "You are a legacy assistant",
+ "temperature" => 0.7,
+ "top_p" => 0.9,
+ "response_format" => [],
+ "examples" => [],
+ "tools" => ["SearchCommand"],
+ },
+ "custom_tools" => [],
+ }
+ end
+
+ it "imports a legacy persona hash successfully" do
+ importer = described_class.new(json: legacy_hash)
+ agent = importer.import!
+
+ expect(agent).to be_persisted
+ expect(agent.name).to eq("Legacy Agent")
+ expect(agent.description).to eq("A legacy persona")
+ end
+
+ it "imports a legacy persona JSON string successfully" do
+ importer = described_class.new(json: legacy_hash.to_json)
+ agent = importer.import!
+
+ expect(agent).to be_persisted
+ expect(agent.name).to eq("Legacy Agent")
+ end
+
+ it "detects conflicts with legacy format" do
+ Fabricate(:ai_agent, name: "Legacy Agent")
+
+ importer = described_class.new(json: legacy_hash)
+
+ expect { importer.import! }.to raise_error(
+ DiscourseAi::AgentImporter::ImportError,
+ ) { |error| expect(error.conflicts[:agent]).to eq("Legacy Agent") }
+ end
+
+ it "overwrites with legacy format when overwrite: true" do
+ existing = Fabricate(:ai_agent, name: "Legacy Agent", description: "Old")
+
+ importer = described_class.new(json: legacy_hash)
+ agent = importer.import!(overwrite: true)
+
+ expect(agent.id).to eq(existing.id)
+ expect(agent.description).to eq("A legacy persona")
+ end
+ end
+
context "with invalid payload" do
it "raises an error for invalid JSON structure" do
expect { described_class.new(json: "{}").import! }.to raise_error(
ArgumentError,
- "Invalid persona export data",
+ "Invalid agent export data",
)
end
- it "raises an error for missing persona data" do
+ it "raises an error for missing agent data" do
expect { described_class.new(json: { "custom_tools" => [] }).import! }.to raise_error(
ArgumentError,
- "Invalid persona export data",
+ "Invalid agent export data",
)
end
end
diff --git a/plugins/discourse-ai/spec/services/discourse_ai/ai_helper/generate_thumbnails_spec.rb b/plugins/discourse-ai/spec/services/discourse_ai/ai_helper/generate_thumbnails_spec.rb
index 59d2155dfbb..6d02f626874 100644
--- a/plugins/discourse-ai/spec/services/discourse_ai/ai_helper/generate_thumbnails_spec.rb
+++ b/plugins/discourse-ai/spec/services/discourse_ai/ai_helper/generate_thumbnails_spec.rb
@@ -6,8 +6,8 @@ RSpec.describe DiscourseAi::AiHelper::GenerateThumbnails do
fab!(:user)
fab!(:admin)
- fab!(:post_illustrator_persona) do
- AiPersona.create!(
+ fab!(:post_illustrator_agent) do
+ AiAgent.create!(
name: "Post Illustrator",
description: "Generates images for posts",
system_prompt: "Generate images",
@@ -49,10 +49,10 @@ RSpec.describe DiscourseAi::AiHelper::GenerateThumbnails do
before do
enable_current_plugin
assign_fake_provider_to(:ai_default_llm_model)
- SiteSetting.ai_helper_post_illustrator_persona = post_illustrator_persona.id
+ SiteSetting.ai_helper_post_illustrator_agent = post_illustrator_agent.id
- # Configure PostIllustrator persona with the image tool
- post_illustrator_persona.update!(tools: [["custom-#{image_tool.id}", nil, true]])
+ # Configure PostIllustrator agent with the image tool
+ post_illustrator_agent.update!(tools: [["custom-#{image_tool.id}", nil, true]])
end
context "when text parameter is missing" do
@@ -67,16 +67,16 @@ RSpec.describe DiscourseAi::AiHelper::GenerateThumbnails do
it { is_expected.to fail_a_contract }
end
- context "when persona is not found" do
- before { SiteSetting.ai_helper_post_illustrator_persona = 99_999 }
+ context "when agent is not found" do
+ before { SiteSetting.ai_helper_post_illustrator_agent = 99_999 }
- it { is_expected.to fail_to_find_a_model(:persona) }
+ it { is_expected.to fail_to_find_a_model(:agent) }
end
- context "when persona has no image generation tool" do
+ context "when agent has no image generation tool" do
before do
- # Remove tools from persona
- post_illustrator_persona.update!(tools: [])
+ # Remove tools from agent
+ post_illustrator_agent.update!(tools: [])
end
it { is_expected.to fail_a_policy(:has_image_generation_tool) }
@@ -85,7 +85,7 @@ RSpec.describe DiscourseAi::AiHelper::GenerateThumbnails do
context "when image generation succeeds" do
before do
# Mock the bot reply to return custom_raw with upload URL
- allow_any_instance_of(DiscourseAi::Personas::Bot).to receive(
+ allow_any_instance_of(DiscourseAi::Agents::Bot).to receive(
:reply,
) do |_bot, _context, &block|
block.call("", "![test](#{upload.short_url})", :partial_invoke)
@@ -103,16 +103,14 @@ RSpec.describe DiscourseAi::AiHelper::GenerateThumbnails do
end
context "when bot returns no custom_raw" do
- before do
- allow_any_instance_of(DiscourseAi::Personas::Bot).to receive(:reply).and_return(nil)
- end
+ before { allow_any_instance_of(DiscourseAi::Agents::Bot).to receive(:reply).and_return(nil) }
it { is_expected.to fail_a_step(:generate_images) }
end
context "when bot returns custom_raw without upload URLs" do
before do
- allow_any_instance_of(DiscourseAi::Personas::Bot).to receive(
+ allow_any_instance_of(DiscourseAi::Agents::Bot).to receive(
:reply,
) do |_bot, _context, &block|
block.call("Some text without uploads", nil, :custom_raw)
@@ -124,7 +122,7 @@ RSpec.describe DiscourseAi::AiHelper::GenerateThumbnails do
context "when upload is not found" do
before do
- allow_any_instance_of(DiscourseAi::Personas::Bot).to receive(
+ allow_any_instance_of(DiscourseAi::Agents::Bot).to receive(
:reply,
) do |_bot, _context, &block|
block.call("", "![test](upload://nonexistentsha1234567890123456789012)", :partial_invoke)
diff --git a/plugins/discourse-ai/spec/services/discourse_ai/credit_status_checker_spec.rb b/plugins/discourse-ai/spec/services/discourse_ai/credit_status_checker_spec.rb
index af0e023049b..7977189c894 100644
--- a/plugins/discourse-ai/spec/services/discourse_ai/credit_status_checker_spec.rb
+++ b/plugins/discourse-ai/spec/services/discourse_ai/credit_status_checker_spec.rb
@@ -12,39 +12,39 @@ RSpec.describe DiscourseAi::CreditStatusChecker do
it { is_expected.to run_successfully }
it "returns empty result" do
- expect(result[:personas]).to eq({})
+ expect(result[:agents]).to eq({})
expect(result[:features]).to eq({})
expect(result[:llm_models]).to eq({})
end
end
context "when parameters exceed limits" do
- let(:params) { { persona_ids: (1..101).to_a } }
+ let(:params) { { agent_ids: (1..101).to_a } }
it { is_expected.to fail_a_contract }
end
- context "with persona_ids param" do
+ context "with agent_ids param" do
fab!(:llm_model) { Fabricate(:llm_model, id: -1) }
- fab!(:ai_persona) { Fabricate(:ai_persona, default_llm_id: llm_model.id) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, default_llm_id: llm_model.id) }
- let(:params) { { persona_ids: [ai_persona.id] } }
+ let(:params) { { agent_ids: [ai_agent.id] } }
context "without credit allocation" do
it { is_expected.to run_successfully }
- it "returns empty personas hash" do
- expect(result[:personas]).to eq({})
+ it "returns empty agents hash" do
+ expect(result[:agents]).to eq({})
end
end
- context "with non-existent persona IDs" do
- let(:params) { { persona_ids: [99_999] } }
+ context "with non-existent agent IDs" do
+ let(:params) { { agent_ids: [99_999] } }
it { is_expected.to run_successfully }
- it "returns empty personas hash" do
- expect(result[:personas]).to eq({})
+ it "returns empty agents hash" do
+ expect(result[:agents]).to eq({})
end
end
@@ -55,27 +55,27 @@ RSpec.describe DiscourseAi::CreditStatusChecker do
it { is_expected.to run_successfully }
- it "returns credit status for persona" do
- persona_data = result[:personas][ai_persona.id]
+ it "returns credit status for agent" do
+ agent_data = result[:agents][ai_agent.id]
- expect(persona_data).to be_present
- expect(persona_data[:llm_model_id]).to eq(llm_model.id)
- expect(persona_data[:credit_status][:available]).to eq(true)
- expect(persona_data[:credit_status][:daily_credits]).to eq(1000)
+ expect(agent_data).to be_present
+ expect(agent_data[:llm_model_id]).to eq(llm_model.id)
+ expect(agent_data[:credit_status][:available]).to eq(true)
+ expect(agent_data[:credit_status][:daily_credits]).to eq(1000)
end
it "returns hard_limit_reached when credits exhausted" do
llm_credit_allocation.deduct_credits!(1000)
- persona_data = result[:personas][ai_persona.id]
+ agent_data = result[:agents][ai_agent.id]
- expect(persona_data[:credit_status][:available]).to eq(false)
- expect(persona_data[:credit_status][:hard_limit_reached]).to eq(true)
+ expect(agent_data[:credit_status][:available]).to eq(false)
+ expect(agent_data[:credit_status][:hard_limit_reached]).to eq(true)
end
- it "batch loads multiple personas efficiently" do
- persona2 = Fabricate(:ai_persona, default_llm_id: llm_model.id)
- params[:persona_ids] = [ai_persona.id, persona2.id]
+ it "batch loads multiple agents efficiently" do
+ agent2 = Fabricate(:ai_agent, default_llm_id: llm_model.id)
+ params[:agent_ids] = [ai_agent.id, agent2.id]
queries = track_sql_queries { result }
@@ -85,22 +85,22 @@ RSpec.describe DiscourseAi::CreditStatusChecker do
end
it "handles mixed valid and invalid IDs" do
- params[:persona_ids] = [ai_persona.id, 99_999]
+ params[:agent_ids] = [ai_agent.id, 99_999]
- expect(result[:personas].keys).to contain_exactly(ai_persona.id)
+ expect(result[:agents].keys).to contain_exactly(ai_agent.id)
end
end
end
context "with features param" do
fab!(:llm_model) { Fabricate(:llm_model, id: -2) }
- fab!(:ai_persona) { Fabricate(:ai_persona, default_llm_id: llm_model.id) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, default_llm_id: llm_model.id) }
let(:params) { { features: ["discoveries"] } }
before do
SiteSetting.ai_discover_enabled = true
- SiteSetting.ai_discover_persona = ai_persona.id
+ SiteSetting.ai_discover_agent = ai_agent.id
end
context "without credit allocation" do
@@ -218,34 +218,34 @@ RSpec.describe DiscourseAi::CreditStatusChecker do
context "with combined parameters" do
fab!(:llm_model) { Fabricate(:llm_model, id: -6) }
- fab!(:ai_persona) { Fabricate(:ai_persona, default_llm_id: llm_model.id) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, default_llm_id: llm_model.id) }
fab!(:llm_credit_allocation) do
Fabricate(:llm_credit_allocation, llm_model: llm_model, daily_credits: 1000)
end
let(:params) do
- { persona_ids: [ai_persona.id], features: ["discoveries"], llm_model_ids: [llm_model.id] }
+ { agent_ids: [ai_agent.id], features: ["discoveries"], llm_model_ids: [llm_model.id] }
end
before do
SiteSetting.ai_discover_enabled = true
- SiteSetting.ai_discover_persona = ai_persona.id
+ SiteSetting.ai_discover_agent = ai_agent.id
end
it { is_expected.to run_successfully }
it "handles multiple parameter types simultaneously" do
- expect(result[:personas]).to be_present
+ expect(result[:agents]).to be_present
expect(result[:features]).to be_present
expect(result[:llm_models]).to be_present
end
end
context "with input sanitization" do
- it "sanitizes persona IDs to integers" do
- params[:persona_ids] = ["1", "2", nil, ""]
+ it "sanitizes agent IDs to integers" do
+ params[:agent_ids] = ["1", "2", nil, ""]
- expect(result[:personas]).to eq({})
+ expect(result[:agents]).to eq({})
end
it "sanitizes feature names to strings" do
diff --git a/plugins/discourse-ai/spec/services/discourse_ai/persona_exporter_spec.rb b/plugins/discourse-ai/spec/services/discourse_ai/persona_exporter_spec.rb
deleted file mode 100644
index e9c173272dc..00000000000
--- a/plugins/discourse-ai/spec/services/discourse_ai/persona_exporter_spec.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe DiscourseAi::PersonaExporter do
- before { enable_current_plugin }
-
- describe "#export" do
- subject(:export_json) { JSON.parse(exporter.export) }
-
- context "when exporting a persona with a custom tool" do
- fab!(:ai_tool) { Fabricate(:ai_tool, name: "Giphy Searcher", tool_name: "giphy_search") }
- fab!(:ai_persona) { Fabricate(:ai_persona, tools: [["custom-#{ai_tool.id}", nil, false]]) }
-
- let(:exporter) { described_class.new(persona: ai_persona) }
-
- it "returns JSON containing the persona and its custom tool" do
- expect(export_json["persona"]["name"]).to eq(ai_persona.name)
- expect(export_json["persona"]["tools"].first.first).to eq("custom-#{ai_tool.tool_name}")
-
- custom_tool = export_json["custom_tools"].first
- expect(custom_tool["identifier"]).to eq(ai_tool.tool_name)
- expect(custom_tool["name"]).to eq(ai_tool.name)
- expect(custom_tool["secret_contracts"]).to eq(ai_tool.secret_contracts)
- end
- end
-
- context "when the persona has no custom tools" do
- fab!(:ai_persona) { Fabricate(:ai_persona, tools: []) }
- let(:exporter) { described_class.new(persona: ai_persona) }
-
- it "returns JSON with an empty custom_tools array" do
- expect(export_json["custom_tools"]).to eq([])
- end
- end
-
- context "when the persona does not exist" do
- it "raises an error if initialized with a non persona" do
- expect { described_class.new(persona: nil) }.to raise_error(
- ArgumentError,
- "Invalid persona provided",
- )
- end
- end
- end
-end
diff --git a/plugins/discourse-ai/spec/services/discourse_ai/summarization/regenerate_summaries_spec.rb b/plugins/discourse-ai/spec/services/discourse_ai/summarization/regenerate_summaries_spec.rb
index a7d193eaee7..b27a6b44185 100644
--- a/plugins/discourse-ai/spec/services/discourse_ai/summarization/regenerate_summaries_spec.rb
+++ b/plugins/discourse-ai/spec/services/discourse_ai/summarization/regenerate_summaries_spec.rb
@@ -61,7 +61,7 @@ RSpec.describe DiscourseAi::Summarization::RegenerateSummaries do
before do
SiteSetting.ai_summary_gists_enabled = true
- assign_persona_to(:ai_summary_gists_persona, [group.id])
+ assign_agent_to(:ai_summary_gists_agent, [group.id])
end
include_examples "common validation"
@@ -102,7 +102,7 @@ RSpec.describe DiscourseAi::Summarization::RegenerateSummaries do
context "when type is summary" do
let(:type) { "summary" }
- before { assign_persona_to(:ai_summarization_persona, [group.id]) }
+ before { assign_agent_to(:ai_summarization_agent, [group.id]) }
include_examples "common validation"
diff --git a/plugins/discourse-ai/spec/services/problem_check/ai_llm_status_spec.rb b/plugins/discourse-ai/spec/services/problem_check/ai_llm_status_spec.rb
index 2f1310f6f67..d2692cc18a2 100644
--- a/plugins/discourse-ai/spec/services/problem_check/ai_llm_status_spec.rb
+++ b/plugins/discourse-ai/spec/services/problem_check/ai_llm_status_spec.rb
@@ -4,13 +4,13 @@ RSpec.describe ProblemCheck::AiLlmStatus do
subject(:check) { described_class.new(target) }
fab!(:llm_model)
- fab!(:ai_persona) { Fabricate(:ai_persona, default_llm_id: llm_model.id) }
+ fab!(:ai_agent) { Fabricate(:ai_agent, default_llm_id: llm_model.id) }
let(:target) { llm_model.id }
before do
assign_fake_provider_to(:ai_default_llm_model)
- SiteSetting.ai_summarization_persona = ai_persona.id
+ SiteSetting.ai_summarization_agent = ai_agent.id
SiteSetting.ai_summarization_enabled = true
end
@@ -84,8 +84,7 @@ RSpec.describe ProblemCheck::AiLlmStatus do
it "skips seeded LLMs" do
SiteSetting.ai_summarization_enabled = false
seeded_llm = Fabricate(:seeded_model)
- SiteSetting.ai_summarization_persona =
- Fabricate(:ai_persona, default_llm_id: seeded_llm.id).id
+ SiteSetting.ai_summarization_agent = Fabricate(:ai_agent, default_llm_id: seeded_llm.id).id
SiteSetting.ai_summarization_enabled = true
3.times { create_log(response_tokens: 0, response_status: 500, llm_id: seeded_llm.id) }
diff --git a/plugins/discourse-ai/spec/system/admin_ai_agent_spec.rb b/plugins/discourse-ai/spec/system/admin_ai_agent_spec.rb
new file mode 100644
index 00000000000..92aefb5e5c8
--- /dev/null
+++ b/plugins/discourse-ai/spec/system/admin_ai_agent_spec.rb
@@ -0,0 +1,130 @@
+# frozen_string_literal: true
+
+RSpec.describe "Admin AI agent configuration", type: :system do
+ fab!(:admin)
+ let(:page_header) { PageObjects::Components::DPageHeader.new }
+ let(:form) { PageObjects::Components::FormKit.new("form") }
+
+ before do
+ enable_current_plugin
+ SiteSetting.ai_bot_enabled = true
+ sign_in(admin)
+ end
+
+ it "allows creation of a agent" do
+ visit "/admin/plugins/discourse-ai/ai-agents"
+
+ expect(page_header).to be_visible
+
+ find(".ai-agent-list-editor__new-button").click()
+
+ expect(page_header).to be_hidden
+
+ form.field("name").fill_in("Test Agent")
+ form.field("description").fill_in("I am a test agent")
+ form.field("system_prompt").fill_in("You are a helpful bot")
+
+ tool_selector = PageObjects::Components::SelectKit.new("#control-tools .select-kit")
+ tool_selector.expand
+ tool_selector.select_row_by_value("Read")
+ tool_selector.select_row_by_value("ListCategories")
+ tool_selector.collapse
+
+ tool_selector = PageObjects::Components::SelectKit.new("#control-forcedTools .select-kit")
+ tool_selector.expand
+ tool_selector.select_row_by_value("ListCategories")
+ tool_selector.select_row_by_value("Read")
+ tool_selector.collapse
+
+ form.field("forced_tool_count").select(1)
+
+ form.submit
+
+ expect(page).not_to have_current_path("/admin/plugins/discourse-ai/ai-agents/new")
+
+ agent_id = page.current_path.split("/")[-2].to_i
+
+ agent = AiAgent.find(agent_id)
+ expect(agent.name).to eq("Test Agent")
+ expect(agent.description).to eq("I am a test agent")
+ expect(agent.system_prompt).to eq("You are a helpful bot")
+ expect(agent.forced_tool_count).to eq(1)
+
+ expected_tools = [["Read", { "read_private" => nil }, true], ["ListCategories", {}, true]]
+ expect(agent.tools).to contain_exactly(*expected_tools)
+
+ # lets also test upgrades here... particularly one options was deleted and another added
+ # this ensurse that we can still edit the tool correctly and all options are present
+ agent.update!(tools: [["Read", { "got_deleted" => true }]])
+
+ visit "/admin/plugins/discourse-ai/ai-agents/#{agent_id}/edit"
+
+ expect(page).to have_selector("input[name='toolOptions.Read.read_private']")
+ expect(page).not_to have_selector("input[name='toolOptions.Read.got_deleted']")
+ end
+
+ it "will not allow deletion or editing of system agents" do
+ visit "/admin/plugins/discourse-ai/ai-agents/#{DiscourseAi::Agents::Agent.system_agents.values.first}/edit"
+ expect(page).not_to have_selector(".ai-agent-editor__delete")
+ expect(form.field("system_prompt")).to be_disabled
+ end
+
+ it "will enable agent right away when you click on enable but does not save side effects" do
+ agent = Fabricate(:ai_agent, enabled: false)
+
+ visit "/admin/plugins/discourse-ai/ai-agents/#{agent.id}/edit"
+
+ form.field("name").fill_in("Test Agent 1")
+ form.field("enabled").toggle
+
+ expect(agent.reload.enabled).to eq(true)
+ expect(agent.name).not_to eq("Test Agent 1")
+ end
+
+ it "enabling a agent doesn't reset other fields" do
+ agent = Fabricate(:ai_agent, enabled: false)
+ updated_name = "Update agent 1"
+
+ visit "/admin/plugins/discourse-ai/ai-agents/#{agent.id}/edit"
+
+ form.field("name").fill_in(updated_name)
+ form.field("enabled").toggle
+
+ expect(agent.reload.enabled).to eq(true)
+ expect(form.field("name").value).to eq(updated_name)
+ end
+
+ it "toggling a agent's priority doesn't reset other fields" do
+ agent = Fabricate(:ai_agent, priority: false)
+ updated_name = "Update agent 1"
+
+ visit "/admin/plugins/discourse-ai/ai-agents/#{agent.id}/edit"
+
+ form.field("name").fill_in(updated_name)
+ form.field("priority").toggle
+
+ expect(agent.reload.priority).to eq(true)
+ expect(form.field("name").value).to eq(updated_name)
+ end
+
+ it "can navigate the AI plugin with breadcrumbs" do
+ visit "/admin/plugins/discourse-ai/ai-agents"
+ expect(page).to have_css(".d-breadcrumbs")
+ expect(page).to have_css(".d-breadcrumbs__item", count: 4)
+ find(".d-breadcrumbs__item", text: I18n.t("admin_js.admin.plugins.title")).click
+ expect(page).to have_current_path("/admin/plugins")
+ end
+
+ it "redirects legacy ai-personas routes to ai-agents" do
+ agent = Fabricate(:ai_agent)
+
+ visit "/admin/plugins/discourse-ai/ai-personas"
+ expect(page).to have_current_path("/admin/plugins/discourse-ai/ai-agents")
+
+ visit "/admin/plugins/discourse-ai/ai-personas/new"
+ expect(page).to have_current_path("/admin/plugins/discourse-ai/ai-agents/new")
+
+ visit "/admin/plugins/discourse-ai/ai-personas/#{agent.id}/edit"
+ expect(page).to have_current_path("/admin/plugins/discourse-ai/ai-agents/#{agent.id}/edit")
+ end
+end
diff --git a/plugins/discourse-ai/spec/system/admin_ai_features_spec.rb b/plugins/discourse-ai/spec/system/admin_ai_features_spec.rb
index 377aee5e6ab..c6c61af70d3 100644
--- a/plugins/discourse-ai/spec/system/admin_ai_features_spec.rb
+++ b/plugins/discourse-ai/spec/system/admin_ai_features_spec.rb
@@ -3,7 +3,7 @@
RSpec.describe "Admin AI features configuration", type: :system do
fab!(:admin)
fab!(:llm_model)
- fab!(:summarization_persona, :ai_persona)
+ fab!(:summarization_agent, :ai_agent)
fab!(:group_1, :group)
fab!(:group_2, :group)
let(:page_header) { PageObjects::Components::DPageHeader.new }
@@ -12,15 +12,15 @@ RSpec.describe "Admin AI features configuration", type: :system do
before do
enable_current_plugin
- summarization_persona.allowed_group_ids = [group_1.id, group_2.id]
- summarization_persona.save!
+ summarization_agent.allowed_group_ids = [group_1.id, group_2.id]
+ summarization_agent.save!
assign_fake_provider_to(:ai_default_llm_model)
SiteSetting.ai_summarization_enabled = true
- SiteSetting.ai_summarization_persona = summarization_persona.id
+ SiteSetting.ai_summarization_agent = summarization_agent.id
sign_in(admin)
end
- it "lists all persona backed AI features separated by configured/unconfigured" do
+ it "lists all agent backed AI features separated by configured/unconfigured" do
ai_features_page.visit
ai_features_page.toggle_configured
@@ -32,12 +32,12 @@ RSpec.describe "Admin AI features configuration", type: :system do
expect(ai_features_page).to have_listed_modules(8)
end
- it "lists the persona used for the corresponding AI feature" do
+ it "lists the agent used for the corresponding AI feature" do
ai_features_page.visit
ai_features_page.toggle_configured
- expect(ai_features_page).to have_feature_persona("topic_summaries", summarization_persona.name)
+ expect(ai_features_page).to have_feature_agent("topic_summaries", summarization_agent.name)
end
it "lists the groups allowed to use the AI feature" do
diff --git a/plugins/discourse-ai/spec/system/admin_ai_persona_spec.rb b/plugins/discourse-ai/spec/system/admin_ai_persona_spec.rb
deleted file mode 100644
index 77e90ceec50..00000000000
--- a/plugins/discourse-ai/spec/system/admin_ai_persona_spec.rb
+++ /dev/null
@@ -1,117 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe "Admin AI persona configuration", type: :system do
- fab!(:admin)
- let(:page_header) { PageObjects::Components::DPageHeader.new }
- let(:form) { PageObjects::Components::FormKit.new("form") }
-
- before do
- enable_current_plugin
- SiteSetting.ai_bot_enabled = true
- sign_in(admin)
- end
-
- it "allows creation of a persona" do
- visit "/admin/plugins/discourse-ai/ai-personas"
-
- expect(page_header).to be_visible
-
- find(".ai-persona-list-editor__new-button").click()
-
- expect(page_header).to be_hidden
-
- form.field("name").fill_in("Test Persona")
- form.field("description").fill_in("I am a test persona")
- form.field("system_prompt").fill_in("You are a helpful bot")
-
- tool_selector = PageObjects::Components::SelectKit.new("#control-tools .select-kit")
- tool_selector.expand
- tool_selector.select_row_by_value("Read")
- tool_selector.select_row_by_value("ListCategories")
- tool_selector.collapse
-
- tool_selector = PageObjects::Components::SelectKit.new("#control-forcedTools .select-kit")
- tool_selector.expand
- tool_selector.select_row_by_value("ListCategories")
- tool_selector.select_row_by_value("Read")
- tool_selector.collapse
-
- form.field("forced_tool_count").select(1)
-
- form.submit
-
- expect(page).not_to have_current_path("/admin/plugins/discourse-ai/ai-personas/new")
-
- persona_id = page.current_path.split("/")[-2].to_i
-
- persona = AiPersona.find(persona_id)
- expect(persona.name).to eq("Test Persona")
- expect(persona.description).to eq("I am a test persona")
- expect(persona.system_prompt).to eq("You are a helpful bot")
- expect(persona.forced_tool_count).to eq(1)
-
- expected_tools = [["Read", { "read_private" => nil }, true], ["ListCategories", {}, true]]
- expect(persona.tools).to contain_exactly(*expected_tools)
-
- # lets also test upgrades here... particularly one options was deleted and another added
- # this ensurse that we can still edit the tool correctly and all options are present
- persona.update!(tools: [["Read", { "got_deleted" => true }]])
-
- visit "/admin/plugins/discourse-ai/ai-personas/#{persona_id}/edit"
-
- expect(page).to have_selector("input[name='toolOptions.Read.read_private']")
- expect(page).not_to have_selector("input[name='toolOptions.Read.got_deleted']")
- end
-
- it "will not allow deletion or editing of system personas" do
- visit "/admin/plugins/discourse-ai/ai-personas/#{DiscourseAi::Personas::Persona.system_personas.values.first}/edit"
- expect(page).not_to have_selector(".ai-persona-editor__delete")
- expect(form.field("system_prompt")).to be_disabled
- end
-
- it "will enable persona right away when you click on enable but does not save side effects" do
- persona = Fabricate(:ai_persona, enabled: false)
-
- visit "/admin/plugins/discourse-ai/ai-personas/#{persona.id}/edit"
-
- form.field("name").fill_in("Test Persona 1")
- form.field("enabled").toggle
-
- expect(persona.reload.enabled).to eq(true)
- expect(persona.name).not_to eq("Test Persona 1")
- end
-
- it "enabling a persona doesn't reset other fields" do
- persona = Fabricate(:ai_persona, enabled: false)
- updated_name = "Update persona 1"
-
- visit "/admin/plugins/discourse-ai/ai-personas/#{persona.id}/edit"
-
- form.field("name").fill_in(updated_name)
- form.field("enabled").toggle
-
- expect(persona.reload.enabled).to eq(true)
- expect(form.field("name").value).to eq(updated_name)
- end
-
- it "toggling a persona's priority doesn't reset other fields" do
- persona = Fabricate(:ai_persona, priority: false)
- updated_name = "Update persona 1"
-
- visit "/admin/plugins/discourse-ai/ai-personas/#{persona.id}/edit"
-
- form.field("name").fill_in(updated_name)
- form.field("priority").toggle
-
- expect(persona.reload.priority).to eq(true)
- expect(form.field("name").value).to eq(updated_name)
- end
-
- it "can navigate the AI plugin with breadcrumbs" do
- visit "/admin/plugins/discourse-ai/ai-personas"
- expect(page).to have_css(".d-breadcrumbs")
- expect(page).to have_css(".d-breadcrumbs__item", count: 4)
- find(".d-breadcrumbs__item", text: I18n.t("admin_js.admin.plugins.title")).click
- expect(page).to have_current_path("/admin/plugins")
- end
-end
diff --git a/plugins/discourse-ai/spec/system/ai_bot/agent_spec.rb b/plugins/discourse-ai/spec/system/ai_bot/agent_spec.rb
new file mode 100644
index 00000000000..a8f59b62cff
--- /dev/null
+++ b/plugins/discourse-ai/spec/system/ai_bot/agent_spec.rb
@@ -0,0 +1,58 @@
+# frozen_string_literal: true
+
+RSpec.describe "AI agents", type: :system do
+ fab!(:admin)
+ fab!(:gpt_4) { Fabricate(:llm_model, name: "gpt-4") }
+
+ before do
+ enable_current_plugin
+ SiteSetting.ai_bot_enabled = true
+ SiteSetting.ai_bot_add_to_header = true
+ toggle_enabled_bots(bots: [gpt_4])
+ sign_in(admin)
+ end
+
+ it "can select and save agent tool options" do
+ visit "/admin/plugins/discourse-ai/ai-agents"
+ find(".ai-agent-list-editor__new-button").click
+
+ expect(page).to have_current_path("/admin/plugins/discourse-ai/ai-agents/new")
+
+ form = PageObjects::Components::FormKit.new("form")
+ form.field("name").fill_in("Test Agent")
+ form.field("description").fill_in("This is a test agent.")
+ form.field("system_prompt").fill_in("You are a helpful assistant.")
+ form.field("tools").select("Update Artifact")
+ form.field("toolOptions.UpdateArtifact.update_algorithm").select("full")
+ form.submit
+
+ expect(page).to have_current_path(%r{/admin/plugins/discourse-ai/ai-agents/\d+/edit})
+
+ agent = AiAgent.order("id desc").first
+
+ expect(agent.name).to eq("Test Agent")
+ expect(agent.description).to eq("This is a test agent.")
+ expect(agent.tools.count).to eq(1)
+ expect(agent.tools.first[0]).to eq("UpdateArtifact")
+ expect(agent.tools.first[1]["update_algorithm"]).to eq("full")
+ end
+
+ it "remembers the last selected agent" do
+ visit "/"
+ find(".d-header .ai-bot-button").click()
+ agent_selector = PageObjects::Components::SelectKit.new(".agent-llm-selector__agent-dropdown")
+
+ id = DiscourseAi::Agents::Agent.all(user: admin).first.id
+
+ expect(agent_selector).to have_selected_value(id)
+
+ agent_selector.expand
+ agent_selector.select_row_by_value(-2)
+
+ visit "/"
+ find(".d-header .ai-bot-button").click()
+ agent_selector = PageObjects::Components::SelectKit.new(".agent-llm-selector__agent-dropdown")
+ agent_selector.expand
+ expect(agent_selector).to have_selected_value(-2)
+ end
+end
diff --git a/plugins/discourse-ai/spec/system/ai_bot/header_toggle_spec.rb b/plugins/discourse-ai/spec/system/ai_bot/header_toggle_spec.rb
index a69496a0616..04da93685f5 100644
--- a/plugins/discourse-ai/spec/system/ai_bot/header_toggle_spec.rb
+++ b/plugins/discourse-ai/spec/system/ai_bot/header_toggle_spec.rb
@@ -23,8 +23,8 @@ RSpec.describe "AI Bot - Header Toggle", type: :system do
group.add(user)
group.save
- allowed_persona = AiPersona.last
- allowed_persona.update!(allowed_group_ids: [group.id], enabled: true)
+ allowed_agent = AiAgent.last
+ allowed_agent.update!(allowed_group_ids: [group.id], enabled: true)
sign_in(user)
end
diff --git a/plugins/discourse-ai/spec/system/ai_bot/homepage_spec.rb b/plugins/discourse-ai/spec/system/ai_bot/homepage_spec.rb
index 3ce7eedfd8b..880da68356e 100644
--- a/plugins/discourse-ai/spec/system/ai_bot/homepage_spec.rb
+++ b/plugins/discourse-ai/spec/system/ai_bot/homepage_spec.rb
@@ -38,12 +38,12 @@ RSpec.describe "AI Bot - Homepage", type: :system do
claude_2.reload.user
end
fab!(:bot) do
- persona =
- AiPersona
- .find(DiscourseAi::Personas::Persona.system_personas[DiscourseAi::Personas::General])
+ agent =
+ AiAgent
+ .find(DiscourseAi::Agents::Agent.system_agents[DiscourseAi::Agents::General])
.class_instance
.new
- DiscourseAi::Personas::Bot.as(bot_user, persona: persona)
+ DiscourseAi::Agents::Bot.as(bot_user, agent: agent)
end
fab!(:pm) do
@@ -76,23 +76,23 @@ RSpec.describe "AI Bot - Homepage", type: :system do
fab!(:topic_user) { Fabricate(:topic_user, topic: pm, user: user) }
fab!(:topic_bot_user) { Fabricate(:topic_user, topic: pm, user: bot_user) }
- fab!(:persona) do
- persona =
- AiPersona.create!(
- name: "Test Persona",
- description: "A test persona",
+ fab!(:agent) do
+ agent =
+ AiAgent.create!(
+ name: "Test Agent",
+ description: "A test agent",
allowed_group_ids: [Group::AUTO_GROUPS[:trust_level_0]],
enabled: true,
system_prompt: "You are a helpful bot",
)
- persona.create_user!
- persona.update!(
+ agent.create_user!
+ agent.update!(
default_llm_id: claude_2.id,
allow_chat_channel_mentions: true,
allow_topic_mentions: true,
)
- persona
+ agent
end
before do
@@ -242,33 +242,33 @@ RSpec.describe "AI Bot - Homepage", type: :system do
expect(sidebar).to have_section_link(pm.title)
end
- it "allows navigating to a specific LLM and persona" do
+ it "allows navigating to a specific LLM and agent" do
# url encode name
- persona_name = CGI.escape(persona.name)
+ agent_name = CGI.escape(agent.name)
llm_name = CGI.escape(claude_2_dup.display_name)
- visit "/discourse-ai/ai-bot/conversations?persona=#{persona_name}&llm=#{llm_name}"
+ visit "/discourse-ai/ai-bot/conversations?agent=#{agent_name}&llm=#{llm_name}"
- ai_pm_homepage.persona_selector.expand # not needed, but helps to see what the list has
- expect(ai_pm_homepage.persona_selector).to have_selected_name(persona.name)
+ ai_pm_homepage.agent_selector.expand # not needed, but helps to see what the list has
+ expect(ai_pm_homepage.agent_selector).to have_selected_name(agent.name)
expect(ai_pm_homepage.llm_selector).to have_selected_name(claude_2_dup.display_name)
end
- it "removes persona from selector when allow_personal_messages is disabled" do
+ it "removes agent from selector when allow_personal_messages is disabled" do
begin
- persona.update!(allow_personal_messages: false)
+ agent.update!(allow_personal_messages: false)
ai_pm_homepage.visit
- ai_pm_homepage.persona_selector.expand
- expect(ai_pm_homepage.persona_selector).to have_no_option_name(persona.name)
+ ai_pm_homepage.agent_selector.expand
+ expect(ai_pm_homepage.agent_selector).to have_no_option_name(agent.name)
ensure
- persona.update!(allow_personal_messages: true)
+ agent.update!(allow_personal_messages: true)
end
end
- it "includes persona in selector when allow_personal_messages is enabled" do
+ it "includes agent in selector when allow_personal_messages is enabled" do
# default is true
ai_pm_homepage.visit
- ai_pm_homepage.persona_selector.expand
- expect(ai_pm_homepage.persona_selector).to have_option_name(persona.name)
+ ai_pm_homepage.agent_selector.expand
+ expect(ai_pm_homepage.agent_selector).to have_option_name(agent.name)
end
it "shows empty state when no PMs exist" do
@@ -388,7 +388,7 @@ RSpec.describe "AI Bot - Homepage", type: :system do
expect(sidebar).to have_no_section_link(pm.title)
end
- it "Allows choosing persona and LLM" do
+ it "Allows choosing agent and LLM" do
ai_pm_homepage.visit
ai_pm_homepage.llm_selector.expand
diff --git a/plugins/discourse-ai/spec/system/ai_bot/persona_spec.rb b/plugins/discourse-ai/spec/system/ai_bot/persona_spec.rb
deleted file mode 100644
index 3d5d3ac9b4e..00000000000
--- a/plugins/discourse-ai/spec/system/ai_bot/persona_spec.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe "AI personas", type: :system do
- fab!(:admin)
- fab!(:gpt_4) { Fabricate(:llm_model, name: "gpt-4") }
-
- before do
- enable_current_plugin
- SiteSetting.ai_bot_enabled = true
- SiteSetting.ai_bot_add_to_header = true
- toggle_enabled_bots(bots: [gpt_4])
- sign_in(admin)
- end
-
- it "can select and save persona tool options" do
- visit "/admin/plugins/discourse-ai/ai-personas"
- find(".ai-persona-list-editor__new-button").click
-
- expect(page).to have_current_path("/admin/plugins/discourse-ai/ai-personas/new")
-
- form = PageObjects::Components::FormKit.new("form")
- form.field("name").fill_in("Test Persona")
- form.field("description").fill_in("This is a test persona.")
- form.field("system_prompt").fill_in("You are a helpful assistant.")
- form.field("tools").select("Update Artifact")
- form.field("toolOptions.UpdateArtifact.update_algorithm").select("full")
- form.submit
-
- expect(page).to have_current_path(%r{/admin/plugins/discourse-ai/ai-personas/\d+/edit})
-
- persona = AiPersona.order("id desc").first
-
- expect(persona.name).to eq("Test Persona")
- expect(persona.description).to eq("This is a test persona.")
- expect(persona.tools.count).to eq(1)
- expect(persona.tools.first[0]).to eq("UpdateArtifact")
- expect(persona.tools.first[1]["update_algorithm"]).to eq("full")
- end
-
- it "remembers the last selected persona" do
- visit "/"
- find(".d-header .ai-bot-button").click()
- persona_selector =
- PageObjects::Components::SelectKit.new(".persona-llm-selector__persona-dropdown")
-
- id = DiscourseAi::Personas::Persona.all(user: admin).first.id
-
- expect(persona_selector).to have_selected_value(id)
-
- persona_selector.expand
- persona_selector.select_row_by_value(-2)
-
- visit "/"
- find(".d-header .ai-bot-button").click()
- persona_selector =
- PageObjects::Components::SelectKit.new(".persona-llm-selector__persona-dropdown")
- persona_selector.expand
- expect(persona_selector).to have_selected_value(-2)
- end
-end
diff --git a/plugins/discourse-ai/spec/system/ai_bot/share_spec.rb b/plugins/discourse-ai/spec/system/ai_bot/share_spec.rb
index 56ac9353cc9..9c75a3b7ea7 100644
--- a/plugins/discourse-ai/spec/system/ai_bot/share_spec.rb
+++ b/plugins/discourse-ai/spec/system/ai_bot/share_spec.rb
@@ -44,14 +44,14 @@ RSpec.describe "Share conversation", type: :system do
page.execute_script("window.navigator.clipboard.writeText('')")
end
- it "can share a conversation with a persona user" do
+ it "can share a conversation with a agent user" do
clip_text = nil
- persona = Fabricate(:ai_persona, name: "Tester")
- persona.create_user!
+ agent = Fabricate(:ai_agent, name: "Tester")
+ agent.create_user!
Fabricate(:post, topic: pm, user: admin, raw: "How do I do stuff?")
- Fabricate(:post, topic: pm, user: persona.user, raw: "No idea")
+ Fabricate(:post, topic: pm, user: agent.user, raw: "No idea")
visit(pm.url)
diff --git a/plugins/discourse-ai/spec/system/ai_bot/tool_spec.rb b/plugins/discourse-ai/spec/system/ai_bot/tool_spec.rb
index d2413608ef7..ca74178f556 100644
--- a/plugins/discourse-ai/spec/system/ai_bot/tool_spec.rb
+++ b/plugins/discourse-ai/spec/system/ai_bot/tool_spec.rb
@@ -64,7 +64,7 @@ describe "AI Tool Management", type: :system do
expect(page.first(required_toggle_css).checked?).to eq(true)
expect(page.first(enum_toggle_css).checked?).to eq(false)
- visit "/admin/plugins/discourse-ai/ai-personas/new"
+ visit "/admin/plugins/discourse-ai/ai-agents/new"
tool_id = AiTool.order("id desc").limit(1).pluck(:id).first
tool_selector = PageObjects::Components::SelectKit.new("#control-tools .select-kit")
diff --git a/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rb b/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rb
index 48691d12e14..b65f46ca8a0 100644
--- a/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rb
+++ b/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rb
@@ -5,15 +5,15 @@ RSpec.describe "AI Composer helper", type: :system do
fab!(:non_member_group, :group)
fab!(:embedding_definition)
- fab!(:custom_prompts_persona) do
- Fabricate(:ai_persona, allowed_group_ids: [Group::AUTO_GROUPS[:admins]])
+ fab!(:custom_prompts_agent) do
+ Fabricate(:ai_agent, allowed_group_ids: [Group::AUTO_GROUPS[:admins]])
end
before do
enable_current_plugin
Group.find_by(id: Group::AUTO_GROUPS[:admins]).add(user)
assign_fake_provider_to(:ai_default_llm_model)
- SiteSetting.ai_helper_custom_prompt_persona = custom_prompts_persona.id
+ SiteSetting.ai_helper_custom_prompt_agent = custom_prompts_agent.id
SiteSetting.ai_helper_enabled = true
Jobs.run_immediately!
sign_in(user)
@@ -121,7 +121,7 @@ RSpec.describe "AI Composer helper", type: :system do
context "when not a member of custom prompt group" do
let(:mode) { DiscourseAi::AiHelper::Assistant::CUSTOM_PROMPT }
- before { custom_prompts_persona.update!(allowed_group_ids: [non_member_group.id]) }
+ before { custom_prompts_agent.update!(allowed_group_ids: [non_member_group.id]) }
it "does not show custom prompt option" do
trigger_composer_helper(input)
diff --git a/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rb b/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rb
index 2f16e1579f8..f55324d9b80 100644
--- a/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rb
+++ b/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rb
@@ -4,13 +4,11 @@ RSpec.describe "User AI preferences", type: :system do
fab!(:user) { Fabricate(:admin, refresh_auto_groups: true) }
fab!(:llm_model)
let(:user_preferences_ai_page) { PageObjects::Pages::UserPreferencesAi.new }
- fab!(:discovery_persona) do
- Fabricate(:ai_persona, allowed_group_ids: [Group::AUTO_GROUPS[:admins]])
- end
+ fab!(:discovery_agent) { Fabricate(:ai_agent, allowed_group_ids: [Group::AUTO_GROUPS[:admins]]) }
before do
enable_current_plugin
- SiteSetting.ai_discover_persona = discovery_persona.id
+ SiteSetting.ai_discover_agent = discovery_agent.id
Group.find_by(id: Group::AUTO_GROUPS[:admins]).add(user)
assign_fake_provider_to(:ai_default_llm_model)
sign_in(user)
@@ -38,7 +36,7 @@ RSpec.describe "User AI preferences", type: :system do
expect(user.user_option.reload.ai_search_discoveries).to eq(false)
end
- context "when the user can't use personas" do
+ context "when the user can't use agents" do
it "doesn't render the option in the preferences page" do
Group.find_by(id: Group::AUTO_GROUPS[:admins]).remove(user)
diff --git a/plugins/discourse-ai/spec/system/page_objects/components/ai_pm_homepage.rb b/plugins/discourse-ai/spec/system/page_objects/components/ai_pm_homepage.rb
index 77eccd772a7..e7fd6f3e313 100644
--- a/plugins/discourse-ai/spec/system/page_objects/components/ai_pm_homepage.rb
+++ b/plugins/discourse-ai/spec/system/page_objects/components/ai_pm_homepage.rb
@@ -56,12 +56,12 @@ module PageObjects
page.find(".sidebar-section-content a.sidebar-section-link").click
end
- def persona_selector
- PageObjects::Components::SelectKit.new(".persona-llm-selector__persona-dropdown")
+ def agent_selector
+ PageObjects::Components::SelectKit.new(".agent-llm-selector__agent-dropdown")
end
def llm_selector
- PageObjects::Components::SelectKit.new(".persona-llm-selector__llm-dropdown")
+ PageObjects::Components::SelectKit.new(".agent-llm-selector__llm-dropdown")
end
def has_sidebar_back_link?
diff --git a/plugins/discourse-ai/spec/system/page_objects/pages/admin_ai_features.rb b/plugins/discourse-ai/spec/system/page_objects/pages/admin_ai_features.rb
index b2afbe54080..8a250446902 100644
--- a/plugins/discourse-ai/spec/system/page_objects/pages/admin_ai_features.rb
+++ b/plugins/discourse-ai/spec/system/page_objects/pages/admin_ai_features.rb
@@ -24,9 +24,9 @@ module PageObjects
page.has_css?("#{FEATURES_PAGE} .ai-module", count: count)
end
- def has_feature_persona?(feature_name, name)
+ def has_feature_agent?(feature_name, name)
page.has_css?(
- "#{FEATURES_PAGE} .ai-feature-card[data-feature-name='#{feature_name}'] .ai-feature-card__persona-link",
+ "#{FEATURES_PAGE} .ai-feature-card[data-feature-name='#{feature_name}'] .ai-feature-card__agent-link",
text: name,
)
end
diff --git a/plugins/discourse-ai/spec/system/summarization/chat_summarization_spec.rb b/plugins/discourse-ai/spec/system/summarization/chat_summarization_spec.rb
index dcbd71f01fd..536052e0010 100644
--- a/plugins/discourse-ai/spec/system/summarization/chat_summarization_spec.rb
+++ b/plugins/discourse-ai/spec/system/summarization/chat_summarization_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe "Summarize a channel since your last visit", type: :system do
group.add(current_user)
assign_fake_provider_to(:ai_default_llm_model)
- assign_persona_to(:ai_summarization_persona, [group.id])
+ assign_agent_to(:ai_summarization_agent, [group.id])
SiteSetting.ai_summarization_enabled = true
SiteSetting.chat_enabled = true
diff --git a/plugins/discourse-ai/spec/system/summarization/gists_toggle_spec.rb b/plugins/discourse-ai/spec/system/summarization/gists_toggle_spec.rb
index be7222c3744..934e90a4554 100644
--- a/plugins/discourse-ai/spec/system/summarization/gists_toggle_spec.rb
+++ b/plugins/discourse-ai/spec/system/summarization/gists_toggle_spec.rb
@@ -13,7 +13,7 @@ describe "Gists Toggle Functionality", type: :system do
SiteSetting.ai_summary_gists_enabled = true
group.add(admin)
- assign_persona_to(:ai_summary_gists_persona, [group.id])
+ assign_agent_to(:ai_summary_gists_agent, [group.id])
sign_in(admin)
end
@@ -124,7 +124,7 @@ describe "Gists Toggle Functionality - Mobile", type: :system, mobile: true do
SiteSetting.ai_summary_gists_enabled = true
group.add(admin)
- assign_persona_to(:ai_summary_gists_persona, [group.id])
+ assign_agent_to(:ai_summary_gists_agent, [group.id])
sign_in(admin)
end
diff --git a/plugins/discourse-ai/spec/system/summarization/topic_summarization_spec.rb b/plugins/discourse-ai/spec/system/summarization/topic_summarization_spec.rb
index 12658162b96..2e9fc746a51 100644
--- a/plugins/discourse-ai/spec/system/summarization/topic_summarization_spec.rb
+++ b/plugins/discourse-ai/spec/system/summarization/topic_summarization_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe "Summarize a topic ", type: :system do
group.add(current_user)
assign_fake_provider_to(:ai_default_llm_model)
- assign_persona_to(:ai_summarization_persona, [group.id])
+ assign_agent_to(:ai_summarization_agent, [group.id])
SiteSetting.ai_summarization_enabled = true
sign_in(current_user)
diff --git a/plugins/discourse-ai/test/javascripts/acceptance/ai-bot-sidebar-link-test.js b/plugins/discourse-ai/test/javascripts/acceptance/ai-bot-sidebar-link-test.js
index 1ff464034cb..45b1075ce53 100644
--- a/plugins/discourse-ai/test/javascripts/acceptance/ai-bot-sidebar-link-test.js
+++ b/plugins/discourse-ai/test/javascripts/acceptance/ai-bot-sidebar-link-test.js
@@ -8,7 +8,7 @@ acceptance("AI Bot - Sidebar community link", function (needs) {
{
id: 1,
model_name: "gpt-4",
- is_persona: false,
+ is_agent: false,
},
],
});
@@ -42,7 +42,7 @@ acceptance("AI Bot - Sidebar community link - disabled", function (needs) {
{
id: 1,
model_name: "gpt-4",
- is_persona: false,
+ is_agent: false,
},
],
});
@@ -83,14 +83,14 @@ acceptance("AI Bot - Sidebar community link - no bots", function (needs) {
});
acceptance(
- "AI Bot - Sidebar community link - persona without default LLM",
+ "AI Bot - Sidebar community link - agent without default LLM",
function (needs) {
needs.user({
ai_enabled_chat_bots: [
{
id: 1,
- model_name: "custom-persona",
- is_persona: true,
+ model_name: "custom-agent",
+ is_agent: true,
has_default_llm: false,
},
],
@@ -102,27 +102,27 @@ acceptance(
ai_bot_add_to_community_section: true,
});
- test("does not display AI bot link when persona has no default LLM", async function (assert) {
+ test("does not display AI bot link when agent has no default LLM", async function (assert) {
await visit("/");
assert
.dom(".sidebar-section-link[data-link-name='ai-bot']")
.doesNotExist(
- "AI bot link is not displayed when persona lacks default LLM"
+ "AI bot link is not displayed when agent lacks default LLM"
);
});
}
);
acceptance(
- "AI Bot - Sidebar community link - persona with default LLM",
+ "AI Bot - Sidebar community link - agent with default LLM",
function (needs) {
needs.user({
ai_enabled_chat_bots: [
{
id: 1,
- model_name: "custom-persona",
- is_persona: true,
+ model_name: "custom-agent",
+ is_agent: true,
has_default_llm: true,
},
],
@@ -134,12 +134,12 @@ acceptance(
ai_bot_add_to_community_section: true,
});
- test("displays AI bot link when persona has default LLM", async function (assert) {
+ test("displays AI bot link when agent has default LLM", async function (assert) {
await visit("/");
assert
.dom(".sidebar-section-link[data-link-name='ai-bot']")
- .exists("AI bot link is displayed when persona has default LLM");
+ .exists("AI bot link is displayed when agent has default LLM");
});
}
);
diff --git a/plugins/discourse-ai/test/javascripts/integration/components/ai-search-discoveries-test.gjs b/plugins/discourse-ai/test/javascripts/integration/components/ai-search-discoveries-test.gjs
index 63179afea94..9f9b099f906 100644
--- a/plugins/discourse-ai/test/javascripts/integration/components/ai-search-discoveries-test.gjs
+++ b/plugins/discourse-ai/test/javascripts/integration/components/ai-search-discoveries-test.gjs
@@ -13,7 +13,7 @@ module("Integration | Component | ai-search-discoveries", function (hooks) {
hooks.beforeEach(function () {
this.siteSettings.ai_discover_enabled = true;
- this.currentUser.can_use_ai_discover_persona = true;
+ this.currentUser.can_use_ai_discover_agent = true;
this.closeSearchMenuCalled = false;
this.closeSearchMenu = () => {
diff --git a/plugins/discourse-ai/test/javascripts/unit/models/ai-persona-test.js b/plugins/discourse-ai/test/javascripts/unit/models/ai-agent-test.js
similarity index 61%
rename from plugins/discourse-ai/test/javascripts/unit/models/ai-persona-test.js
rename to plugins/discourse-ai/test/javascripts/unit/models/ai-agent-test.js
index 2d393cf17cf..7b65ec89d28 100644
--- a/plugins/discourse-ai/test/javascripts/unit/models/ai-persona-test.js
+++ b/plugins/discourse-ai/test/javascripts/unit/models/ai-agent-test.js
@@ -1,7 +1,7 @@
import { module, test } from "qunit";
-import AiPersona from "discourse/plugins/discourse-ai/discourse/admin/models/ai-persona";
+import AiAgent from "discourse/plugins/discourse-ai/discourse/admin/models/ai-agent";
-module("Discourse AI | Unit | Model | ai-persona", function () {
+module("Discourse AI | Unit | Model | ai-agent", function () {
test("toPOJO", function (assert) {
const properties = {
tools: [
@@ -11,15 +11,11 @@ module("Discourse AI | Unit | Model | ai-persona", function () {
],
};
- const aiPersonaPOJO = AiPersona.create(properties).toPOJO();
+ const aiAgentPOJO = AiAgent.create(properties).toPOJO();
- assert.deepEqual(aiPersonaPOJO.tools, [
- "ToolName",
- "ToolName2",
- "ToolName3",
- ]);
- assert.strictEqual(aiPersonaPOJO.toolOptions["ToolName"].option1, "value1");
- assert.strictEqual(aiPersonaPOJO.toolOptions["ToolName"].option2, "value2");
+ assert.deepEqual(aiAgentPOJO.tools, ["ToolName", "ToolName2", "ToolName3"]);
+ assert.strictEqual(aiAgentPOJO.toolOptions["ToolName"].option1, "value1");
+ assert.strictEqual(aiAgentPOJO.toolOptions["ToolName"].option2, "value2");
});
test("fromPOJO", function (assert) {
@@ -48,7 +44,6 @@ module("Discourse AI | Unit | Model | ai-persona", function () {
rag_conversation_chunks: 10,
rag_llm_model_id: 1,
question_consolidator_llm_id: 2,
- allow_chat: false,
show_thinking: true,
forced_tool_count: -1,
allow_personal_messages: true,
@@ -58,16 +53,16 @@ module("Discourse AI | Unit | Model | ai-persona", function () {
};
const updatedValue = "updated";
- const aiPersona = AiPersona.create({ ...properties });
+ const aiAgent = AiAgent.create({ ...properties });
- const personaPOJO = aiPersona.toPOJO();
+ const agentPOJO = aiAgent.toPOJO();
- personaPOJO.toolOptions["ToolName"].option1 = updatedValue;
- personaPOJO.forcedTools = "ToolName";
+ agentPOJO.toolOptions["ToolName"].option1 = updatedValue;
+ agentPOJO.forcedTools = "ToolName";
- const updatedPersona = aiPersona.fromPOJO(personaPOJO);
+ const updatedAgent = aiAgent.fromPOJO(agentPOJO);
- assert.deepEqual(updatedPersona.tools, [
+ assert.deepEqual(updatedAgent.tools, [
["ToolName", { option1: updatedValue }, true],
]);
});
diff --git a/plugins/discourse-ai/test/javascripts/unit/routes/admin-plugins-show-discourse-ai-agents-legacy-route-test.js b/plugins/discourse-ai/test/javascripts/unit/routes/admin-plugins-show-discourse-ai-agents-legacy-route-test.js
new file mode 100644
index 00000000000..655259b9e44
--- /dev/null
+++ b/plugins/discourse-ai/test/javascripts/unit/routes/admin-plugins-show-discourse-ai-agents-legacy-route-test.js
@@ -0,0 +1,61 @@
+import { module, test } from "qunit";
+import AdminPluginsShowDiscourseAiAgentsLegacy from "discourse/plugins/discourse-ai/discourse/routes/admin-plugins/show/discourse-ai-agents-legacy";
+
+module(
+ "Unit | Route | admin-plugins-show-discourse-ai-agents-legacy",
+ function () {
+ test("it redirects the legacy index route via URL", function (assert) {
+ const route = AdminPluginsShowDiscourseAiAgentsLegacy.create();
+ let redirectArgs;
+
+ route.replaceWith = (...args) => (redirectArgs = args);
+
+ route.beforeModel({
+ intent: { url: "/admin/plugins/discourse-ai/ai-personas" },
+ });
+
+ assert.deepEqual(redirectArgs, ["/admin/plugins/discourse-ai/ai-agents"]);
+ });
+
+ test("it redirects the legacy new route via URL", function (assert) {
+ const route = AdminPluginsShowDiscourseAiAgentsLegacy.create();
+ let redirectArgs;
+
+ route.replaceWith = (...args) => (redirectArgs = args);
+
+ route.beforeModel({
+ intent: { url: "/admin/plugins/discourse-ai/ai-personas/new" },
+ });
+
+ assert.deepEqual(redirectArgs, [
+ "/admin/plugins/discourse-ai/ai-agents/new",
+ ]);
+ });
+
+ test("it redirects the legacy edit route via URL", function (assert) {
+ const route = AdminPluginsShowDiscourseAiAgentsLegacy.create();
+ let redirectArgs;
+
+ route.replaceWith = (...args) => (redirectArgs = args);
+
+ route.beforeModel({
+ intent: { url: "/admin/plugins/discourse-ai/ai-personas/123/edit" },
+ });
+
+ assert.deepEqual(redirectArgs, [
+ "/admin/plugins/discourse-ai/ai-agents/123/edit",
+ ]);
+ });
+
+ test("it falls back to named route when URL is unavailable", function (assert) {
+ const route = AdminPluginsShowDiscourseAiAgentsLegacy.create();
+ let redirectArgs;
+
+ route.replaceWith = (...args) => (redirectArgs = args);
+
+ route.beforeModel({ intent: {} });
+
+ assert.deepEqual(redirectArgs, ["adminPlugins.show.discourse-ai-agents"]);
+ });
+ }
+);