FEATURE: Add a markdown table AI helper (#25)
This commit is contained in:
parent
1916bafca0
commit
1d14f7ffaf
|
@ -50,7 +50,7 @@ en:
|
|||
reasons:
|
||||
flagged_by_toxicity: The AI plugin flagged this after classifying it as toxic.
|
||||
flagged_by_nsfw: The AI plugin flagged this after classifying at least one of the attached images as NSFW.
|
||||
|
||||
|
||||
errors:
|
||||
prompt_message_length: The message %{idx} is over the 1000 character limit.
|
||||
invalid_prompt_role: The message %{idx} has an invalid role.
|
||||
|
@ -61,3 +61,4 @@ en:
|
|||
translate: Translate to English
|
||||
generate_titles: Suggest topic titles
|
||||
proofread: Proofread text
|
||||
markdown_table: Generate Markdown table
|
||||
|
|
|
@ -80,3 +80,42 @@ CompletionPrompt.seed do |cp|
|
|||
TEXT
|
||||
]
|
||||
end
|
||||
|
||||
CompletionPrompt.seed do |cp|
|
||||
cp.id = -4
|
||||
cp.name = "markdown_table"
|
||||
cp.prompt_type = CompletionPrompt.prompt_types[:diff]
|
||||
cp.messages = [
|
||||
{ role: "system", content: <<~TEXT },
|
||||
You are a markdown table formatter, I will provide you text and you will format it into a markdown table
|
||||
TEXT
|
||||
{ role: "user", content: "sam,joe,jane\nage: 22| 10|11" },
|
||||
{ role: "assistant", content: <<~TEXT },
|
||||
| | sam | joe | jane |
|
||||
|---|---|---|---|
|
||||
| age | 22 | 10 | 11 |
|
||||
TEXT
|
||||
{ role: "user", content: <<~TEXT },
|
||||
sam: speed 100, age 22
|
||||
jane: age 10
|
||||
fred: height 22
|
||||
TEXT
|
||||
{ role: "assistant", content: <<~TEXT },
|
||||
| | speed | age | height |
|
||||
|---|---|---|---|
|
||||
| sam | 100 | 22 | - |
|
||||
| jane | - | 10 | - |
|
||||
| fred | - | - | 22 |
|
||||
TEXT
|
||||
{ role: "user", content: <<~TEXT },
|
||||
chrome 22ms (first load 10ms)
|
||||
firefox 10ms (first load: 9ms)
|
||||
TEXT
|
||||
{ role: "assistant", content: <<~TEXT },
|
||||
| Browser | Load Time (ms) | First Load Time (ms) |
|
||||
|---|---|---|
|
||||
| Chrome | 22 | 10 |
|
||||
| Firefox | 10 | 9 |
|
||||
TEXT
|
||||
]
|
||||
end
|
||||
|
|
|
@ -6,7 +6,8 @@ module DiscourseAi
|
|||
TRANSLATE = "translate"
|
||||
GENERATE_TITLES = "generate_titles"
|
||||
PROOFREAD = "proofread"
|
||||
VALID_TYPES = [TRANSLATE, GENERATE_TITLES, PROOFREAD]
|
||||
MARKDOWN_TABLE = "markdown_table"
|
||||
VALID_TYPES = [TRANSLATE, GENERATE_TITLES, PROOFREAD, MARKDOWN_TABLE]
|
||||
|
||||
def available_prompts
|
||||
CompletionPrompt
|
||||
|
|
|
@ -9,7 +9,7 @@ module ::DiscourseAi
|
|||
"Content-Type" => "application/json",
|
||||
}
|
||||
|
||||
connection_opts = { request: { write_timeout: 10, read_timeout: 10, open_timeout: 10 } }
|
||||
connection_opts = { request: { write_timeout: 60, read_timeout: 60, open_timeout: 60 } }
|
||||
|
||||
response =
|
||||
Faraday.new(nil, connection_opts).post(
|
||||
|
|
Loading…
Reference in New Issue