<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>chatgpt on Reorx’s Forge</title><link>https://reorx.com/tags/chatgpt/</link><description>Recent content in chatgpt on Reorx’s Forge</description><image><url>https://reorx.com/images/forge-v2-compat.svg</url><link>https://reorx.com/images/forge-v2-compat.svg</link></image><generator>Hugo -- gohugo.io</generator><lastBuildDate>Sat, 11 Mar 2023 11:44:35 +0800</lastBuildDate><atom:link href="https://reorx.com/tags/chatgpt/feed.xml" rel="self" type="application/rss+xml"/><item><title>用 AI 工具快速撰写分享型推文</title><link>https://reorx.com/makers-daily/006-a-gpt-ai-based-workflow-for-content-creation/</link><pubDate>Sat, 11 Mar 2023 11:44:35 +0800</pubDate><guid>https://reorx.com/makers-daily/006-a-gpt-ai-based-workflow-for-content-creation/</guid><description>一次将 AI 用于内容创作的简单尝试</description><content:encoded><![CDATA[<p>前几天刷到一个 <a href="https://www.youtube.com/watch?v=ZA9K0JMrbWg">YouTube 视频</a>，内容是斯坦福大学一位教授介绍它对 AI 的看法和 “AI Thinking” 思维观，感觉很有收获，于是就一如既往地想把我的所得分享到 Twitter 上。以往我都是自己来写推荐语，或许是受视频主题的影响，我便想到，要不要试试用 AI 来帮助我完成这次内容创作呢？</p>
<p>由于近期 ChatGPT 的火爆，我早已经安装尝试了许多基于 ChatGPT API 的工具，甚至自己开发了一些，因此也没有花功夫去寻找其他的，直接使用已有的工具来完成创作流程。</p>
<p>第一个也是最重要的工具是 <a href="https://glarity.app/">Glarity</a>，它是一个 Chrome 扩展，为许多网站提供使用 ChatGPT 提取摘要的功能，比如 Google、YouTube、GitHub 等，效果很好，非常实用。Glarity 支持 OpenAI API 和 ChatGPT Webapp 两种后端，前者需要用户自己提供 API key，后者只需要登录 ChatGPT 网页版即可使用，完全免费。Glarity 的开发者来自中国，近期他们在 <a href="https://www.producthunt.com/posts/glarity-summarize-google-and-youtube">Product Hunt</a> 发布了产品，大家可以多多点赞支持。</p>
<p>Glarity 在 YouTube 播放器右侧注入了一个小组件，点击 &ldquo;Ask ChatGPT to summarize&rdquo; 即可用当前视频的字幕生成摘要，效果如下:</p>
<figure class="center align-center">
  <img loading="lazy" src="/makers-daily/006-a-gpt-ai-based-workflow-for-content-creation/images/glarity-on-youtube.png" type="" alt=""  />

  <figcaption><p>Use Glarity to summarize a YouTube video.</p></figcaption>
</figure>

<p>由于字幕是英文，因此总结内容也是英文，我使用 <a href="https://bobtranslate.com/">Bob</a> 的 <a href="https://github.com/yetone/bob-plugin-openai-translator">OpenAI Translator</a> 插件将摘要翻译成了中文:</p>
<figure class="center align-center">
  <img loading="lazy" src="/makers-daily/006-a-gpt-ai-based-workflow-for-content-creation/images/bob-translator.png" type="" alt=""  />

  <figcaption><p>Use Bob to translate Glarity summary into Chinese.</p></figcaption>
</figure>

<p>看着效果还不错，读起来也很通顺，但是内容太长了，如果想发表到 Twitter 上，就要受到 280 个字符（140 个汉字）的限制，需要再精简一下。用我自己写的 <a href="https://getdrafts.com/">Drafts</a> 插件 <a href="https://directory.getdrafts.com/a/2HJ">ChatGPT Conversation</a>，通过定义 system message 创建了一个专门用于生成社交媒体内容的笔记，让它基于上一步的翻译结果进行创作：</p>
<figure class="center align-center">
  <img loading="lazy" src="/makers-daily/006-a-gpt-ai-based-workflow-for-content-creation/images/drafts.png" type="" alt=""  />

  <figcaption><p>Use Drafts to generate social media content.</p></figcaption>
</figure>

<p>结果为：</p>
<blockquote>
<p>斯坦福AIRE项目主任李江指出，未来许多工作将被人工智能代替，因此向下一代传授AI思维尤为重要。AI思维包括理解AI运作方式、与其合作完成任务及区分人类和人工智能的能力。江建议通过教授设计思维培养创造力和创新精神。他鼓励将人工智能视为强大工具，利用它创新并产生新想法。让我们一起学习AI思维，迎接未来挑战吧！</p>
</blockquote>
<p>只需稍稍修改便是一个合格的文案了。不过其实我是自己把第二步的翻译结果进行了重编排，推文如下:</p>
<div class="tweet social-quote">
  <div class="title">
    <svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>Twitter</title><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/></svg>

    
  </div><blockquote class="twitter-tweet" data-dnt="true"><p lang="zh" dir="ltr">斯坦福教授李江讨论了人工智能对就业和教育的影响，他强调 AI Thinking 的重要性，这包括了解AI如何工作、区分人类和机器，并与AI合作完成任务。他还建议通过斯坦福 Design Thinking 方法论来提高孩子们的创造力、共情与定义问题的能力，帮助他们在未来竞争中取得优势。<a href="https://t.co/n6yy0v1nLg">https://t.co/n6yy0v1nLg</a></p>&mdash; Reorx (@novoreorx) <a href="https://twitter.com/novoreorx/status/1632999727167074304?ref_src=twsrc%5Etfw">March 7, 2023</a></blockquote>


</div>


<h2 id="总结">总结</h2>
<p>本文探索了使用 AI 技术将有趣的内容总结成文案后发布到社交网络上的流程。用到了以下工具：</p>
<ul>
<li><a href="https://glarity.app/">Glarity</a></li>
<li><a href="https://bobtranslate.com/">Bob</a> and <a href="https://github.com/yetone/bob-plugin-openai-translator">OpenAI Translator</a> plugin</li>
<li><a href="https://getdrafts.com/">Drafts</a> and <a href="https://directory.getdrafts.com/a/2HJ">ChatGPT Conversation</a> action</li>
</ul>
<p>虽然是一个简单的任务，但有 AI 的帮助确实加速了生产力，如果我从头看完视频 + 自己写，至少需要 30 分钟，AI 则可以将这个步骤压缩在 5 分钟内完成。</p>
<p>当然了，这对我来说只是一个实验，我并不想完全以这种方式来创作，一则我并非内容农场，我只创作我认为有价值的内容；二则使用 AI 生成并不能帮助我去思考或深入了解问题。写作是一个创造性的过程，我享受它所带来的成就感，甚至挫败感，它们都能使我得到成长。但我依然非常喜欢 GPT AI，因为它会持续优化我的生产力，帮助我分担非创造性劳作，让我能投入更多时间在创造性工作上。这又让我想起那句话，技术本身是无罪的，只看你怎样使用它。任何结果都是使用者的选择，而不能将原因归咎在完成这件事的工具上。</p>
]]></content:encoded></item><item><title>A Message to GPT-API Product Makers</title><link>https://reorx.com/makers-daily/005-a-message-to-gpt-api-product-makers/</link><pubDate>Wed, 08 Mar 2023 15:37:49 +0800</pubDate><guid>https://reorx.com/makers-daily/005-a-message-to-gpt-api-product-makers/</guid><description>The more developers favor your product, the easier marketing it would be.</description><content:encoded><![CDATA[<p>I regularly check new GPT-APT-based products for <a href="https://github.com/reorx/awesome-chatgpt-api">my awesome list</a> every day. Recently I found <a href="https://www.producthunt.com/posts/zeeno-ai">Zeeno.ai</a> and <a href="https://www.producthunt.com/posts/monica-3">Monica</a>. They both look promising but lack the ability to customize API keys, so I left some comments on Product Hunt asking if this feature could be supported. Luckily, they both responded with a positive attitude.</p>
<p>Additionally, the maker of Monica replied:</p>
<blockquote>
<p>I&rsquo;m a bit curious, is using a personal API because the daily free quota is not enough?</p>
</blockquote>
<p>This is an interesting question because I initially asked for this feature solely from a developer&rsquo;s point of view: utilizing my own key would decrease expenses and provide more autonomy. But for product makers, it&rsquo;s not worth creating a feature for a small group of people with technical background when the majority of users are normal individuals. That seems to be the case, and the common practice for GPT-API-based products is to build a subscription model around the usage amount—a reseller of the upstream API. So why bother telling the user that you can bring your own key if we want them to think highly of our technology?</p>
<p>Well, there are still reasons to do so. Let me explain:</p>
<ol>
<li>What the user truly cares about is the usability of your product. Although some may not be aware of OpenAI, the number of competitors in the market continues to grow rapidly on a daily basis. Therefore, providing this option will not have a negative effect on how normal individuals think about your product.</li>
<li>The developer&rsquo;s favor is a cost-free marketing promotion. As a developer, I appreciate transparent and customizable products. I will spare no effort to promote your product for free through writing articles or posting tweets, as long as I find it powerful and customizable, and I believe other developers are the same as me. YouTubers may also appreciate the opportunity to create tutorials teaching their viewers how to use great products for free by utilizing &ldquo;certain technologies&rdquo;. We will spread its popularity.</li>
<li>Those willing to invest in a tool are less concerned about API keys, because they prioritize convenience and time over cost. Consequently, we can assume that conversion rates for subscriptions are constant. The more users a product has, the higher the likelihood of gaining subscribers. It&rsquo;s straightforward logic, isn&rsquo;t it?</li>
</ol>
<p>I am aware that, in many cases, backend logic can be too complex to allow for this feature. However, where possible, I recommend enabling the customization of API keys, which would be a mutually beneficial solution for both of us. So, what is your opinion on this?</p>
]]></content:encoded></item><item><title>谈谈我对 ChatGPT 应用的 prompt 的看法</title><link>https://reorx.com/makers-daily/004-prompts-and-parameters-transparancy/</link><pubDate>Sun, 05 Mar 2023 23:08:00 +0800</pubDate><guid>https://reorx.com/makers-daily/004-prompts-and-parameters-transparancy/</guid><description>Prompt 是一个 ChatGPT 应用的灵魂，希望所有基于 ChatGPT API 的产品都能向用户公开其 prompt，保持透明，尊重用户隐私。或许我们可以发起一个由社区共同维护的 Open Prompt 开源项目？</description><content:encoded><![CDATA[<p>在<a href="/makers-daily/003-chatgpt-proofreader-extension-popclip/">上一篇更新</a>中我讲到自己基于 ChatGPT API 做了一个校对和润色文字的 Popclip 插件，叫做 Popclip Proofreader。由于 ChatGPT API 本身非常简单，这个插件的核心价值其实是我调教出的可以稳定、准确完成润色这一任务的 prompt。</p>
<p>在见识过越来越多的新产品后，我越发认定，<mark>prompt 是一个 ChatGPT 应用的灵魂</mark>，甚至未来 prompt 本身就可以成为应用。并且 prompt 关系到用户所输入的信息如何被使用和上传（到 OpenAI），因此我衷心希望所有基于 ChatGPT API 的产品都能向用户公开其所使用的 prompt，保持透明，尊重用户隐私。更何况 prompt 的使用交流无论是对于用户还是开发者都很有价值，任何人都不必敝帚自珍。</p>
<p>我们正身处一场技术发展和下放所产生的时代变革之中，作为一个开发者，应该清醒地认识到，我们开发的应用的价值是由所有参与到生成式 AI 与大型语言模型的学术研究、数据训练、软件开发的学者和公司所赋予的。应带着感激和尊敬，挖掘和普及这项技术的价值，使它能够应用在更多的场景中，为更多的人带来便利。这是我关于开发 ChatGPT API 工具的使命和初心。</p>
<h2 id="prompts-for-proofreading">Prompts for proofreading</h2>
<p>说回正题，我来分享下 Popclip Proofreader 所使用的 prompt:</p>
<blockquote>
<p>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.</p>
<p>user: Proofread the following content and give me the result without extra delarations or comments:</p>
</blockquote>
<p>你可能会好奇，user message 似乎已经包含了足够多的信息，为什么还要有个 system message 呢？我的初衷是通过 system message 传递所有的任务要求，我给了它两个指示，1. 检查文字中的拼写、语法、标点错误并更正；2. 返回的信息不要包含额外的评论和声明。第二点的目的是为了避免输出中包含 &ldquo;Here&rsquo;s the corrected sentence:&rdquo; 这样的无用信息，但结果却不甚理想，这种声明仍然时不时会出现。</p>
<p>于是我查阅了 OpenAI 的文档<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup>，发现这样一段话:</p>
<blockquote>
<p>Many conversations begin with a system message to gently instruct the assistant…
In general, <code>gpt-3.5-turbo-0301</code> does not pay strong attention to the system message, and therefore important instructions are often better placed in a user message.</p>
</blockquote>
<p>也就是说，ChatGPT 对 system message 的遵从程度没有那么高，一些重要的指示最好还是放在 user message 中。所以我最终将第二个指令放在了 user message 中。但其实这么看来，system 更适合在较长的对话中定下基调，而单条信息的查询只用一条 user 来表达是最好的。</p>
<p>下面我收集了一些同样目的的 prompt 供读者参考和尝试。</p>
<p>可选项 1，来自 <a href="https://github.com/hirakujira/ChatGPT-Grammar-Check-PopClip-Extension">ChatGPT Grammar Check PopClip Extension</a></p>
<blockquote>
<p>user: Please correct the grammar and polish the following sentences, do not provide any translation, comments, or notes, and use the same language as input</p>
</blockquote>
<p>可选项 2，来自读者 Yu Bai</p>
<blockquote>
<p>user: Rewrite the text in authentic English</p>
</blockquote>
<p>可选项 3，来自 <a href="https://github.com/yetone/bob-plugin-openai-polisher">OpenAI Polisher Bob Plugin</a>，括号部分可以去掉</p>
<blockquote>
<p>user: 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)</p>
</blockquote>
<h2 id="other-peoples-thoughts">Other people&rsquo;s thoughts</h2>
<p>其实除了 prompt, ChatGPT API 的其他参数 (parameters) 也影响最终结果的产生，因此在公布 prompt 的同时，也应该将这些参数囊括进来。推友 @mr_easonyang 甚至认为参数应该成为自定义选项，我认为这是很好的提议:</p>
<div class="tweet social-quote">
  <div class="title">
    <svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>Twitter</title><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/></svg>

    
  </div></div>


<p>推友 @daydayuuup 也表达了对 prompt 无法控制的担忧:</p>
<div class="tweet social-quote">
  <div class="title">
    <svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>Twitter</title><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/></svg>

    
  </div><blockquote class="twitter-tweet" data-dnt="true"><p lang="zh" dir="ltr">在想一个问题，大家在谈「咒语」（prompt）对于回复质量的重要性，我们在使用CHATGPT的时候是自己主动输入「咒语」，如果使用开发者创建的应用，比如翻译，那么翻译的提示语质量可高可低，我们还控制不了，所以要谨慎选择开发者，选择质量高的应用。否则可能会影响翻译质量。对不？ <a href="https://t.co/cZHeaCKHsq">https://t.co/cZHeaCKHsq</a></p>&mdash; 天天 (@daydayuuup) <a href="https://twitter.com/daydayuuup/status/1632230590362816513?ref_src=twsrc%5Etfw">March 5, 2023</a></blockquote>


</div>


<p>推友 @xxm459259 说 ChatGPT 类产品很容易被下游开发者复刻，我深以为然。一开始大家可能都会想把 prompt 作为壁垒，但对想要破解的人来讲，看一眼可能就猜个七七八八，自己调试下说不定效果还更好了…所以我觉得 prompt 还是公开的好，更快推动 Prompt Engineering 的发展，作为开发者也一定能在更好的环境中获利。</p>
<div class="tweet social-quote">
  <div class="title">
    <svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>Twitter</title><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/></svg>

    
  </div><blockquote class="twitter-tweet" data-dnt="true"><p lang="zh" dir="ltr">其实我这段时间也用 ChatGPT 写了很多小工具，能尝试的 demo 几乎都尝试了一遍，甚至中间一度也想找一个合适的方向搞一个相对成型的产品，而非 Demo。<br>现在让我踌躇不前最主要的原因其实是壁垒，我觉得下游开发者复刻太容易，即便不知道你的 Prompt 看一眼产品也能猜个七七八八。。</p>&mdash; Micro 小熊猫 (@xxm459259) <a href="https://twitter.com/xxm459259/status/1632381501970194433?ref_src=twsrc%5Etfw">March 5, 2023</a></blockquote>


</div>


<p>推友 yeaphgel <a href="https://twitter.com/yeaphgel/status/1632410458799095809">说到</a>，<strong>细分行业融入工作流组织化才能形成真正的壁垒</strong>，我很认可这个观点，这样的市场环境是我希望看到的。一个有追求的产品应该在工具的深度上做竞争，而不是急功近利地圈地抢人，如果你做的东西不够好，用户最终还是会流失掉。</p>
<h2 id="the-open-prompt-project">The &ldquo;Open Prompt&rdquo; project</h2>
<p>在写这篇文章的时候，我产生了一个想法——发起一个名为 Open Prompt 的开源项目，由社区参与者共同收集和维护各种 AI 产品的 prompt，附带详细的说明，供用户和开发者审阅和参考。与 <a href="https://github.com/f/awesome-chatgpt-prompts">Awesome ChatGPT Prompts</a> 不同的是，每个产品的 prompt 都会有一个单独的页面，大家可以在这里看到 prompt 版本的变化，提交反馈和参与讨论，使这里成为 AI 爱好者们学习和交流的平台。如果读者们对此项目感兴趣，或有不同的想法，欢迎与我联系和讨论。</p>
<h2 id="the-market-value-of-ai-prompt">The market value of AI prompt</h2>
<p>上文中提到的，未来或许 prompt 可以直接成为应用，今天就看到了 <a href="https://promptbase.com/">PromptBase</a> 这个网站，看来 “Prompt as a Service“ 已经指日可待。这个网站可以搜索和买卖各类 AI 产品的 prompts，除了 ChatGPT 和 GPT-3，还有之前备受关注的 text-to-image 领域的 Stable Diffusion, DALL-E, Midjourney 等等。我随便查看了几个 ChatGPT 的，有教你如何赚钱的 &ldquo;Eary Money Now&rdquo;, &ldquo;The Business Genie&rdquo;，也有自媒体博主非常需要的 &ldquo;Never Run Out Of Instagram Ideas&rdquo;, &ldquo;Social Media Weekly Content&rdquo;，价格大都在 $1.99 到 $4.99 之间，卖得好的已经有上千次出售。</p>
<p>看来 prompts 真的有很大的商业价值，或许我关于 prompts 与参数透明化的想法太简单了，但我仍然相信开放才是进步的源动力，就像 OpenAI 完全可以给出更高的定价，完全可以不将 API 开放，继续让更多的人购买 ChatGPT Plus，但他们却把 AI 技术下放，使人人都可低价使用和获利。这种做法的背后即便是为了更大更长远的商业利益，也是我所欣赏和赞扬的，并在事实上推动了文明的进步。</p>
<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p><a href="https://platform.openai.com/docs/guides/chat/instructing-chat-models">https://platform.openai.com/docs/guides/chat/instructing-chat-models</a>&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>
]]></content:encoded></item><item><title>ChatGPT Proofreader extension for Popclip</title><link>https://reorx.com/makers-daily/003-chatgpt-proofreader-extension-popclip/</link><pubDate>Thu, 02 Mar 2023 23:36:00 +0800</pubDate><guid>https://reorx.com/makers-daily/003-chatgpt-proofreader-extension-popclip/</guid><description>做了一个校对和润色选中文字的 Popclip 插件</description><content:encoded><![CDATA[<p>昨天 OpenAI 在博客中介绍了新的 ChatGPT API <sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup>, 并且已经发布上线。这个消息令所有关注生成式 AI 开发者为之狂热，我也不例外。我有一大堆点子想要通过 OpenAI 的接口实现，而 ChatGPT API 几乎解决了旧 API 存在的所有问题。</p>
<p>但一个好的开发者应该是务实的，这些点子想要实现还要费一番功夫，有什么地方是马上可以用 ChatGPT API 得到改善的呢？这时我看到了 Popclip ChatGPT extension 的推文 <sup id="fnref:2"><a href="#fn:2" class="footnote-ref" role="doc-noteref">2</a></sup>，并立刻发现这是个非常好的点子。Popclip 是个运行在 MacOS 上的软件，它会在选中的文字上方展示一个提示栏，点击其中的按钮就可以对文字进行快捷操作，如复制、粘贴、查询字典，用户也可以安装更多扩展以实现更多的功能。</p>
<p><a href="https://forum.popclip.app/t/a-popclip-extension-for-chatgpt-updated/1283/18">Popclip ChatGPT extension</a> 实现了将选中的文字作为 prompt 发给 <code>gpt-3.5-turbo</code> 模型并将返回结果粘贴在下方的功能，并能保存上下文。不过我的评价是，这很 cool，但没啥用，不如直接打开 ChatGPT 网页对话。我想到我经常使用 ChatGPT 的需求之一——校对和润色文字，于是我基于这个扩展做了一个新的扩展，取名为 ChatGPT Proofreader.</p>
<h2 id="功能和用法">功能和用法</h2>
<p>ChatGPT Proofreader 提供了中英文两种语言的润色功能，用法如下：</p>
<ul>
<li>选择英文后，在 Popclip 中点击钢笔图标，润色后的英文将被粘贴在选中文字的下方。</li>
<li>选择中文后，在 Popclip 中点击「润」图表，润色后的中文将被粘贴在选中文字的下方。</li>
</ul>
<h2 id="安装和配置">安装和配置</h2>
<p>首先你需要运行 Popclip，然后拖拽鼠标选中下方完整的代码片段，在 Popclip 中点击 “Install Extension ChatGPT Proofreader” 即可完成安装。之后扩展会提示你输入 OpenAI 的 API Key，点击确认便完成了配置。</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="c1">// #popclip extension for ChatGPT
</span></span></span><span class="line"><span class="cl"><span class="c1">// name: ChatGPT Proofreader
</span></span></span><span class="line"><span class="cl"><span class="c1">// icon: iconify:fluent:calligraphy-pen-24-regular
</span></span></span><span class="line"><span class="cl"><span class="c1">// language: javascript
</span></span></span><span class="line"><span class="cl"><span class="c1">// module: true
</span></span></span><span class="line"><span class="cl"><span class="c1">// entitlements: [network]
</span></span></span><span class="line"><span class="cl"><span class="c1">// options: [{
</span></span></span><span class="line"><span class="cl"><span class="c1">//   identifier: apikey, label: API Key, type: string,
</span></span></span><span class="line"><span class="cl"><span class="c1">//   description: &#39;Obtain API key from https://platform.openai.com/account/api-keys&#39;
</span></span></span><span class="line"><span class="cl"><span class="c1">// }]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">prefixes</span> <span class="o">=</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;native&#34;</span><span class="o">:</span> <span class="s2">&#34;Paraphrase the following sentences to make it more native:\n&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;revise&#34;</span><span class="o">:</span> <span class="s2">&#34;Revise the following sentences to make them more clear concise and coherent:\n&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;standard&#34;</span><span class="o">:</span> <span class="s2">&#34;Correct this to standard English:\n&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;polish&#34;</span><span class="o">:</span> <span class="s2">&#34;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&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;authentic&#34;</span><span class="o">:</span> <span class="s2">&#34;Rewrite the text in authentic English:\n&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;ielts&#34;</span><span class="o">:</span> <span class="s2">&#34;Rewrite the text using IELTS standard:\n&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="kr">async</span> <span class="kd">function</span> <span class="nx">chat</span> <span class="p">(</span><span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">,</span> <span class="nx">lang</span><span class="p">,</span> <span class="nx">prefixName</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="kr">const</span> <span class="nx">openai</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s2">&#34;axios&#34;</span><span class="p">).</span><span class="nx">create</span><span class="p">({</span>
</span></span><span class="line"><span class="cl">    <span class="nx">baseURL</span><span class="o">:</span> <span class="s2">&#34;https://api.openai.com/v1&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nx">headers</span><span class="o">:</span> <span class="p">{</span> <span class="nx">Authorization</span><span class="o">:</span> <span class="sb">`Bearer </span><span class="si">${</span><span class="nx">options</span><span class="p">.</span><span class="nx">apikey</span><span class="si">}</span><span class="sb">`</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl">  <span class="p">});</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  <span class="kd">let</span> <span class="nx">messages</span>
</span></span><span class="line"><span class="cl">  <span class="k">switch</span> <span class="p">(</span><span class="nx">lang</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="k">case</span> <span class="s2">&#34;en&#34;</span><span class="o">:</span>
</span></span><span class="line"><span class="cl">      <span class="nx">messages</span> <span class="o">=</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl">        <span class="p">{</span><span class="s2">&#34;role&#34;</span><span class="o">:</span> <span class="s2">&#34;system&#34;</span><span class="p">,</span> <span class="s2">&#34;content&#34;</span><span class="o">:</span> <span class="s2">&#34;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.&#34;</span><span class="p">},</span>
</span></span><span class="line"><span class="cl">        <span class="p">{</span><span class="s2">&#34;role&#34;</span><span class="o">:</span> <span class="s2">&#34;user&#34;</span><span class="p">,</span> <span class="s2">&#34;content&#34;</span><span class="o">:</span> <span class="sb">`Proofread the following content and give me the result without extra delarations or comments:\n\n</span><span class="si">${</span><span class="nx">input</span><span class="p">.</span><span class="nx">text</span><span class="si">}</span><span class="sb">`</span><span class="p">},</span>
</span></span><span class="line"><span class="cl">      <span class="p">]</span>
</span></span><span class="line"><span class="cl">      <span class="k">break</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">    <span class="k">case</span> <span class="s2">&#34;zh&#34;</span><span class="o">:</span>
</span></span><span class="line"><span class="cl">      <span class="nx">messages</span> <span class="o">=</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl">        <span class="p">{</span><span class="s2">&#34;role&#34;</span><span class="o">:</span> <span class="s2">&#34;system&#34;</span><span class="p">,</span> <span class="s2">&#34;content&#34;</span><span class="o">:</span> <span class="s2">&#34;你是我的写作助手，检查接收到的文字的拼写、语法错误，对其进行润色，向我提供修改后的文字。&#34;</span><span class="p">},</span>
</span></span><span class="line"><span class="cl">        <span class="p">{</span><span class="s2">&#34;role&#34;</span><span class="o">:</span> <span class="s2">&#34;user&#34;</span><span class="p">,</span> <span class="s2">&#34;content&#34;</span><span class="o">:</span> <span class="sb">`修改和润色下面的文字，直接输出修改后的结果，不需要额外的声明:\n</span><span class="si">${</span><span class="nx">input</span><span class="p">.</span><span class="nx">text</span><span class="si">}</span><span class="sb">`</span><span class="p">}</span>
</span></span><span class="line"><span class="cl">      <span class="p">]</span>
</span></span><span class="line"><span class="cl">      <span class="k">break</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">  <span class="p">}</span>
</span></span><span class="line"><span class="cl">  <span class="k">if</span> <span class="p">(</span><span class="nx">prefixName</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">      <span class="nx">messages</span> <span class="o">=</span> <span class="p">[{</span><span class="s2">&#34;role&#34;</span><span class="o">:</span> <span class="s2">&#34;user&#34;</span><span class="p">,</span> <span class="s2">&#34;content&#34;</span><span class="o">:</span> <span class="sb">`</span><span class="si">${</span><span class="nx">prefixes</span><span class="p">[</span><span class="nx">prefixName</span><span class="p">]</span><span class="si">}${</span><span class="nx">input</span><span class="p">.</span><span class="nx">text</span><span class="si">}</span><span class="sb">`</span><span class="p">}]</span>
</span></span><span class="line"><span class="cl">  <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  <span class="kr">const</span> <span class="p">{</span> <span class="nx">data</span> <span class="p">}</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">openai</span><span class="p">.</span><span class="nx">post</span><span class="p">(</span><span class="s2">&#34;/chat/completions&#34;</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="nx">model</span><span class="o">:</span> <span class="s2">&#34;gpt-3.5-turbo&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nx">messages</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="p">});</span>
</span></span><span class="line"><span class="cl">  <span class="kr">const</span> <span class="nx">result</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">choices</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">message</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">  <span class="k">return</span> <span class="nx">input</span><span class="p">.</span><span class="nx">text</span><span class="p">.</span><span class="nx">trimEnd</span><span class="p">()</span> <span class="o">+</span> <span class="s2">&#34;\n\n&#34;</span> <span class="o">+</span> <span class="nx">result</span><span class="p">.</span><span class="nx">content</span><span class="p">.</span><span class="nx">trim</span><span class="p">();</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nx">exports</span><span class="p">.</span><span class="nx">actions</span> <span class="o">=</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nx">title</span><span class="o">:</span> <span class="s2">&#34;ChatGPT: proofreader en&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">after</span><span class="o">:</span> <span class="s2">&#34;paste-result&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">code</span><span class="o">:</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="nx">chat</span><span class="p">(</span><span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">,</span> <span class="s2">&#34;en&#34;</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nx">title</span><span class="o">:</span> <span class="s2">&#34;native&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">icon</span><span class="o">:</span> <span class="s2">&#34;text native&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">after</span><span class="o">:</span> <span class="s2">&#34;paste-result&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">code</span><span class="o">:</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="nx">chat</span><span class="p">(</span><span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">,</span> <span class="s2">&#34;&#34;</span><span class="p">,</span> <span class="s2">&#34;native&#34;</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nx">title</span><span class="o">:</span> <span class="s2">&#34;revise&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">icon</span><span class="o">:</span> <span class="s2">&#34;circle revise&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">after</span><span class="o">:</span> <span class="s2">&#34;paste-result&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">code</span><span class="o">:</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="nx">chat</span><span class="p">(</span><span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">,</span> <span class="s2">&#34;&#34;</span><span class="p">,</span> <span class="s2">&#34;revise&#34;</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nx">title</span><span class="o">:</span> <span class="s2">&#34;polish&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">icon</span><span class="o">:</span> <span class="s2">&#34;square filled polish&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">after</span><span class="o">:</span> <span class="s2">&#34;paste-result&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">code</span><span class="o">:</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="nx">chat</span><span class="p">(</span><span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">,</span> <span class="s2">&#34;&#34;</span><span class="p">,</span> <span class="s2">&#34;polish&#34;</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nx">title</span><span class="o">:</span> <span class="s2">&#34;ChatGPT: proofreader zh&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">icon</span><span class="o">:</span> <span class="s2">&#34;square filled 润&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">after</span><span class="o">:</span> <span class="s2">&#34;paste-result&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nx">code</span><span class="o">:</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="nx">chat</span><span class="p">(</span><span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">,</span> <span class="s2">&#34;zh&#34;</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span>
</span></span><span class="line"><span class="cl"><span class="p">];</span>
</span></span></code></pre></div><h2 id="alternative-prompts">Alternative Prompts</h2>
<p>本扩展所使用的 prompt 如下:</p>
<blockquote>
<p>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.</p>
<p>user: Proofread the following content and give me the result without extra delarations or comments:</p>
</blockquote>
<p>你可以尝试以下 prompt，或使用自己调整的内容。</p>
<p>可选项 1，来自 <a href="https://github.com/hirakujira/ChatGPT-Grammar-Check-PopClip-Extension">ChatGPT Grammar Check PopClip Extension</a></p>
<blockquote>
<p>Please correct the grammar and polish the following sentences, do not provide any translation, comments, or notes, and use the same language as input</p>
</blockquote>
<p>可选项 2，来自读者 Yu Bai</p>
<blockquote>
<p>Rewrite the text in authentic English</p>
</blockquote>
<p>可选项 3，来自 <a href="https://github.com/yetone/bob-plugin-openai-polisher">OpenAI Polisher Bob Plugin</a>，括号部分可以去掉</p>
<blockquote>
<p>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)</p>
</blockquote>
<p>其他:</p>
<blockquote>
<p><strong>Native</strong></p>
<p>Paraphrase the following sentences to make it more native:</p>
<p><strong>Standard</strong></p>
<p>Correct this to standard English:</p>
</blockquote>
<h2 id="chatgpt-api-的优点">ChatGPT API 的优点</h2>
<p>ChatGPT API 打开了我们对工具的想象力，但要着手去拿它做些什么，首先需要了解其特性。我在 Twitter 发表了一个 thread <sup id="fnref:3"><a href="#fn:3" class="footnote-ref" role="doc-noteref">3</a></sup>来总结其优点，希望能帮助你节省一些时间。以下是完整内容:</p>
<p><strong>ChatGPT API 相比 ChatGPT 的一些优点。</strong></p>
<ol>
<li>显式定义角色。在新的 ChatGPT API 中，消息增加了 <code>role</code> 属性，表示其所属的角色，其中 <code>system</code> 用于定义接口的行为，比如「你是一个写作助手」， <code>user</code> 和 <code>assistant</code> 则用于区分用户输入和模型输出。这使得创造特定需求的助手变得更加清晰明确。</li>
<li>选择性地去掉会话中的信息。ChatGPT 最大可以存储 4096 个 token（大约 16384 个英文字母）的上下文，当一个会话的内容超出这个数量，最前面的信息就会被遗忘。而 ChatGPT API 每次都要将完整的上下文传递过去，这意味着我们可以选择保留重要的信息，选择性地去掉一些无用的以避免超出限制。</li>
<li>返回多个结果供选择。通过传递 <code>n</code> 参数，可以一次性返回多个不同的结果，适合文字润色、短内容生成等场景，避免多次重复问询。</li>
<li>使用 <code>logit_bias</code> 参数调整特定词汇（token）在结果中出现的可能性，实现特定词汇屏蔽的功能。</li>
<li>使用 <code>temperature</code> / <code>top_p</code> 参数调整结果的相关性和准确性。当我们需要发散思维、拓宽脑洞时，可适当调低结果的相关性；而当提供的上下文足够多，需要做精确的分析时，则可调高相关性，减少 编造内容的比重。</li>
</ol>
<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p><a href="https://openai.com/blog/introducing-chatgpt-and-whisper-apis">Introducing ChatGPT and Whisper APIs</a>&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:2">
<p><div class="tweet-ref">From <a href="https://twitter.com/PopClipApp/status/1631040246841319427">twitter.com/PopClipApp/status/1631040246841319427</a>:<blockquote class="twitter-tweet" data-dnt="true"><p lang="en" dir="ltr">PopClip ChatGPT extension snippet — updated to use the new  GPT 3.5 chat API, so you can actually chat with it.<a href="https://t.co/xo8xaGABHs">https://t.co/xo8xaGABHs</a> <a href="https://t.co/gM916fL7io">pic.twitter.com/gM916fL7io</a></p>&mdash; PopClip for Mac (@PopClipApp) <a href="https://twitter.com/PopClipApp/status/1631040246841319427?ref_src=twsrc%5Etfw">March 1, 2023</a></blockquote>


</div>
&#160;<a href="#fnref:2" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:3">
<p><div class="tweet-ref">From <a href="https://twitter.com/novoreorx/status/1631250035852861440">twitter.com/novoreorx/status/1631250035852861440</a>:<blockquote class="twitter-tweet" data-dnt="true"><p lang="zh" dir="ltr">Thread🧵: ChatGPT API 相比 ChatGPT 的一些优点。<br><br>1. 显式定义角色。在新的 ChatGPT API 中，消息增加了 role 的属性，表示其所属的角色，其中 system 用于定义接口的行为，比如「你是一个写作助手」， user 和 assistant 则用于区分用户输入和模型输出。这使得创造特定需求的助手变得更加清晰明确。 <a href="https://t.co/35Yzb4sE4Z">pic.twitter.com/35Yzb4sE4Z</a></p>&mdash; Reorx (@novoreorx) <a href="https://twitter.com/novoreorx/status/1631250035852861440?ref_src=twsrc%5Etfw">March 2, 2023</a></blockquote>


</div>
&#160;<a href="#fnref:3" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>
]]></content:encoded></item></channel></rss>