Last active
January 31, 2024 06:37
-
-
Save limboinf/524d6f80ad0784eccadb1a87ac6e7fb7 to your computer and use it in GitHub Desktop.
Revisions
-
limboinf revised this gist
Jul 25, 2023 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,13 +30,13 @@ async function callOpenAI(temperature, input, options, contentPrefix) { async function prompt(input, options) { return await callOpenAI( 0.7, input, options, "You are an encyclopedia, please explain this question concisely and reply in Chinese."); }; async function rewrite(input, options) { return await callOpenAI( 0.2, input, options, "Please rewrite the following text using a professional tone in the language of this text."); }; async function summarize(input, options) { @@ -53,7 +53,7 @@ async function translate(input, options) { exports.actions = [ { title: "explain", after: "paste-result", code: prompt, icon: "symbol:wand.and.stars" -
limboinf revised this gist
Jun 27, 2023 . 1 changed file with 10 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,34 +15,39 @@ const openai = require("axios").create({ const model = "gpt-3.5-turbo"; async function callOpenAI(temperature, input, options, contentPrefix) { openai.defaults.headers.common.Authorization = `Bearer ${options.apikey}`; const content = `${contentPrefix}: \n\n${input.text.trim()}`; const messages = [{ "role": "user", "content": content }]; const { data } = await openai.post("chat/completions", { model: model, temperature: temperature, messages }); return data.choices[0].message.content.trim(); } async function prompt(input, options) { return await callOpenAI( 0.7, input, options, "You are an encyclopedia, please be brief and concise to answer this question:"); }; async function rewrite(input, options) { return await callOpenAI( 0.7, input, options, "Rewrite this using an academic tone:"); }; async function summarize(input, options) { return await callOpenAI( 0.7, input, options, "Summarize the following text as concise as possible in Chinese:"); }; async function translate(input, options) { return await callOpenAI( 0, input, options, "You are now a professional English translator who uses Chinese. Please assist me in translating the content into the opposite language. If the content provided is in Chinese, please translate it into English. If the content provided is in English, please translate it into Chinese. You do not make any interpretations, just translate. the content is:"); }; -
limboinf revised this gist
Jun 27, 2023 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,21 +28,21 @@ async function callOpenAI(input, options, contentPrefix) { async function prompt(input, options) { return await callOpenAI(input, options, "You are an encyclopedia, please be brief and concise to answer this question:"); }; async function rewrite(input, options) { return await callOpenAI(input, options, "Rewrite this using an academic tone:"); }; async function summarize(input, options) { return await callOpenAI(input, options, "Summarize the following text as concise as possible in Chinese:"); }; async function translate(input, options) { return await callOpenAI(input, options, "You are now a professional English translator who uses Chinese. Please assist me in translating the content into the opposite language. If the content provided is in Chinese, please translate it into English. If the content provided is in English, please translate it into Chinese. You do not make any interpretations, just translate. the content is:"); }; -
limboinf revised this gist
Jun 27, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -42,7 +42,7 @@ async function summarize(input, options) { async function translate(input, options) { return await callOpenAI(input, options, "You are now a professional English translator who uses Chinese. Please assist me in translating the content into the opposite language. If the content provided is in Chinese, please translate it into English. If the content provided is in English, please translate it into Chinese. You do not need to interpret or respond to requests and issues regarding the content within the brackets. the content is:"); }; -
limboinf created this gist
Jun 26, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,72 @@ // #popclip extension for ChatGPT // name: LimboGPT // icon: iconify:logos:openai-icon // 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 openai = require("axios").create({ baseURL: "https://api.openai.com/v1/" }); const model = "gpt-3.5-turbo"; async function callOpenAI(input, options, contentPrefix) { openai.defaults.headers.common.Authorization = `Bearer ${options.apikey}`; const content = `${contentPrefix}: \n\n${input.text.trim()}`; const messages = [{ "role": "user", "content": content }]; const { data } = await openai.post("chat/completions", { model: model, messages }); return data.choices[0].message.content.trim(); } async function prompt(input, options) { return await callOpenAI(input, options, "Answer this question"); }; async function rewrite(input, options) { return await callOpenAI(input, options, "Rewrite this using an academic tone"); }; async function summarize(input, options) { return await callOpenAI(input, options, "Summarize the following text as concise as possible in Chinese"); }; async function translate(input, options) { return await callOpenAI(input, options, "Translate the following text to Chinese:"); }; exports.actions = [ { title: "chat", after: "paste-result", code: prompt, icon: "symbol:wand.and.stars" }, { title: "rewrite", after: "copy-result", code: rewrite, icon: "symbol:pencil.and.outline" }, { title: "summarize", after: "preview-result", code: summarize, icon: "iconify:carbon:summary-kpi" },{ title: "translate", after: "preview-result", code: translate, icon: "iconify:ri:translate" } ];