mirror of
https://github.com/xfgryujk/blivechat.git
synced 2024-12-27 13:20:29 +08:00
优化Gemini提示词
This commit is contained in:
parent
8c3d62d08d
commit
0d7f847dc8
@ -164,7 +164,7 @@ class AppConfig:
|
|||||||
translator_config['proxy'] = section['proxy']
|
translator_config['proxy'] = section['proxy']
|
||||||
translator_config['api_key'] = section['api_key']
|
translator_config['api_key'] = section['api_key']
|
||||||
translator_config['model_code'] = section['model_code']
|
translator_config['model_code'] = section['model_code']
|
||||||
translator_config['prompt'] = section['prompt']
|
translator_config['prompt'] = section['prompt'].replace('\n', ' ').replace('\\n', '\n')
|
||||||
translator_config['temperature'] = section.getfloat('temperature')
|
translator_config['temperature'] = section.getfloat('temperature')
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'Invalid translator type: {type_}')
|
raise ValueError(f'Invalid translator type: {type_}')
|
||||||
|
@ -170,19 +170,23 @@ api_key =
|
|||||||
# 模型代码
|
# 模型代码
|
||||||
model_code = models/gemini-1.0-pro
|
model_code = models/gemini-1.0-pro
|
||||||
# 提示词
|
# 提示词
|
||||||
prompt = As an advanced translation software, your role is to provide accurate translations
|
prompt = As an advanced translation software, your role is to provide accurate translations that respect
|
||||||
that respect the original content's meaning and tone. If the input text includes brackets,
|
the original content's meaning and tone.
|
||||||
ensure that these are retained in the translation. Aim to deliver the translated text in a
|
Ensure that texts between brackets "[]" are kept untranslated.
|
||||||
polite and gentle tone, as per the preferences of the audience.\n\nBelow are some examples
|
Aim to deliver the translated text in a polite and gentle tone, as per the preferences of the audience.\n\n
|
||||||
to guide you:\n\nExamples:\nInput1:\n来拉(莱拉) 设置一下吧\nOutput1:\nライラちゃん、設定してみましょうか。
|
Below are some examples to guide you:\n\n
|
||||||
\n\nInput2:\n我来拉一下各位进队伍\nOutput2:\n皆さんをチームに入れさせていただきます。\n\nInput3:\n死了w\n
|
Input1:\n来拉(莱拉)设置一下吧\nOutput1:\nライラちゃん、設定してみましょうか\n\n
|
||||||
Output3:\n死んじゃったわw\n\nInput4:\n每天来宝这里打个卡\nOutput4:\n毎日、ここに来て宝さんにチェックインしま
|
Input2:\n我来拉一下各位进队伍\nOutput2:\n皆さんをチームに入れさせていただきます\n\n
|
||||||
\n\n\nPlease keep in mind that accurate translation is not just about linguistic conversion;
|
Input3:\n死了w\nOutput3:\n死んじゃったわw\n\n
|
||||||
it is about conveying the same sentiment and meaning as the original input. Pay special
|
Input4:\n每天来宝这里打个卡[比心]\nOutput4:\n毎日、ここに来て宝さんにチェックインしま[比心]\n\n
|
||||||
attention to internet vernaculars and colloquial expressions to maintain the nuances of the
|
\n
|
||||||
source language.\n\nNow, proceed with the translation of the following Chinese comment text
|
Please keep in mind that accurate translation is not just about linguistic conversion;
|
||||||
into Japanese, ensuring accuracy and preservation of the original message:\nInput:\n
|
it is about conveying the same sentiment and meaning as the original input.
|
||||||
{{original_text}}\nOutput ONLY:\n
|
Pay special attention to internet vernaculars and colloquial expressions to maintain the nuances of the
|
||||||
|
source language.\n\n
|
||||||
|
Now, proceed with the translation of the following Chinese comment text into Japanese, ensuring accuracy
|
||||||
|
and preservation of the original message:\n
|
||||||
|
Input:\n{{original_text}}\nOutput ONLY:\n
|
||||||
# 温度,用于控制令牌选择的随机性,较低的温度适合需要更具确定性或不够开放的回答的提示,而较高的温度可以产生更加多样化或更具创意的结果
|
# 温度,用于控制令牌选择的随机性,较低的温度适合需要更具确定性或不够开放的回答的提示,而较高的温度可以产生更加多样化或更具创意的结果
|
||||||
temperature = 0.4
|
temperature = 0.4
|
||||||
|
|
||||||
|
@ -688,7 +688,7 @@ class GeminiTranslate(TranslateProvider):
|
|||||||
self._proxy = proxy or None
|
self._proxy = proxy or None
|
||||||
self._api_key = api_key
|
self._api_key = api_key
|
||||||
self._url = f'https://generativelanguage.googleapis.com/v1beta/{model_code}:generateContent'
|
self._url = f'https://generativelanguage.googleapis.com/v1beta/{model_code}:generateContent'
|
||||||
self._prompt = prompt.replace('\n', ' ').replace('\\n', '\n')
|
self._prompt = prompt
|
||||||
self._body = {
|
self._body = {
|
||||||
'contents': [
|
'contents': [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user