Discourse Chatbot 🤖 (Now smarter than ChatGPT!*)

@kuaza to save you some time, here’s what you need to do:

  • make sure setting chatbot include inner thoughts in private messages is ON
  • ssh into your server
  • cd /var/discourse/shared/standalone/log/rails
  • in parallel upload an image in a PM and ask the bot something about it
  • go back to console immediately
  • tail -n 2000 production.log | grep {\"type\":\"image_url\"
  • you should see in result something like ,{"type":"image_url","image_url":{"url":"https://mysite.com/uploads/default/original/2X/b/b450e963a7e5c9515533940a40b2a3bec37d.jpeg"}}]}
  • Control-click on image url in the result and confirm it loads. If not share the URL with me, it might not be well formed. If you can’t control click copy and paste into browser to check validity of URL. Let me know if the image loads.
  • Also share with me the text in “inner thoughts”
  • Confirm which chatbot_support_vision setting you are using via_function or directly

I’ve already noticed the prompts for vision function might be improved but I’m not convinced that’s your issue. I’ll know more when you revert with that info.

1 Like

This is very interesting, I tried it after configuring cdn s3 and it worked without any problems. I think the problem is related to the image url. Thank you for your time, I activated it again, I look forward to its development.

1 Like

Hi @merefield,

I’m encountering an issue while trying to install the plugin. The installation process fails during the database migration step, and the following errors are logged:

Initial Error during Migration:

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 688 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "tag"=>"migrate", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1

Specific PostgreSQL Error:

rake aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
PG::UndefinedObject: ERROR:  access method "hnsw" does not exist

Could you provide any insights or requirements related to this plugin, especially concerning the PostgreSQL setup? Additionally, is there anything specific that I need to adjust in the app.yml file or elsewhere to ensure a successful installation?

Thank you for your assistance.

Best regards,
Bogdan R.

1 Like

Probably means your pgvector extension is not up to date on your database.

It is a surprising error.

Can you tell me the version of pgvector you are running?

Seems to be 0.4.2

2 Likes

That’s the issue. You need at least 0.5.1.

If you are comfortable with running SQL:

ALTER EXTENSION vector UPDATE;

Will do the trick

2 Likes

A cost-saving feature request:
Could chatbot plugin use the embeddings generated by discourse-ai plugin?

1 Like

The reason they are separate is two-fold:

  • I’ve been retaining discretion to explore my own strategy here and evolve the plugin independently
  • Discourse AI was using a different granularity for a long time I believe.

Not something I have any bandwidth for unfortunately. Might consider a PR providing that as an option but suspect that’s a lot of work.

I suspect hard to justify from a cost and time perspective as embeddings are so cheap and quick to generate (relatively to the actual completions calls?)

2 Likes

Hello, I have installed it and I am testing it, and although it works, I have a problem.

My text is in Spanish and the bot responds in English, how can I change the language so that it also responds in Spanish?

Try changing the system prompt. Add something like “answer in the same language as the question” or “answer in Spanish”. Note there are four system prompts. Two each for private and public messages.

1 Like

Hello friend, thank you very much for your response. where do I make that prompt? I am using it to respond to topic messages automatically, and I cannot write that prompt in each topic individually. In the settings, I can’t find the option to add that prompt

Hence the “System Prompt”

See “Prompt Engineering” in the OP

All modified in Admin → Customize → Text
…

I have put System Prompt or Prompt Engineering in the search engine of the section that indicates (All modified in Admin → Customize → Text
) and shows no result; However, if I enter “Prompt”, many results appear; Would you know which one I try? since I would not want the forum to be damaged by editing the invalid file

(many more come out, those are an example)

chatbot.prompt.system. (as per OP)

The rest depends if rag or basic and in open or private

I’m still trying, since I changed both this file and others, and it still appears in English.
It should be noted that I want it to respond to posts on new topics created.

1 Like

@MarcP suggests:

“Always respond in the same language as the user” Or “Make sure to always respond in Spanish”

(apparently being more forceful helps)

This worked for me:

“Always respond in French” (in my case, French)

as last sentence in System Prompt.

Make sure you have changed the right system prompt (rag/basic, open/private)

You could translate the entire system prompt into Spanish … the more Spanish might help (also credit @MarcP )

I just fixed it, apparently I not only had to edit the file in Spanish, but I also edited it in English, and then when I tested it it worked.

1 Like

Perfecto! :slight_smile:

That’s interesting.

I’m expecting it to use the “default language” when it picks the language.

That’s odd that it chooses the english translations on a Spanish install.

Because I’m a one-man dev on this I chose to use the text customisation system as this provides an out of the box way of allowing end user admins to be able to change this text. This adds a little bit of confusion, thanks for your patience.

System prompts should be written in english. Same or similar situation than with DallE — otherwise prompt will be translated in english on OpenAI’s end and it may, or will, change to something really diffrent.

I used this, but it will change because I have plan to use Chatbot bit differently.

You are a helpful assistant. You have great tools in the form of functions that give you the power to get newer information. Only use the functions you have been provided with. The current date and time is %{current_date_time}. When referring to users by name, include an @ symbol directly in front of their username. Only respond to the last question, using the prior information as context, if appropriate. Use finnish everytime it is possible. Please provide concise and informative responses to user inquiries. Use available resources, including local forum content and external tools, to gather information. Responses should be limited to a maximum of four paragraphs without unnecessary introductions, greetings, or fillers. Ensure answers are relevant and helpful, akin to forum responses.

2 Likes