降低缺键概率
This commit is contained in:
@@ -191,7 +191,7 @@ class Agent:
|
||||
should_retry = True
|
||||
# 专门捕获部分翻译错误(软错误)
|
||||
except PartialAgentResultError as e:
|
||||
# print(f"【测试】\nprompt:\n{prompt}\nresp:\n{result}")
|
||||
print(f"【测试】\nprompt:\n{prompt}\nresp:\n{result}")
|
||||
self.logger.error(f"收到部分返回结果,将尝试重试: {e}")
|
||||
current_partial_result = e.partial_result
|
||||
should_retry = True
|
||||
|
||||
@@ -39,31 +39,32 @@ class SegmentsTranslateAgent(Agent):
|
||||
- For personal names and proper nouns, use the most commonly used words for translation.
|
||||
- For special tags or other non-translatable elements (like codes, brand names, specific jargon), keep them in their original form.
|
||||
- If a segment is already in the target language({config.to_lang}), keep it as is.
|
||||
- Do not merge multiple segment translations into one translation.
|
||||
- (very important) All keys that appear in the input JSON must exist in the output JSON.
|
||||
# Output
|
||||
- The translated sequence of segments, represented as JSON text (note: not a code block). The keys are the segment IDs, and the values are the translated segments.
|
||||
- The response must be a JSON object(indent=0) with the following structure:
|
||||
- The response must be a JSON object with the following structure:
|
||||
{{
|
||||
"<segment_id>": "<translation>"
|
||||
}}
|
||||
- (very important) The segment IDs in the output must exactly match those in the input. And all segment IDs in input must appear in the output.
|
||||
- All keys that appear in the input JSON must exist in the output JSON.
|
||||
# Example(Assuming the target language is Chinese in the example, {config.to_lang} is the actual target language)
|
||||
# Example(Assuming the target language is English in the example, {config.to_lang} is the actual target language)
|
||||
## Input
|
||||
{{
|
||||
"10": "Tom say:\"hello\"",
|
||||
"11": "apple",
|
||||
"12": true,
|
||||
"13": "false",
|
||||
"14": null
|
||||
}}
|
||||
## Correct Output
|
||||
{{
|
||||
"10": "汤姆说:“你好”",
|
||||
"11": "苹果",
|
||||
"12": true,
|
||||
"13": "错误",
|
||||
"14": null
|
||||
}}
|
||||
## Correct Output
|
||||
{{
|
||||
"10": "Tom say:\"hello\"",
|
||||
"11": "apple",
|
||||
"12": true,
|
||||
"13": "false",
|
||||
"14": null
|
||||
}}
|
||||
"""
|
||||
self.custom_prompt = config.custom_prompt
|
||||
if config.custom_prompt:
|
||||
|
||||
Reference in New Issue
Block a user