配图来自 ChatGPT + stable-diffusion
介绍
Chrome 插件
ChatGPT for Chrome

ChatGPT Sidebar

ChatHub

Mac 扩展
Bob 插件

PopClip

// #popclip extension for ChatGPT
// name: 你的 ChatGPT 助手
// icon: iconify:fluent:calligraphy-pen-24-regular
// language: javascript
// module: true
// entitlements: [network]
async function chat (input, options, action, custom) {
const openai = require("axios").create({
baseURL: "https://api.openai.com/v1",
headers: { Authorization: `Bearer xxxx` },
});
let messages
switch (action) {
case "fix":
messages = [
{"role": "system", "content": "你是我的写作助手,请修改收到的文字中的错别字,向我提供修改后的文字。"},
{"role": "user", "content": `修改下面的文字中的错别字,不需要额外的声明:n${input.text}`}
]
break;
case "split":
messages = [
{"role": "system", "content": "你是我的写作助手,请修改收到的文字中的错别字,优化分割长句,向我提供修改后的文字。"},
{"role": "user", "content": `修改错别字并优化长句,不需要额外的声明:n${input.text}`}
]
break;
case "mei":
messages = [
{"role": "system", "content": "你是我的写作助手,请优化收到的文字,向我提供修改后的文字。"},
{"role": "user", "content": `以很亲密的语气修改美化下面的文章,不需要额外的声明:n${input.text}`}
]
break;
case "run":
messages = [
{"role": "system", "content": "你是我的写作助手,检查接收到的文字的拼写、语法错误,对其进行润色,向我提供修改后的文字。"},
{"role": "user", "content": `修改和润色下面的文字,直接输出修改后的结果,不需要额外的声明:n${input.text}`}
]
break;
case "translate":
messages = [
{"role": "system", "content": "你是我的翻译助手,请翻译收到的文字,向我提供修改后的文字。"},
{"role": "user", "content": `翻译下面的文字为中文,直接输出修改后的结果,不需要额外的声明:n${input.text}`}
]
break;
case "translateEn":
messages = [
{"role": "system", "content": "You are my translation assistant. Please translate the text received to english and provide me with the modified version."},
{"role": "user", "content": `Translate to english, no additional statement is needed:${input.text}`}
]
break;
case "code":
messages = [
{"role": "system", "content": "You are my coding assistant, please help me write the code according to the following requirements and output it directly."},
{"role": "user", "content": `write code in TypeScript without any additional declaration: ${input.text}`}
]
break;
}
const { data } = await openai.post("/chat/completions", {
model: "gpt-3.5-turbo",
messages,
});
const result = data.choices[0].message;
if (custom && custom.withRaw === false) {
return result.content.trim();
}
return input.text.trimEnd() + "nn" + result.content.trim();
};
exports.actions = [{
title: "ChatGPT: 修改润色",
after: "paste-result",
code: async (input, options) => chat(input, options, "run"),
},{
title: "ChatGPT: 优化长句",
icon: "square filled 长",
after: "paste-result",
code: async (input, options) => chat(input, options, "split"),
},{
title: "ChatGPT: 美化",
icon: "square filled 美",
after: "paste-result",
code: async (input, options) => chat(input, options, "mei", {
withRaw: false
}),
},{
title: "ChatGPT: 修改错别字",
after: "paste-result",
icon: "square filled 错",
code: async (input, options) => chat(input, options, "fix"),
},{
title: "ChatGPT: 翻译",
icon: "square filled 翻",
after: "preview-result",
code: async (input, options) => chat(input, options, "translate", {
withRaw: false
}),
},{
title: "ChatGPT: En",
icon: "square filled E",
after: "preview-result",
code: async (input, options) => chat(input, options, "translateEn", {
withRaw: false
}),
},{
title: "code",
icon: "circle filled C",
after: "paste-result",
code: async (input, options) => chat(input, options, "code"),
}];
如何获取 key
更多
-
翻译 -
内容总结 -
基本的润色和错误修改 -
脑爆
总结
本篇文章来源于微信公众号: 别听愚指导瞎说