I’m thinking about enabling some custom prompts in the Discourse helper.
Right now, the most I’ve managed is to use them from agents via the AI Bot. A function, for example, briefly develops a post from a pasted link. It works great, but it’s a lot of work to transform the personal message into a topic, move it, and then add tags.
The desired behavior would allow adding that same functionality to the ones already established in the helper, without needing to paste the initial prompt again.
Okay, I ended up reusing helpers that are currently available (but not used in our community) and already shipped with Discourse.
| Where |
Setting |
Set to |
Rename label (Customize → Text) |
| Ask AI (posts/topics) |
ai_helper_translator_agent |
custom search agent |
discourse_ai.ai_helper.prompts.translate → custom search label |
| Composer Translate |
ai_helper_markdown_tables_agent |
built-in Translator agent |
discourse_ai.ai_helper.prompts.markdown_table → Translate |
| Composer Markdown formatter |
ai_helper_smart_dates_agent |
Markdown formatter agent (moved) |
discourse_ai.ai_helper.prompts.replace_dates → Format as Markdown |
Then two snippets:
javascripts/discourse/api-initializers/ai-helper-slots.gjs
import { apiInitializer } from "discourse/lib/api";
const AI_HELPER_ICONS = {
translate: "ph-dt-magnifying-glass", // for forum search agent
markdown_table: "ph-dt-translate", // composer: built-in Translator
replace_dates: "ph-dt-markdown", // composer: Markdown formatter
};
export default apiInitializer((api) => {
api.getCurrentUser()?.ai_helper_prompts?.forEach((prompt) => {
prompt.icon = AI_HELPER_ICONS[prompt.name] ?? prompt.icon;
});
});
common.scss
.ai-composer-helper-menu ul.ai-helper-options li[data-value="translate"] {
display: none;
}
Note I am using a custom Phosphor icon set; the newicons can be bundled into Font Awesome, Material, or any other icon set.