// ==UserScript==
// @name openai.com汉化
// @namespace Violentmonkey Scripts
// @match https://*.openai.com/*
// @grant none
// @version 1.0
// @author -
// @description 汉化界面的部分菜单及内容
// @author sec
// @namespace https://t.me/KingRan_qun
// ==/UserScript==
(function() {
'use strict';
const i18n = new Map([
['To-Do', '待办事项'],
['Welcome to ChatGPT', '欢迎来到ChatGPT'],
['Log in with your OpenAI account to continue', '用您的OpenAI账户登录以继续'],
['Log in', '登录'],
['Sign up', '注册'],
['You need an OpenAI account', '您需要一个OpenAI账户'],
['You must have an OpenAI account to use ChatGPT. If you don\'t have one, sign up now and return to chat.openai.com to log in and continue.', '您必须有一个OpenAI账户才能使用ChatGPT。如果您还没有,现在就注册,然后返回chat.openai.com登录并继续。'],
['Create an OpenAI account', '创建一个OpenAI账户'],
['Cancel', '取消'],
['Create your account', '创建您的账户'],
['Email address', '电子邮件地址'],
['Enter the code shown above', '输入上面显示的代码'],
['Continue', '继续'],
['Already have an account? Log in', '已经有了一个账户?请登录'],
['Continue with Google', '继续使用谷歌'],
['Continue with Microsoft Account', '继续使用微软账户'],
['with Google', '用谷歌'],
['with Microsoft Account', '使用微软账户'],
['Already have an account?', '已经有了一个账户?'],
['Not available', '不可用'],
['OpenAI\'s services are not available in your country.', 'OpenAI的服务在您的国家无法使用。'],
['Create Your Account', '创建您的账户'],
['PasswordShow passwordShow password', '密码显示密码显示密码'],
['Your password must contain:', '您的密码必须包含。'],
['At least 8 characters', '至少有8个字符'],
['Verify your email', '验证您的电子邮件'],
['We sent an email to ', '我们发送了一封电子邮件给 '],
['Click the link inside to get started.', '点击里面的链接即可开始。'],
['Open Gmail', '打开Gmail'],
['Resend email', '重新发送电子邮件'],
['Tell us about you', '告诉我们你的情况'],
['First name', '名'],
['Last name', '姓氏'],
['Organization name', '组织名称'],
['By clicking \"Continue\", you agree to our Terms and confirm you\'re 18 years or older.', '通过点击继续,你同意我们的条款,并确认你是18岁或以上。'],
['Enter code', '输入代码'],
['Please enter the code we just sent you.', '请输入我们刚刚发给你的代码。'],
['How will you primarily use OpenAI?', '您将主要如何使用OpenAI?'],
['I\'m building a product or feature', '我正在构建一个产品或功能'],
['I\'m exploring personal use', '我在探索个人使用'],
['I\'m conducting AI research', '我正在进行人工智能研究'],
['I\'m a journalist or content creator', '我是一名记者或内容创作者'],
['Overview', '概况'],
['Documentation', '文档'],
['Examples', '实例'],
['Playground', '游戏场'],
['Introducing ChatGPT research release', '介绍ChatGPT研究版本'],
['Welcome to OpenAI', '欢迎来到OpenAI'],
['Start with the basics', '从基础知识开始'],
['Quickstart tutorial', '快速入门教程'],
['Learn by building a quick sample app', '通过建立一个快速样本应用程序来学习'],
['Explore some example tasks', '探索一些示例任务'],
['Build an application', '构建一个应用程序'],
['We no longer require you to register your applications with OpenAI.', '我们不再要求您向OpenAI注册您的应用程序。'],
['Text completion', '文本完成'],
['Generate and edit text', '生成和编辑文本'],
['Code completionLimited beta', '代码补全有限的测试版'],
['Generate, edit, and explain code', '生成、编辑和解释代码'],
['Image generationBeta', '图像生成Beta版'],
['Generate and edit images', '生成和编辑图像'],
['Fine-tuning', '微调'],
['Train a model for your use case', '为你的用例训练一个模型'],
['Embeddings', '嵌入系统'],
['Search, classify, and compare text', '搜索、分类和比较文本'],
['Help center', '帮助中心'],
['Answers to frequently asked questions.', '对常见问题的回答。'],
['Visit help center', '访问帮助中心'],
['Community', '社区'],
['Ask questions and discuss topics with other developers.', '提出问题并与其他开发者讨论主题。'],
['Visit community', '访问社区'],
['Meet ambassadors', '认识大使'],
['Support', '支持服务'],
['Get in touch with an OpenAI support specialist.', '与OpenAI的支持专家取得联系。'],
['Chat with us', '与我们聊天'],
['Upgrade', '升级'],
['Personal', '个人'],
['Try it', '试试吧'],
['Read more', '阅读更多'],
['Manage account', '管理账户'],
['View API keys', '查看API密钥'],
['Invite team', '邀请团队'],
['Help', '帮助'],
['Pricing', '价格'],
['Terms & policies', '条款和政策'],
['Log out', '登出'],
['Could not fetch usage for this organization, if this issue persists please contact us through our help center at help.openai.com.', '无法获取该组织的使用情况,如果这个问题持续存在,请通过我们的帮助中心help.openai.com联系我们。'],
['Usage', '使用情况'],
['Below you\'ll find a summary of API usage for your organization. All dates and times are UTC-based, and data may be delayed up to 5 minutes.', '下面你会发现你的组织的API使用情况的摘要。所有的日期和时间都是基于UTC的,数据可能会延迟5分钟。'],
['December', '十二月'],
['DAILY', '每日'],
['CUMULATIVE', '累计'],
['Daily usage', '每日使用量'],
['Aggregate daily usage is not available before March 1st, 2022', '在2022年3月1日之前,每日累计使用量不可用。'],
['Free trial usage', '免费试用用量'],
['GRANT #', '补助金 # 授予的信用过期'],
['Daily usage breakdown ', '每日使用量分类 '],
['All org members', '所有组织成员'],
['Model usage', '模型使用量'],
['requests', '请求'],
['API keys', 'API密钥'],
['Your secret API keys are listed below. Please note that we do not display your secret API keys again after you generate them.', '你的秘密API密钥列在下面。请注意,在你生成API密匙后,我们不会再显示你的密匙。'],
['Do not share your API key with others, or expose it in the browser or other client-side code. In order to protect the security of your account, OpenAI may also automatically rotate any API key that we\'ve found has leaked publicly.', '请不要与他人分享您的API密钥,也不要在浏览器或其他客户端代码中曝光。为了保护您的账户安全,OpenAI也可能会自动旋转任何我们发现已经公开泄露的API密钥。'],
['You currently do not have any API keys. Please create one below.', '您目前没有任何API密钥。请在下面创建一个。'],
['Default organization', '默认组织'],
['If you belong to multiple organizations, this setting controls which organization is used by default when making', '如果您属于多个组织,此设置可以控制在使用上述API密钥时默认使用哪个组织。'],
['with the API keys above.', '使用上述API密钥时,默认使用哪个组织。'],
['Note: You can also specify which organization to use for each API request. ', '注意:你也可以为每个API请求指定使用哪个组织。'],
['Payment methods', '支付方式'],
['Billing history', '账单历史'],
['Preferences', '偏好'],
['Billing overview', '账单概览'],
['Free trial', '免费试用'],
['You are currently on the free trial. Head over to your', '您目前正处于免费试用阶段。请到您的'],
['page to view how many free trial credits are remaining on your account.', '页面,查看您的账户中还有多少免费试用点数。'],
['Payment methods', '付款方式'],
['Add or change payment method', '添加或更改付款方式'],
['Billing history', '账单历史'],
['View past and current invoices', '查看过去和当前的发票'],
['Set monthly spend limits', '设置每月支出限额'],
['Preferences', '首选项'],
['Manage company information', '管理公司信息'],
['View pricing and FAQs', '查看价格和常见问题'],
['GET STARTED', '开始吧'],
['Introduction', '介紹'],
['Key concepts', '关键概念'],
['Next steps', '接下来的步骤'],
['Libraries', '图书馆'],
['Models', '模型'],
['GUIDES', '指南'],
['Code completion', '代码完成'],
['Image generation', '图像生成'],
['Moderation', '微调'],
['Safety best practices', '安全的最佳实践'],
['Production best practices', '生产最佳实践'],
['API REFERENCE', 'API参考'],
['Introduction', '简介'],
['Authentication', '认证'],
['Models', '模型'],
['Completions', '完成'],
['Edits', '编辑'],
['Images', '图片'],
['Files', '档案'],
['Fine-tunes', '微调'],
['Moderations', '审校'],
['Engines', '引擎'],
['Parameter details', '参数详情'],
['Answer questions based on existing knowledge.', '在现有知识的基础上回答问题。'],
['Grammar correction', '语法纠正'],
['Corrects sentences into standard English.', '将句子纠正为标准英语。'],
['Summarize for a 2nd grader', '为二年级学生总结'],
['Translates difficult text into simpler concepts.', '将困难的文本翻译成更简单的概念。'],
['Natural language to OpenAI API', '自然语言到OpenAI API'],
['Create code to call to the OpenAI API using a natural language instruction.', '创建代码,使用自然语言指令调用OpenAI API。'],
['Text to command', '文本到命令'],
['Translate text into programmatic commands.', '将文本翻译成程序性指令。'],
['English to other languages', '英语到其他语言'],
['Translates English text into French, Spanish and Japanese.', '将英语文本翻译成法语、西班牙语和日语。'],
['Natural language to Stripe API', '自然语言到Stripe API'],
['Create code to call the Stripe API using natural language.', '创建代码以使用自然语言调用Stripe API。'],
['SQL translate', 'SQL翻译'],
['Translate natural language to SQL queries.', '将自然语言翻译成SQL查询。'],
['Parse unstructured data', '解析非结构化数据'],
['Create tables from long form text', '从长格式文本中创建表格'],
['Classification', '分类'],
['Classify items into categories via example.', '通过实例将项目分类。'],
['Python to natural language', '从Python到自然语言'],
['Explain a piece of Python code in human understandable language.', '用人类可理解的语言解释一段Python代码。'],
['Movie to Emoji', '电影到表情符号'],
['Convert movie titles into emoji.', '将电影标题转换为表情符号。'],
['Calculate Time Complexity', '计算时间复杂度'],
['Find the time complexity of a function.', '找到一个函数的时间复杂性。'],
['Translate programming languages', '翻译编程语言'],
['Translate from one programming language to another', '从一种编程语言翻译成另一种编程语言'],
['Advanced tweet classifier', '高级推文分类器'],
['Advanced sentiment detection for a piece of text.', '对一段文字进行高级情感检测。'],
['Explain code', '解释代码'],
['Explain a complicated piece of code.', '解释一段复杂的代码。'],
['Keywords', '关键词'],
['Extract keywords from a block of text.', '从一个文本块中提取关键词。'],
['Factual answering', '事实性回答'],
['Ad from product description', '从产品描述到广告'],
['Turn a product description into ad copy.', '将产品描述变成广告文案。'],
['Product name generator', '产品名称生成器'],
['Create product names from examples words. Influenced by a community prompt.', '从实例词中创建产品名称。受社区提示的影响。'],
['TL;DR summarization', 'TL;DR总结'],
['Summarize text by adding a \'tl;dr:\' to the end of a text passage. It shows that the API understands how to perform a number of tasks with no instructions.', '通过在文本段落的末尾添加tl;dr来总结文本。它表明API理解如何执行一些没有说明的任务。'],
['Python bug fixer', 'Python错误修复器'],
['Find and fix bugs in source code.', '查找并修复源代码中的错误。'],
['Spreadsheet creator', '电子表格创建器'],
['Create spreadsheets of various kinds of data. It\'s a long prompt but very versatile. Output can be copy+pasted into a text file and saved as a .csv with pipe separators.', '创建各种数据的电子表格。这是一个很长的提示,但用途非常广泛。输出可以复制+粘贴到文本文件中,并保存为带有管道分隔符的.csv。'],
['JavaScript helper chatbot', 'JavaScript助手聊天机器人'],
['Message-style bot that answers JavaScript questions', '回答JavaScript问题的消息式机器人'],
['ML/AI language model tutor', 'ML/AI语言模型辅导员'],
['Bot that answers questions about language models', '回答关于语言模型问题的机器人'],
['Science fiction book list maker', '科幻书单制作者'],
['Create a list of items for a given topic.', '为一个给定的主题创建一个项目列表。'],
['Tweet classifier', '推特分类器'],
['Basic sentiment detection for a piece of text.', '对一段文字进行基本的情感检测。'],
['Airport code extractor', '机场代码提取器'],
['Extract airport codes from text.', '从文本中提取机场代码。'],
['SQL request', 'SQL请求'],
['Create simple SQL queries.', '创建简单的SQL查询。'],
['Extract contact information', '提取联系信息'],
['Extract contact information from a block of text.', '从一个文本块中提取联系信息。'],
['JavaScript to Python', '将JavaScript转换为Python'],
['Convert simple JavaScript expressions into Python.', '将简单的JavaScript表达式转换成Python。'],
['Friend chat', '朋友聊天'],
['Emulate a text message conversation.', '模仿文本信息对话。'],
['Mood to color', '心情到颜色'],
['Turn a text description into a color.', '把文本描述变成一种颜色。'],
['Write a Python docstring', '写一个Python文档串'],
['An example of how to create a docstring for a given Python function. We specify the Python version, paste in the code, and then ask within a comment for a docstring, and give a characteristic beginning of a docstring', '一个如何为给定的Python函数创建一个文档串的例子。我们指定Python版本,粘贴代码,然后在注释中询问一个文档串,并给出一个文档串的特征开头'],
['Analogy maker', '类比生成器'],
['Create analogies. Modified from a community prompt to require fewer examples.', '创建类比。从社区提示中修改,要求减少例子。'],
['JavaScript one line function', 'JavaScript单行函数'],
['Turn a JavaScript function into a one liner.', '把一个JavaScript函数变成一个单行字。'],
['Micro horror story creator', '微型恐怖故事创建者'],
['Creates two to three sentence short horror stories from a topic input.', '从一个主题输入创建两到三句话的短篇恐怖故事。'],
['Third-person converter', '第三人称转换器'],
['Converts first-person POV to the third-person. This is modified from a community prompt to use fewer examples.', '将第一人称POV转换为第三人称。这是从社区提示中修改的,使用较少的例子。'],
['Notes to summary', '笔记到摘要'],
['Turn meeting notes into a summary.', '将会议记录变成摘要。'],
['VR fitness idea generator', 'VR健身创意生成器'],
['Create ideas for fitness and virtual reality games.', '创建健身和虚拟现实游戏的创意。'],
['ESRB rating', 'ESRB评级'],
['Categorize text based upon ESRB ratings.', '根据ESRB评级对文本进行分类。'],
['Essay outline', '作文提纲'],
['Generate an outline for a research topic.', '为一个研究课题生成一个大纲。'],
['Recipe creator ', '菜谱创建者 '],
['eat at your own risk', '自食其果'],
['Create a recipe from a list of ingredients.', '根据成分清单创建一个食谱。'],
['Chat', '聊天'],
['Open ended conversation with an AI assistant.', '与人工智能助手进行开放式对话。'],
['Marv the sarcastic chat bot', '讽刺性聊天机器人Marv'],
['Marv is a factual chatbot that is also sarcastic.', 'Marv是一个实事求是的聊天机器人,也会讽刺人。'],
['Turn by turn directions', '转弯指示'],
['Convert natural language to turn-by-turn directions.', '将自然语言转换为转弯指示。'],
['Restaurant review creator', '餐厅评论创建者'],
['Turn a few words into a restaurant review.', '将几句话变成餐厅评论。'],
['Create study notes', '创建学习笔记'],
['Provide a topic and get study notes.', '提供一个主题并获得学习笔记。'],
['Interview questions', '面试问题'],
['Guide the model towards factual answering by showing it how to respond to questions that fall outside its knowledge base. Using a', '通过向模型展示如何回答超出其知识库的问题,引导模型进行事实性回答。使用一个'],
['to indicate a response to words and phrases that it doesn\'t know provides a natural response that seems to work better than more abstract replies', '来表示对它不知道的单词和短语的回答,提供了一种自然的回答,似乎比更抽象的回答效果更好。'],
['Explore what\'s possible with some example applications', '通过一些应用实例探索可能的结果'],
['Get started', '开始吧'],
['Enter an instruction or select a preset, and watch the API respond with a ', '输入一个指令或选择一个预设,然后看着API响应一个 '],
['completion', '完成'],
['that attempts to match the context or pattern you provided.', '试图匹配你提供的上下文或模式。'],
['You can control which ', '你可以通过改变模型来控制哪个 '],
['completes your request by changing the model.', '来完成你的请求。'],
['KEEP IN MIND', '牢记'],
['Use good judgment when sharing outputs, and attribute them to your name or company. ', '在分享产出时要有良好的判断力,并将它们归于你的名字或公司。'],
['Learn more', '了解更多'],
['Requests submitted to our models may be used to train and improve future models. ', '提交给我们的模型的请求可能被用来训练和改进未来的模型。'],
['Our default models\' training data cuts off in 2021, so they may not have knowledge of current events.', '我们默认模型的训练数据在2021年截止,因此它们可能不了解当前的事件。'],
['Write a tagline for an ice cream shop', '为一家冰淇淋店写标语'],
['Load a preset', '加载一个预设'],
['Mode', '模式'],
['Temperature', '溫度'],
['Maximum length', '最大长度'],
['Stop sequences', '停止序列'],
['Enter sequence and press Tab', '输入序列并按Tab键'],
['Top P', '顶部P'],
['Frequency penalty', '频率惩罚'],
['Presence penalty', '存在的惩罚'],
['Best of', '最佳'],
['Inject start text', '注入开始文本'],
['Inject restart text', '注入重新开始的文本'],
['Show probabilities', '显示概率'],
['Controls diversity via nucleus sampling:', '通过细胞核取样控制多样性。'],
['0.5 means half of all likelihood-weighted options are considered.', '0.5意味着所有可能性加权选项的一半被考虑。'],
['How much to penalize new tokens based on whether they appear in the text so far. Increases the model\'s likelihood to talk about new topics', '根据到目前为止是否在文本中出现,对新标记的惩罚程度。增加模型谈论新话题的可能性'],
['Generates multiple ', '生成多个 '],
['server-side, and displays only the best. Streaming only works when set to 1. Since it acts as a multiplier on the number of', '在服务器端生成多个新标记,并只显示最好的。流动只在设置为1时才起作用。'],
['this parameters can eat into your token quota very quickly – use caution!', '这个参数会很快吞噬你的代币配额--请谨慎使用!'],
['Text to append after the user\'s input to format the model for a response', '在用户输入后附加的文本,以格式化响应的模型'],
['Toggle token highlighting which indicates how likely a token was to be generated. ', '切换令牌的高亮显示,显示令牌生成的可能性。'],
['to debug a given generation, or see alternative options for a token', '调试一个给定的生成,或查看一个令牌的替代选项'],
['Up to four sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence', '最多四个序列,API将停止生成更多的标记。返回的文本将不包含停止序列'],
['The maximum number of tokens to ', '要生成的标记的最大数量。'],
['generat', '生成的最大数量'],
['Requests can use up to 2,048 or 4,000 tokens shared between prompt and', '请求可以使用最多2,048个或4,000个令牌,在提示和提示之间共享。'],
['The exact limit varies by model', '具体限制因型号而异'],
['One token is roughly 4 characters for normal English text', '对于正常的英文文本,一个标记大约是4个字符。'],
['Controls randomness: Lowering results in less random', '控制随机性。降低的结果是减少随机性'],
['As the temperature approaches zero, the model will become deterministic and repetitive.', '当温度接近零时,模型将变得确定性和重复性。'],
['The model which will generate the ', '将产生的模型 '],
['Some models are suitable for natural language tasks, others specialize in code', '有些模型适用于自然语言任务,有些则专门用于代码'],
['Content filter preferences', '内容过滤偏好'],
['View code', '查看代码'],
['You can use the following code to start integrating your current prompt and settings into your application', '您可以使用以下代码开始将您当前的提示和设置整合到您的应用程序中'],
['Your API Key can be found', '可以找到你的API密钥'],
['You should use environment variables or a secret management tool to expose your key to your applications', '你应该使用环境变量或秘密管理工具,将你的密钥暴露给你的应用程序'],
['Most capable model in the GPT-3series.Can perform any task the other ', 'GPT-3系列中能力最强的型号,可以执行其他型号的任何任务。'],
['models can,oftenwith higher quality,longer outputand better instruction-following.Itcan process up to 4,000 tokensper request.', '它可以处理多达4,000个标记的请求。'],
['STRENGTHS', '优势'],
['Updated', '更新于'],
['Forks', '复刻'],
])
replaceText(document.body)
// |
const bodyObserver = new MutationObserver(mutations => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(addedNode => replaceText(addedNode))
})
})
bodyObserver.observe(document.body, { childList: true, subtree: true })
function replaceText(node) {
nodeForEach(node).forEach(htmlnode => {
i18n.forEach((value, index) => {
// includes可直接使用 === 以提高匹配精度
const textReg = new RegExp(index, 'g')
if (htmlnode instanceof Text && htmlnode.nodeValue.includes(index))
htmlnode.nodeValue = htmlnode.nodeValue.replace(textReg, value)
else if (htmlnode instanceof HTMLInputElement && htmlnode.value.includes(index))
htmlnode.value = htmlnode.value.replace(textReg, value)
})
})
}
function nodeForEach(node) {
const list = []
if (node.childNodes.length === 0) list.push(node)
else {
node.childNodes.forEach(child => {
if (child.childNodes.length === 0) list.push(child)
else list.push(...nodeForEach(child))
})
}
return list
}
})();