-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
向 OpenAI 翻译服务中提供更多的上下文信息 #1715
Labels
Comments
附:个人目前使用的 Prompt: System prompt
User prompt# type: source
# scenario: Website Paragraphs
# translate-to: Simplified Chinese Language
- id: 1
{{imt_source_field}}: Translate all `{{imt_source_field}}` fields and write the translation result into the `{{imt_trans_field}}` field.
- id: 2
{{imt_source_field}}: If the image has not been updated in the target registry, the cached image is served from the proxy cache project.
- id: 3
{{imt_source_field}}: Monocle will be implemented as a native layout using stacking as its backing implementation.
---
# type: translation
# scenario: Website Paragraphs
# translate-to: 简体中文
- id: 1
{{imt_trans_field}}: 翻译所有`{{imt_source_field}}`字段,并将翻译结果写入`{{imt_trans_field}}`字段。
- id: 2
{{imt_trans_field}}: 如果镜像在目标注册表中未更新,则通过代理缓存项目提供缓存的镜像。
- id: 3
{{imt_trans_field}}: Monocle 将实现为原生布局,使用 Stacking 作为其底层实现。
---
# type: source
# scenario: Website Paragraphs
# translate-to: {{to}}
{{yaml}} 设计考量
P.S 如果沉浸式翻译能按照 ChatGPTNextWeb/ChatGPT-Next-Web#138 的设计,给用户提供例句和例答的设置框用以提供样例对话就更好了。发给 GPT 的对话流如下:
支持本 Issue 的功能后的 User Prompt# type: source
# scenario: Website Paragraphs -> 在字幕里是 Video Subtitle
# host: {{host}} -> github.com
# title: {{title}} -> '向 OpenAI 翻译服务中提供更多的上下文信息 · Issue #1715 · immersive-translate/immersive-translate'
# translate-to: {{to}} -> 简体中文 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
您希望的更新和改进是什么 | Update or Improve
目前的 OpenAI 服务中支持
{{ }}
插值语法插入若干动态信息,这是一个非常好的用来自定义更强大的 Prompt 的工具。因此,希望沉浸式翻译可以支持在模板中提供更多的原文/源网页信息,让 GPT 可以更好地定位到上下文从而提高翻译质量。
补充说明 | Additional context
我目前在使用体验中总结出的几个应该会很有用的上下文信息:
网页的 Host / URL
将当前翻译的网页域名提供给 GPT,使其能根据域名定位到译文所应在的知识领域。例如,将
github.com
提供给 prompt,GPT 可以知道译文中有计算机相关专业术语,按照开发者的理解进行翻译(如 native -> 原生,而非本地)。网页的 Title
在新闻类和论坛类网站中(例如雅虎、reddit等等),网页的标题能很好地约束译文所在的上下文;并且在翻译中间段落时,标题也能作为全局信息让 GPT 更不容易偏题。
使用目标语言(而非英语)表示的
目标语言
字段目前,
{{to}}
字段返回的是用英语表示的目标语言,如简体中文返回Simplified Chinese
/Simplified Chinese Language
。这导致发送给 GPT 的原文 user prompt 中,完全不包含目标语言的文字。在翻译一些日文网站时,我发现 GPT 3.5 有时会输出英文翻译,有时会直接输出日文原文不翻译。一定程度上这可能是因为原 Prompt 中不包含任何中文汉字造成的。如果
{{ to }}
字段(或一个新字段,然后两个字段可以在样例原文/翻译中结合使用)能插值为用目标语言表示的文字(如简体中文
、日本語
),那么就可以为 GPT 的 prompt 添加一定目标语言的上下文信息。The text was updated successfully, but these errors were encountered: