Summary | Uses a remote AI language model to prepare and post a summary of a topic. | |
Repository Link | GitHub - merefield/discourse-ai-topic-summary: Uses a remote AI language model to prepare and post a summary of a Topic | |
Install Guide | How to install plugins in Discourse |
Enjoying this plugin? Please it on GitHub !
Features
(NB, this is just a UI preview using some horrible random dev fixtures, results are vastly better on real data)
After a minimum number of Posts, if a Topic lives in an in-scope Category, the plugin will send the topic text to an Open AI Large Language Model with a prompt and post the response, intended to be a summary of the contents which it succeeds in doing pretty well. There is a choice of model.
The summaries are often surprisingly good, occasionally sublime. However when one is not good enough, Iâve added a community downvoting mechanic to force a refresh of poor summaries after a set threshold.
Summaries are in any case re-sought when a set number of additional posts have been made.
You can modify the prompt and the thresholds
IMPORTANT NOTE: the summaries are never exposed to anon so the text will not be crawlable (you may or may not think this is a good thing, but at least the crawlers will only operate on your genuine human data).
Auto-tagging support:
Tired of tagging Topics? Let the AI do it for you! (Relatively intelligently!)
Sometimes the AI gets too creative despite the direction we are giving it here , so you can restrict it to the set of existing ones.
you can quickly create a non-admin user for this purpose from the rails console by using:
rake admin:create
(donât give this user admin priviliges)
(This is a bit of a hacky workaround because the current Discourse âinternal APIâ for tagging currently does not allow you to specify âno new tagsâ, so the only way of easily preventing this at present is by creating them as a user that does not have that privilege (ie trust level less that min_trust_to_create_tag
)
Limitations
Due to token limits, itâs only good for about 160 Posts max currently (model dependent!), so it will not include material in Posts after a certain point. That will almost certainly change in the future as the models get more powerful and the services more sophisticated.
Rate limits and costs
Retrieving data from Open AI is not free. However, rate limits are implicitly based on Posting. You have control on how many posts it takes before new summaries are sought. This is unlikely to be an issue.
Configuration
Please take a look through the settings, they should be pretty self explanatory. You will need a token from https://platform.openai.com/. The link is also in the settings.
To build with Chatbot or AI Topic Summary you need at least version 0.5.1 of the pgvector
postgres extension.
Most people will have at least this version already. However, occasionally some installs have an older version installed. This will prevent you building with an error similar to: PG::UndefinedObject: ERROR: access method "hnsw" does not exist
First make sure your container is running:
./launcher restart app
then enter your container
./launcher enter app
then go into the database and update the version of pgvector
:
:/var/www/discourse# su postgres -c 'psql discourse'
\dx
ALTER EXTENSION vector UPDATE;
\dx
exit
now leave the container with exit
You should now be able to rebuild.
Side âBarsâ support!!
Thereâs now a Bars compatible widget which ships with the plugin. You just have to install the Bars Theme Component and configure it:
Once installed you can turn off the standard top-of-topic summary and rely on the widget in the sidebar.
Notes
Disclaimer: Iâm not responsible for what the LLM responds with. Please understand the proâs and conâs of a LLM and what they are and arenât capable of and their limitations. They are very good at creating convincing, context aware, text but can be factually wrong.
Important Privacy Note: Your forum data is being sent to Open AI. Whilst it almost certainly wonât be incorporated into their pre-trained models, they will use the data in their analytics and logging. Be sure to add this fact into your forumâs TOS & privacy statements. Related links: Terms of use, Privacy policy
Copyright: Open AI made a statement about Copyright here: Will OpenAI claim copyright over what outputs I generate with the API? | OpenAI Help Center
TODO
- Add front & back tests
Add more user configuration to affect the style of responseAdd custom model name supportAdd GPT-4 support when availableMake the model setting a drop-down listAdd widget support for the Layouts plugin