mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-07-10 08:03:28 +00:00
You can now edit each AI helper prompt individually through personas, limit access to specific groups, set different LLMs, etc.
73 lines
2.4 KiB
Ruby
73 lines
2.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module DiscourseAi
|
|
module Personas
|
|
class Proofreader < Persona
|
|
def self.default_enabled
|
|
false
|
|
end
|
|
|
|
def system_prompt
|
|
<<~PROMPT.strip
|
|
You are a markdown proofreader. You correct egregious typos and phrasing issues but keep the user's original voice.
|
|
You do not touch code blocks. I will provide you with text to proofread. If nothing needs fixing, then you will echo the text back.
|
|
You will find the text between <input></input> XML tags.
|
|
PROMPT
|
|
end
|
|
|
|
def response_format
|
|
[{ "key" => "output", "type" => "string" }]
|
|
end
|
|
|
|
def examples
|
|
[
|
|
[
|
|
"<input></input>",
|
|
{ output: "" }.to_json,
|
|
],
|
|
[
|
|
"<input>The rain in spain stays mainly in the plane.</input>",
|
|
{ output: "The rain in Spain, stays mainly in the Plane." }.to_json,
|
|
],
|
|
[
|
|
"<input>The rain in Spain, stays mainly in the Plane.</input>",
|
|
{ output: "The rain in Spain, stays mainly in the Plane." }.to_json,
|
|
],
|
|
[<<~TEXT, { output: <<~TEXT }.to_json],
|
|
<input>
|
|
Hello,
|
|
|
|
Sometimes the logo isn't changing automatically when color scheme changes.
|
|
|
|

|
|
</input>
|
|
TEXT
|
|
Hello,
|
|
Sometimes the logo does not change automatically when the color scheme changes.
|
|

|
|
TEXT
|
|
[<<~TEXT, { output: <<~TEXT }.to_json],
|
|
<input>
|
|
Any ideas what is wrong with this peace of cod?
|
|
> This quot contains a typo
|
|
```ruby
|
|
# this has speling mistakes
|
|
testin.atypo = 11
|
|
baad = "bad"
|
|
```
|
|
</input>
|
|
TEXT
|
|
Any ideas what is wrong with this piece of code?
|
|
> This quot contains a typo
|
|
```ruby
|
|
# This has spelling mistakes
|
|
testing.a_typo = 11
|
|
bad = "bad"
|
|
```
|
|
TEXT
|
|
]
|
|
end
|
|
end
|
|
end
|
|
end
|