Comments (1)
附:个人目前使用的 Prompt:
System prompt
You are a professional, authentic translation engine.
Policy:
- Input are multi-document YAML-formatted text. The first and second document are example request and response, and the last document is the actual request you need to translate. Your response should continue the YAML documents to provide translation of the last request document.
- Each response's element should be the translation of
{{imt_source_field}}
field in request's element according to itsid
, with target language specified intranslate-to
field in comment.- Request texts are picked from same source (e.g. a website, or video subtitle), you can try to take them as a whole for better understanding of the context, but response's YAML list length must be the same as request's YAML list length.
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}}
设计考量
- 输入是完全符合语法规范的 Mutli-document YAML。GPT也将据此输出符合语法规范的YAML格式。
- 上下文语义信息通过 YAML 注释进行添加。这可以不破坏 YAML 的语法结构,并且 GPT 输出/复读上下文信息时也会写在注释里面,从而不会干扰沉浸式翻译的 YAML 解析(这些上下文注释会被丢弃掉)。
- 遵循 ChatGPTNextWeb/ChatGPT-Next-Web#138 中的规范,提供了样例的输入/输出 YAML 文档作为 Few Shot。这样可以:
- 通过提供样例对话,进一步规范 GPT 的输出格式;
- 可以支持用户提供自定义的例句翻译参考,从而使 GPT 提供更符合特定知识领域/用户风格喜好的翻译结果。
- 在样例回复中,这个 Prompt 让 GPT 复读了上下文注释,并修改了若干字段,如
type: source
->type: translation
,translate-to: Simplified Chinese Language
->translate-to: 简体中文
)。这刷新了 GPT 上下文信息的距离,避免原文太长 GPT 可能忘了最初的上下文信息导致乱输出。并且让 GPT 在正式输出翻译前输出“简体中文”几个字,使其在后面翻译不会输出英文/日文原文。
P.S 如果沉浸式翻译能按照 ChatGPTNextWeb/ChatGPT-Next-Web#138 的设计,给用户提供例句和例答的设置框用以提供样例对话就更好了。发给 GPT 的对话流如下:
- System Prompt
- User Prompt 1 (例句原文输入)
- Assitant Prompt 1 (例句译文输出)
- User Prompt 2 (真正的原文输入)
支持本 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}} -> 简体中文
from immersive-translate.
Related Issues (20)
- [Bug]: 有时点击选项没有任何反应。 HOT 4
- [Bug]: 触屏平台点击翻译图标交互逻辑不正确 HOT 2
- xml等文件中底部有大量样式 HOT 3
- Orion浏览器支持
- [Bug]: 点击翻译后,每次都会自动开启“总是翻译该网站”的选项 HOT 2
- 🔴 添加将字幕样式作用于简繁字幕的功能 HOT 8
- [Bug]: 有的网站点翻译只翻译左侧目录,不翻译正文 HOT 5
- Generate smart subtitles powered by AI such as Whisper(OpenAI) HOT 1
- 增加自定义词库/术语表功能 HOT 5
- ### 新功能 | New Feature HOT 1
- Roman Urdu Translation Integration 🙏 HOT 4
- 最新版本插件PDF翻译时一页英文后面会有三页同样的中文 HOT 1
- Cancel or collapse the taskbar in the PDF function HOT 5
- 1.5.8更新后chrome翻译pdf上方的bar太占屏幕空间 HOT 4
- [Bug]: service Worker(无效),插件失效 HOT 10
- 适配Chrome浏览器新推出的Google 学术搜索 PDF 阅读器
- 🔴 关于「阿里云百炼大模型」和「DeepSeek」使用「AI 专家」的问题,以及一些功能上的建议 HOT 5
- 百度千帆大模型究竟如何配置?验证成功但无法调用 HOT 1
- 🔴 [Bug]: 在「阿里云百炼大模型」下会出现字幕漏翻的问题 HOT 3
- [Bug]: 调用百度大模型失败 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from immersive-translate.