惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
MyScale Blog
MyScale Blog
Jina AI
Jina AI
爱范儿
爱范儿
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
I
Intezer
The Cloudflare Blog
T
Threat Research - Cisco Blogs
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
Docker
AI
AI
Scott Helme
Scott Helme
Attack and Defense Labs
Attack and Defense Labs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
L
LangChain Blog
Recent Announcements
Recent Announcements
Security Latest
Security Latest
Hugging Face - Blog
Hugging Face - Blog
W
WeLiveSecurity
Last Week in AI
Last Week in AI
Security Archives - TechRepublic
Security Archives - TechRepublic
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Proofpoint News Feed
S
Securelist
S
Security Affairs
Project Zero
Project Zero
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
T
Tor Project blog
A
About on SuperTechFans
V2EX - 技术
V2EX - 技术
宝玉的分享
宝玉的分享
T
Tenable Blog
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
Simon Willison's Weblog
Simon Willison's Weblog
Forbes - Security
Forbes - Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V
V2EX
AWS News Blog
AWS News Blog
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Privacy & Cybersecurity Law Blog
阮一峰的网络日志
阮一峰的网络日志
I
InfoQ
C
CXSECURITY Database RSS Feed - CXSecurity.com
H
Hacker News: Front Page
美团技术团队

Reorx’s Forge

My OpenClaw Desperately Needs a DevOps Agent OpenClaw Is Changing My Life Rabbit R1 - The Upgraded Replacement for Smart Phones Debounce and Throttle | Reorx’s Forge Window Opener for Chrome | Reorx’s Forge 用 AI 工具快速撰写分享型推文 | Reorx’s Forge A Message to GPT-API Product Makers 谈谈我对 ChatGPT 应用的 prompt 的看法 思考生活与生命在英语中的区别 | Reorx’s Forge Some random thoughts on Generative AI 《风暴英雄》对我的意义 | Reorx’s Forge The debut of Substance: A HTML-to-Markdown extractor 「荒木型」与「三浦型」创作者 | Reorx’s Forge “Moving away from UUIDs”, Really? 离开国产 SaaS | Reorx’s Forge Defeat VSCode Tab Bar | Reorx’s Forge 真正的好作品只能靠自己去发现 | Reorx’s Forge 我用过的位置追踪应用 | Reorx’s Forge 浅谈 Chrome Manifest V3 的优缺点 为什么人们在黄图群喜欢聊哲学 | Reorx’s Forge 并不乐观的全球化 | Reorx’s Forge 童年的 Disco | Reorx’s Forge Kevin Kelly 对创作者的指导 | Reorx’s Forge 不换房了,继续向前 | Reorx’s Forge State of Play September 2022 如何寻找一个理想的租房 | Reorx’s Forge 停不下来的创业者——得知 Figma 被 Adobe 收购有感 大公司为何不愿意做好用的产品? | Reorx’s Forge 我的 10 月新番表 | Reorx’s Forge 使用 Railway 和 Supabase 零成本搭建 n8n 自动化平台 分体式键盘 | Reorx’s Forge 关于 Essays 的说明 | Reorx’s Forge 要不要回互联网公司上班? | Reorx’s Forge 2022 年 9 月苹果发布会观后感 | Reorx’s Forge 2022 年 7 月和 8 月总结 种草无线便携路由器 | Reorx’s Forge 更换博客评论系统 | Reorx’s Forge 使用自动化工作流聚合信息摄入和输出 | Reorx’s Forge 我关注的独立开发者们 | Reorx’s Forge 我理想中的 Newsletter platform | Reorx’s Forge 搭建 umami 收集个人网站统计数据 | Reorx’s Forge Frontend Guide 01: Webpack babel-loader 使用指南 Google I/O 2022 Web Platform 新特性展示观看笔记 PyYAML 使用技巧 | Reorx’s Forge Tips that may save you from the hell of PyYAML 重新开始使用 RSS 阅读器 | Reorx’s Forge 我的 Vim 自动补全配置变迁史 | Reorx’s Forge 使用 Sonarr 搭建自动化追番系统 | Reorx’s Forge Switch open files quickly in Obsidian A look into Heptabase's split writing experience
ChatGPT Proofreader extension for Popclip
Reorx · 2023-03-02 · via Reorx’s Forge

昨天 OpenAI 在博客中介绍了新的 ChatGPT API 1, 并且已经发布上线。这个消息令所有关注生成式 AI 开发者为之狂热,我也不例外。我有一大堆点子想要通过 OpenAI 的接口实现,而 ChatGPT API 几乎解决了旧 API 存在的所有问题。

但一个好的开发者应该是务实的,这些点子想要实现还要费一番功夫,有什么地方是马上可以用 ChatGPT API 得到改善的呢?这时我看到了 Popclip ChatGPT extension 的推文 2,并立刻发现这是个非常好的点子。Popclip 是个运行在 MacOS 上的软件,它会在选中的文字上方展示一个提示栏,点击其中的按钮就可以对文字进行快捷操作,如复制、粘贴、查询字典,用户也可以安装更多扩展以实现更多的功能。

Popclip ChatGPT extension 实现了将选中的文字作为 prompt 发给 gpt-3.5-turbo 模型并将返回结果粘贴在下方的功能,并能保存上下文。不过我的评价是,这很 cool,但没啥用,不如直接打开 ChatGPT 网页对话。我想到我经常使用 ChatGPT 的需求之一——校对和润色文字,于是我基于这个扩展做了一个新的扩展,取名为 ChatGPT Proofreader.

功能和用法

ChatGPT Proofreader 提供了中英文两种语言的润色功能,用法如下:

  • 选择英文后,在 Popclip 中点击钢笔图标,润色后的英文将被粘贴在选中文字的下方。
  • 选择中文后,在 Popclip 中点击「润」图表,润色后的中文将被粘贴在选中文字的下方。

安装和配置

首先你需要运行 Popclip,然后拖拽鼠标选中下方完整的代码片段,在 Popclip 中点击 “Install Extension ChatGPT Proofreader” 即可完成安装。之后扩展会提示你输入 OpenAI 的 API Key,点击确认便完成了配置。

// #popclip extension for ChatGPT
// name: ChatGPT Proofreader
// icon: iconify:fluent:calligraphy-pen-24-regular
// language: javascript
// module: true
// entitlements: [network]
// options: [{
//   identifier: apikey, label: API Key, type: string,
//   description: 'Obtain API key from https://platform.openai.com/account/api-keys'
// }]

const prefixes = {
    "native": "Paraphrase the following sentences to make it more native:\n",
    "revise": "Revise the following sentences to make them more clear concise and coherent:\n",
    "standard": "Correct this to standard English:\n",
    "polish": "Please correct the grammar and polish the following sentences, do not provide any translation, comments, or notes, and use the same language as input:\n",
    "authentic": "Rewrite the text in authentic English:\n",
    "ielts": "Rewrite the text using IELTS standard:\n",
}
async function chat (input, options, lang, prefixName) {
  const openai = require("axios").create({
    baseURL: "https://api.openai.com/v1",
    headers: { Authorization: `Bearer ${options.apikey}` },
  });

  let messages
  switch (lang) {
    case "en":
      messages = [
        {"role": "system", "content": "I want you act as a proofreader. I will provide you texts and I would like you to review them for any spelling, grammar, or punctuation errors."},
        {"role": "user", "content": `Proofread the following content and give me the result without extra delarations or comments:\n\n${input.text}`},
      ]
      break;
    case "zh":
      messages = [
        {"role": "system", "content": "你是我的写作助手,检查接收到的文字的拼写、语法错误,对其进行润色,向我提供修改后的文字。"},
        {"role": "user", "content": `修改和润色下面的文字,直接输出修改后的结果,不需要额外的声明:\n${input.text}`}
      ]
      break;
  }
  if (prefixName) {
      messages = [{"role": "user", "content": `${prefixes[prefixName]}${input.text}`}]
  }

  const { data } = await openai.post("/chat/completions", {
    model: "gpt-3.5-turbo",
    messages,
  });
  const result = data.choices[0].message;
  return input.text.trimEnd() + "\n\n" + result.content.trim();
};

exports.actions = [
{
  title: "ChatGPT: proofreader en",
  after: "paste-result",
  code: async (input, options) => chat(input, options, "en"),
},
{
  title: "native",
  icon: "text native",
  after: "paste-result",
  code: async (input, options) => chat(input, options, "", "native"),
},
{
  title: "revise",
  icon: "circle revise",
  after: "paste-result",
  code: async (input, options) => chat(input, options, "", "revise"),
},
{
  title: "polish",
  icon: "square filled polish",
  after: "paste-result",
  code: async (input, options) => chat(input, options, "", "polish"),
},
{
  title: "ChatGPT: proofreader zh",
  icon: "square filled 润",
  after: "paste-result",
  code: async (input, options) => chat(input, options, "zh"),
},
];

Alternative Prompts

本扩展所使用的 prompt 如下:

system: I want you act as a proofreader. I will provide you texts and I would like you to review them for any spelling, grammar, or punctuation errors.

user: Proofread the following content and give me the result without extra delarations or comments:

你可以尝试以下 prompt,或使用自己调整的内容。

可选项 1,来自 ChatGPT Grammar Check PopClip Extension

Please correct the grammar and polish the following sentences, do not provide any translation, comments, or notes, and use the same language as input

可选项 2,来自读者 Yu Bai

Rewrite the text in authentic English

可选项 3,来自 OpenAI Polisher Bob Plugin,括号部分可以去掉

Revise the following sentences to make them more clear, concise and coherent (Please note that you need to list the changes and briefly explain why)

其他:

Native

Paraphrase the following sentences to make it more native:

Standard

Correct this to standard English:

ChatGPT API 的优点

ChatGPT API 打开了我们对工具的想象力,但要着手去拿它做些什么,首先需要了解其特性。我在 Twitter 发表了一个 thread 3来总结其优点,希望能帮助你节省一些时间。以下是完整内容:

ChatGPT API 相比 ChatGPT 的一些优点。

  1. 显式定义角色。在新的 ChatGPT API 中,消息增加了 role 属性,表示其所属的角色,其中 system 用于定义接口的行为,比如「你是一个写作助手」, userassistant 则用于区分用户输入和模型输出。这使得创造特定需求的助手变得更加清晰明确。
  2. 选择性地去掉会话中的信息。ChatGPT 最大可以存储 4096 个 token(大约 16384 个英文字母)的上下文,当一个会话的内容超出这个数量,最前面的信息就会被遗忘。而 ChatGPT API 每次都要将完整的上下文传递过去,这意味着我们可以选择保留重要的信息,选择性地去掉一些无用的以避免超出限制。
  3. 返回多个结果供选择。通过传递 n 参数,可以一次性返回多个不同的结果,适合文字润色、短内容生成等场景,避免多次重复问询。
  4. 使用 logit_bias 参数调整特定词汇(token)在结果中出现的可能性,实现特定词汇屏蔽的功能。
  5. 使用 temperature / top_p 参数调整结果的相关性和准确性。当我们需要发散思维、拓宽脑洞时,可适当调低结果的相关性;而当提供的上下文足够多,需要做精确的分析时,则可调高相关性,减少 编造内容的比重。