[Ai Bot] Add user token tracking, custom AI personas, max context posts, document loading, custom API URLs, and localized chat titles

Hello everyone!

I would like to suggest a few useful features for the Discourse AI plugin:

  1. Tracking token usage per user
    This would allow admins to monitor how many tokens each user is consuming when interacting with the AI. It could help prevent abuse and allow setting per-user or per-group token limits. Seeing detailed token usage breakdown by user would give better insight into usage patterns and costs.
    Russian language is used by us in our community to chat with AI, but the OpenAI tokenizer does not work well with the Russian language. One token can be one symbol, and it’s damn expensive for us!

  2. Allowing users to create custom AI personas
    Letting users define their own AI assistant’s persona (creating custom prompts) to more engaging, personalized interactions. Giving users this flexibility would inspire more creative uses of AI on the forum.

  3. Setting a default max number of posts to include as context
    Adding a default option for all personas to limit context to a certain number of recent posts could help keep token usage under control while still giving the AI enough context to respond appropriately.

  4. Ability to use text from custom data sources
    Integrating document loaders for sources like PDFs, webpages, Google Drive files, etc. would make it easier for users to interact with information and it doesn’t seem very difficult to implement. Imagine being able to have the AI reference information from a whitepaper uploaded as a PDF, or facts from specific webpages, when engaging in a topic. This is especially useful for academic communities like mine, which often deal with articles in different formats. This could supercharge the AI’s capabilities in specialized discussions. Document loading tools like LangChain could potentially be leveraged for this: Document Loaders — :parrot::link: LangChain 0.0.146

  5. Support for custom API base URLs for all AI models
    Currently, custom API URLs are only supported for OpenAI. Extending this capability to all supported AI providers would be very helpful for those who need to use a reverse proxy or other non-standard API endpoint. Many of us rely on reverse proxies for security, compliance or cost management reasons, so having the flexibility to route AI requests through our own infrastructure would make it much easier to integrate this plugin into our environments.

  6. Generate localized chat titles based on user’s language
    Right now, the AI generates chat titles only in English. Having the ability to create titles in the user’s preferred language would provide a better user experience, especially for non-English speaking communities.

Please let me know what you think!

2 Likes

Hi @Oniel :slight_smile:

As I mentioned before, you need to create a separate topic per feature request:

I’ll close this one off, but leave it visible so you can work on breaking it into separate topics. :+1:

4 Likes