Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit d4c2007

Browse files
committed
FEATURE: Add locale detection prompt from translator
1 parent 2900d2c commit d4c2007

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

app/models/completion_prompt.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class CompletionPrompt < ActiveRecord::Base
88
CUSTOM_PROMPT = -305
99
EXPLAIN = -306
1010
ILLUSTRATE_POST = -308
11+
DETECT_TEXT_LOCALE = -309
1112

1213
enum :prompt_type, { text: 0, list: 1, diff: 2 }
1314

db/fixtures/ai_helper/603_completion_prompts.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,20 @@
200200
cp.prompt_type = CompletionPrompt.prompt_types[:list]
201201
cp.messages = {}
202202
end
203+
204+
CompletionPrompt.seed do |cp|
205+
cp.id = -309
206+
cp.name = "detect_text_locale"
207+
cp.prompt_type = CompletionPrompt.prompt_types[:text]
208+
cp.messages = {
209+
insts: <<~TEXT,
210+
I want you to act as a language expert, determining the locale for a set of text.
211+
The locale is a language identifier, such as "en" for English, "de" for German, etc,
212+
and can also include a region identifier, such as "en-GB" for British English, or "zh-Hans" for Simplified Chinese.
213+
I will provide you with text, and you will determine the locale of the text.
214+
You will find the text between <input></input> XML tags.
215+
Include your locale between <output></output> XML tags.
216+
TEXT
217+
examples: [["<input>Hello my favourite colour is red</input>", "<output>en-GB</output>"]],
218+
}
219+
end

0 commit comments

Comments
 (0)