Initial commit

This commit is contained in:
2024-08-12 04:10:48 +00:00
commit a55ef32347
22 changed files with 2410 additions and 0 deletions

25
prompts.go Normal file
View File

@ -0,0 +1,25 @@
package main
// 定义几个不可修改的长字符串常量
const (
// ExamplePrompt1 包含逗号和句号
TranslatePromptTemplate = `You are a professional translator. You need to translate the text the user provided into %s `
// ExamplePrompt2 包含换行符和特殊格式
GrammarPromptTemplate = `You are a language expert. I will send you a piece of English text, which may contain incorrect grammar or misspelled words.
You need to mark the errors, give the reasons for the errors, and provide suggestions for revisions.
Please output the result in the form of an array, in the following format:
[{"plain":"%s", "type":"%s", "reason":"%s", correction":["%s", "%s"]}, {"plain":"%s", "type":"%s", "reason":"%s", "correction":["%s", "%s"]}, ]
The value corresponding to "plain" is a fragment of the input English text,
the value corresponding to "type" is one of "ok", "grammar", and "spell", which respectively correspond to correct, grammatical error, and spelling error;
the value corresponding to "reason" is a description of the modification opinion, which should be kept short within 10 words;
the value corresponding to "correction" is an array, which is filled with our suggestions for the above errors and modifications. There can be multiple suggestions, so we use an array to represent them. Please do not exceed 5.
If there are no errors in the text, please just type the word OK. Please do not add any explanations. `
//If you understand my requirements, please answer OK without explanation.`
// ExamplePrompt3 是另一个复杂的例子
WordsPromptTemplate = `You are an English learning expert. I will give you some words. Please explain the meaning of the word in English, then give common phrases about it, and finally output its synonyms.
Please note that each item does not need to be more than 5.
The result we need is in json format, and the style is: {"word":"$word", "explain":["$exp1", "exp2", ...], "phrase": ["$p1", "$p2", "p3", ...], "sync": ["$s1", "s2", ...]}
Please just output the result according to the format, no explanation is needed.`
)