diff --git a/AGENTS.md b/AGENTS.md index 332e48313..9aca27e82 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -219,7 +219,7 @@ src/ The extension supports multiple AI providers: -- **Web (cookie-based)**: ChatGPT (Web), Claude (Web), Kimi.Moonshot (Web), Bing (Web), Bard (Web), Poe (Web) +- **Web (cookie-based)**: ChatGPT (Web), Claude (Web), Kimi.Moonshot (Web), Bing (Web), Bard (Web) - **APIs (key-based)**: OpenAI (API), Azure OpenAI (API), Anthropic (Claude API), OpenRouter (API), AI/ML (API), DeepSeek (API), Ollama (local), ChatGLM (API), Waylaidwanderer (API), Kimi.Moonshot (API) - **Custom/self-hosted**: Alternative endpoints and self-hosted backends diff --git a/build.mjs b/build.mjs index a76858a42..4c6ed6b01 100644 --- a/build.mjs +++ b/build.mjs @@ -352,10 +352,6 @@ async function runWebpack(isWithoutKatex, isWithoutTiktoken, minimal, sourceBuil test: /\.(jpg|png|svg)$/, type: 'asset/inline', }, - { - test: /\.(graphql|gql)$/, - loader: 'graphql-tag/loader', - }, isWithoutTiktoken ? { test: /crop-text\.mjs$/, diff --git a/package-lock.json b/package-lock.json index 2fcedea2e..a91322304 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,17 +14,14 @@ "buffer": "^6.0.3", "countries-list": "^2.6.1", "crypto-browserify": "^3.12.1", - "diff": "^5.2.2", "file-saver": "^2.0.5", "github-markdown-css": "^5.9.0", "gpt-3-encoder": "^1.1.4", - "graphql": "^16.9.0", "i18next": "^22.5.1", "js-sha3": "^0.9.3", "jsonwebtoken": "9.0.2", "katex": "^0.16.11", "lodash-es": "^4.17.21", - "md5": "^2.3.0", "parse5": "^6.0.1", "preact": "^10.22.1", "process": "^0.11.10", @@ -68,7 +65,6 @@ "eslint": "^8.57.1", "eslint-plugin-react": "^7.37.5", "fs-extra": "^11.2.0", - "graphql-tag": "^2.12.6", "jsdom": "^28.1.0", "less-loader": "^11.1.4", "mini-css-extract-plugin": "^2.10.2", @@ -4728,14 +4724,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", - "engines": { - "node": "*" - } - }, "node_modules/chokidar": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", @@ -5163,14 +5151,6 @@ "node": ">= 8" } }, - "node_modules/crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", - "engines": { - "node": "*" - } - }, "node_modules/crypto-browserify": { "version": "3.12.1", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.1.tgz", @@ -7681,30 +7661,6 @@ "dev": true, "license": "MIT" }, - "node_modules/graphql": { - "version": "16.9.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.9.0.tgz", - "integrity": "sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==", - "license": "MIT", - "engines": { - "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" - } - }, - "node_modules/graphql-tag": { - "version": "2.12.6", - "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz", - "integrity": "sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==", - "dev": true, - "dependencies": { - "tslib": "^2.1.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "graphql": "^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" - } - }, "node_modules/gzip-size": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz", @@ -8407,11 +8363,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -9855,16 +9806,6 @@ "node": ">= 0.4" } }, - "node_modules/md5": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", - "dependencies": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", diff --git a/package.json b/package.json index 81a1e7f8e..10b55ed9d 100644 --- a/package.json +++ b/package.json @@ -37,17 +37,14 @@ "buffer": "^6.0.3", "countries-list": "^2.6.1", "crypto-browserify": "^3.12.1", - "diff": "^5.2.2", "file-saver": "^2.0.5", "github-markdown-css": "^5.9.0", "gpt-3-encoder": "^1.1.4", - "graphql": "^16.9.0", "i18next": "^22.5.1", "js-sha3": "^0.9.3", "jsonwebtoken": "9.0.2", "katex": "^0.16.11", "lodash-es": "^4.17.21", - "md5": "^2.3.0", "parse5": "^6.0.1", "preact": "^10.22.1", "process": "^0.11.10", @@ -91,7 +88,6 @@ "eslint": "^8.57.1", "eslint-plugin-react": "^7.37.5", "fs-extra": "^11.2.0", - "graphql-tag": "^2.12.6", "jsdom": "^28.1.0", "less-loader": "^11.1.4", "mini-css-extract-plugin": "^2.10.2", diff --git a/src/config/index.mjs b/src/config/index.mjs index c4659af0b..9b345abd3 100644 --- a/src/config/index.mjs +++ b/src/config/index.mjs @@ -4,7 +4,6 @@ import { isMobile } from '../utils/is-mobile.mjs' import { getApiModesFromConfig, isInApiModeGroup, - isUsingModelName, modelNameToDesc, reconcileMaterializedApiModeDefaults, } from '../utils/model-name-convert.mjs' @@ -108,21 +107,6 @@ export const chatglmApiModelKeys = [ 'chatglm4Long', ] export const githubThirdPartyApiModelKeys = ['waylaidwandererApi'] -export const poeWebModelKeys = [ - 'poeAiWebSage', //poe.com/Assistant - 'poeAiWebGPT4', - 'poeAiWebGPT4_32k', - 'poeAiWebClaudePlus', - 'poeAiWebClaude', - 'poeAiWebClaude100k', - 'poeAiWebCustom', - 'poeAiWebChatGpt', - 'poeAiWebChatGpt_16k', - 'poeAiWebGooglePaLM', - 'poeAiWeb_Llama_2_7b', - 'poeAiWeb_Llama_2_13b', - 'poeAiWeb_Llama_2_70b', -] export const moonshotApiModelKeys = [ 'moonshot_k2_5', 'moonshot_kimi_latest', @@ -417,20 +401,6 @@ export const Models = { azureOpenAi: { value: '', desc: 'Azure OpenAI' }, waylaidwandererApi: { value: '', desc: 'Waylaidwanderer API (Github)' }, - poeAiWebSage: { value: 'Assistant', desc: 'Poe AI (Web, Assistant)' }, - poeAiWebGPT4: { value: 'gpt-4', desc: 'Poe AI (Web, GPT-4)' }, - poeAiWebGPT4_32k: { value: 'gpt-4-32k', desc: 'Poe AI (Web, GPT-4-32k)' }, - poeAiWebClaudePlus: { value: 'claude-2-100k', desc: 'Poe AI (Web, Claude 2 100k)' }, - poeAiWebClaude: { value: 'claude-instant', desc: 'Poe AI (Web, Claude instant)' }, - poeAiWebClaude100k: { value: 'claude-instant-100k', desc: 'Poe AI (Web, Claude instant 100k)' }, - poeAiWebGooglePaLM: { value: 'Google-PaLM', desc: 'Poe AI (Web, Google-PaLM)' }, - poeAiWeb_Llama_2_7b: { value: 'Llama-2-7b', desc: 'Poe AI (Web, Llama-2-7b)' }, - poeAiWeb_Llama_2_13b: { value: 'Llama-2-13b', desc: 'Poe AI (Web, Llama-2-13b)' }, - poeAiWeb_Llama_2_70b: { value: 'Llama-2-70b', desc: 'Poe AI (Web, Llama-2-70b)' }, - poeAiWebChatGpt: { value: 'chatgpt', desc: 'Poe AI (Web, ChatGPT)' }, - poeAiWebChatGpt_16k: { value: 'chatgpt-16k', desc: 'Poe AI (Web, ChatGPT-16k)' }, - poeAiWebCustom: { value: '', desc: 'Poe AI (Web, Custom)' }, - moonshot_k2_5: { value: 'kimi-k2.5', desc: 'Kimi.Moonshot (Kimi K2.5)', @@ -795,8 +765,6 @@ export const defaultConfig = { azureEndpoint: '', azureDeploymentName: '', - poeCustomBotName: '', - anthropicApiKey: '', chatglmApiKey: '', moonshotApiKey: '', @@ -1039,13 +1007,6 @@ export function isUsingCustomModel(configOrSession) { return isInApiModeGroup(customApiModelKeys, configOrSession) } -/** - * @deprecated - */ -export function isUsingCustomNameOnlyModel(configOrSession) { - return isUsingModelName('poeAiWebCustom', configOrSession) -} - export async function getPreferredLanguageKey() { const config = await getUserConfig() if (config.preferredLanguage === 'auto') return config.userLanguage diff --git a/src/manifest.json b/src/manifest.json index d0edd64c6..da882afb2 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -13,7 +13,6 @@ "https://*.chatgpt.com/*", "https://*.openai.com/*", "https://*.bing.com/*", - "https://*.poe.com/*", "https://*.google.com/*", "https://claude.ai/*", "https://*.moonshot.cn/*", diff --git a/src/manifest.v2.json b/src/manifest.v2.json index 3619cac65..539584eb7 100644 --- a/src/manifest.v2.json +++ b/src/manifest.v2.json @@ -21,7 +21,6 @@ "https://*.openai.com/", "https://*.bing.com/", "wss://*.bing.com/*", - "https://*.poe.com/", "https://*.google.com/", "https://claude.ai/", "https://*.moonshot.cn/*", diff --git a/src/services/apis/poe-web.mjs b/src/services/apis/poe-web.mjs deleted file mode 100644 index db7fbfa3b..000000000 --- a/src/services/apis/poe-web.mjs +++ /dev/null @@ -1,50 +0,0 @@ -import { pushRecord, setAbortController } from './shared.mjs' -import PoeAiClient from '../clients/poe/index.mjs' - -/** - * @param {Runtime.Port} port - * @param {string} question - * @param {Session} session - * @param {string} modelName - */ -export async function generateAnswersWithPoeWebApi(port, question, session, modelName) { - const bot = new PoeAiClient(session.poe_chatId) - const { messageListener, disconnectListener } = setAbortController( - port, - () => { - bot.close() - }, - () => { - bot.breakMsg() - bot.close() - }, - ) - - let answer = '' - await bot - .ask( - question, - modelName, - (msg) => { - answer += msg - port.postMessage({ answer: answer, done: false, session: null }) - }, - () => { - if (bot.chatId) session.poe_chatId = bot.chatId - - pushRecord(session, question, answer) - console.debug('conversation history', { content: session.conversationRecords }) - port.onMessage.removeListener(messageListener) - if (session.conversationRecords.length > 1) - port.onDisconnect.removeListener(disconnectListener) - port.postMessage({ answer: answer, done: true, session: session }) - bot.close() - }, - ) - .catch((err) => { - port.onMessage.removeListener(messageListener) - port.onDisconnect.removeListener(disconnectListener) - bot.close() - throw err - }) -} diff --git a/src/services/clients/poe/graphql/AddHumanMessageMutation.graphql b/src/services/clients/poe/graphql/AddHumanMessageMutation.graphql deleted file mode 100644 index 01e6bc8cd..000000000 --- a/src/services/clients/poe/graphql/AddHumanMessageMutation.graphql +++ /dev/null @@ -1,52 +0,0 @@ -mutation AddHumanMessageMutation( - $chatId: BigInt! - $bot: String! - $query: String! - $source: MessageSource - $withChatBreak: Boolean! = false -) { - messageCreateWithStatus( - chatId: $chatId - bot: $bot - query: $query - source: $source - withChatBreak: $withChatBreak - ) { - message { - id - __typename - messageId - text - linkifiedText - authorNickname - state - vote - voteReason - creationTime - suggestedReplies - chat { - id - shouldShowDisclaimer - } - } - messageLimit{ - canSend - numMessagesRemaining - resetTime - shouldShowReminder - } - chatBreak { - id - __typename - messageId - text - linkifiedText - authorNickname - state - vote - voteReason - creationTime - suggestedReplies - } - } -} diff --git a/src/services/clients/poe/graphql/AddMessageBreakMutation.graphql b/src/services/clients/poe/graphql/AddMessageBreakMutation.graphql deleted file mode 100644 index b28d9903c..000000000 --- a/src/services/clients/poe/graphql/AddMessageBreakMutation.graphql +++ /dev/null @@ -1,17 +0,0 @@ -mutation AddMessageBreakMutation($chatId: BigInt!) { - messageBreakCreate(chatId: $chatId) { - message { - id - __typename - messageId - text - linkifiedText - authorNickname - state - vote - voteReason - creationTime - suggestedReplies - } - } -} diff --git a/src/services/clients/poe/graphql/AutoSubscriptionMutation.graphql b/src/services/clients/poe/graphql/AutoSubscriptionMutation.graphql deleted file mode 100644 index 6cf7bf742..000000000 --- a/src/services/clients/poe/graphql/AutoSubscriptionMutation.graphql +++ /dev/null @@ -1,7 +0,0 @@ -mutation AutoSubscriptionMutation($subscriptions: [AutoSubscriptionQuery!]!) { - autoSubscribe(subscriptions: $subscriptions) { - viewer { - id - } - } -} diff --git a/src/services/clients/poe/graphql/BioFragment.graphql b/src/services/clients/poe/graphql/BioFragment.graphql deleted file mode 100644 index c42180309..000000000 --- a/src/services/clients/poe/graphql/BioFragment.graphql +++ /dev/null @@ -1,8 +0,0 @@ -fragment BioFragment on Viewer { - id - poeUser { - id - uid - bio - } -} diff --git a/src/services/clients/poe/graphql/ChatAddedSubscription.graphql b/src/services/clients/poe/graphql/ChatAddedSubscription.graphql deleted file mode 100644 index 664b107fa..000000000 --- a/src/services/clients/poe/graphql/ChatAddedSubscription.graphql +++ /dev/null @@ -1,5 +0,0 @@ -subscription ChatAddedSubscription { - chatAdded { - ...ChatFragment - } -} diff --git a/src/services/clients/poe/graphql/ChatFragment.graphql b/src/services/clients/poe/graphql/ChatFragment.graphql deleted file mode 100644 index 605645ff3..000000000 --- a/src/services/clients/poe/graphql/ChatFragment.graphql +++ /dev/null @@ -1,6 +0,0 @@ -fragment ChatFragment on Chat { - id - chatId - defaultBotNickname - shouldShowDisclaimer -} diff --git a/src/services/clients/poe/graphql/ChatPaginationQuery.graphql b/src/services/clients/poe/graphql/ChatPaginationQuery.graphql deleted file mode 100644 index f2452cd6c..000000000 --- a/src/services/clients/poe/graphql/ChatPaginationQuery.graphql +++ /dev/null @@ -1,26 +0,0 @@ -query ChatPaginationQuery($bot: String!, $before: String, $last: Int! = 10) { - chatOfBot(bot: $bot) { - id - __typename - messagesConnection(before: $before, last: $last) { - pageInfo { - hasPreviousPage - } - edges { - node { - id - __typename - messageId - text - linkifiedText - authorNickname - state - vote - voteReason - creationTime - suggestedReplies - } - } - } - } -} diff --git a/src/services/clients/poe/graphql/ChatViewQuery.graphql b/src/services/clients/poe/graphql/ChatViewQuery.graphql deleted file mode 100644 index c330107df..000000000 --- a/src/services/clients/poe/graphql/ChatViewQuery.graphql +++ /dev/null @@ -1,8 +0,0 @@ -query ChatViewQuery($bot: String!) { - chatOfBot(bot: $bot) { - id - chatId - defaultBotNickname - shouldShowDisclaimer - } -} diff --git a/src/services/clients/poe/graphql/DeleteHumanMessagesMutation.graphql b/src/services/clients/poe/graphql/DeleteHumanMessagesMutation.graphql deleted file mode 100644 index 42692c6e3..000000000 --- a/src/services/clients/poe/graphql/DeleteHumanMessagesMutation.graphql +++ /dev/null @@ -1,7 +0,0 @@ -mutation DeleteHumanMessagesMutation($messageIds: [BigInt!]!) { - messagesDelete(messageIds: $messageIds) { - viewer { - id - } - } -} diff --git a/src/services/clients/poe/graphql/HandleFragment.graphql b/src/services/clients/poe/graphql/HandleFragment.graphql deleted file mode 100644 index f53c484be..000000000 --- a/src/services/clients/poe/graphql/HandleFragment.graphql +++ /dev/null @@ -1,8 +0,0 @@ -fragment HandleFragment on Viewer { - id - poeUser { - id - uid - handle - } -} diff --git a/src/services/clients/poe/graphql/LoginWithVerificationCodeMutation.graphql b/src/services/clients/poe/graphql/LoginWithVerificationCodeMutation.graphql deleted file mode 100644 index 723b1f44b..000000000 --- a/src/services/clients/poe/graphql/LoginWithVerificationCodeMutation.graphql +++ /dev/null @@ -1,13 +0,0 @@ -mutation LoginWithVerificationCodeMutation( - $verificationCode: String! - $emailAddress: String - $phoneNumber: String -) { - loginWithVerificationCode( - verificationCode: $verificationCode - emailAddress: $emailAddress - phoneNumber: $phoneNumber - ) { - status - } -} diff --git a/src/services/clients/poe/graphql/MessageAddedSubscription.graphql b/src/services/clients/poe/graphql/MessageAddedSubscription.graphql deleted file mode 100644 index 0492baae5..000000000 --- a/src/services/clients/poe/graphql/MessageAddedSubscription.graphql +++ /dev/null @@ -1,5 +0,0 @@ -subscription MessageAddedSubscription($chatId: BigInt!) { - messageAdded(chatId: $chatId) { - ...MessageFragment - } -} diff --git a/src/services/clients/poe/graphql/MessageDeletedSubscription.graphql b/src/services/clients/poe/graphql/MessageDeletedSubscription.graphql deleted file mode 100644 index 54c1c164e..000000000 --- a/src/services/clients/poe/graphql/MessageDeletedSubscription.graphql +++ /dev/null @@ -1,6 +0,0 @@ -subscription MessageDeletedSubscription($chatId: BigInt!) { - messageDeleted(chatId: $chatId) { - id - messageId - } -} diff --git a/src/services/clients/poe/graphql/MessageFragment.graphql b/src/services/clients/poe/graphql/MessageFragment.graphql deleted file mode 100644 index cc8608117..000000000 --- a/src/services/clients/poe/graphql/MessageFragment.graphql +++ /dev/null @@ -1,13 +0,0 @@ -fragment MessageFragment on Message { - id - __typename - messageId - text - linkifiedText - authorNickname - state - vote - voteReason - creationTime - suggestedReplies -} diff --git a/src/services/clients/poe/graphql/MessageRemoveVoteMutation.graphql b/src/services/clients/poe/graphql/MessageRemoveVoteMutation.graphql deleted file mode 100644 index d5e6e6107..000000000 --- a/src/services/clients/poe/graphql/MessageRemoveVoteMutation.graphql +++ /dev/null @@ -1,7 +0,0 @@ -mutation MessageRemoveVoteMutation($messageId: BigInt!) { - messageRemoveVote(messageId: $messageId) { - message { - ...MessageFragment - } - } -} diff --git a/src/services/clients/poe/graphql/MessageSetVoteMutation.graphql b/src/services/clients/poe/graphql/MessageSetVoteMutation.graphql deleted file mode 100644 index 76000df0e..000000000 --- a/src/services/clients/poe/graphql/MessageSetVoteMutation.graphql +++ /dev/null @@ -1,7 +0,0 @@ -mutation MessageSetVoteMutation($messageId: BigInt!, $voteType: VoteType!, $reason: String) { - messageSetVote(messageId: $messageId, voteType: $voteType, reason: $reason) { - message { - ...MessageFragment - } - } -} diff --git a/src/services/clients/poe/graphql/SendVerificationCodeForLoginMutation.graphql b/src/services/clients/poe/graphql/SendVerificationCodeForLoginMutation.graphql deleted file mode 100644 index 45af47991..000000000 --- a/src/services/clients/poe/graphql/SendVerificationCodeForLoginMutation.graphql +++ /dev/null @@ -1,12 +0,0 @@ -mutation SendVerificationCodeForLoginMutation( - $emailAddress: String - $phoneNumber: String -) { - sendVerificationCode( - verificationReason: login - emailAddress: $emailAddress - phoneNumber: $phoneNumber - ) { - status - } -} diff --git a/src/services/clients/poe/graphql/ShareMessagesMutation.graphql b/src/services/clients/poe/graphql/ShareMessagesMutation.graphql deleted file mode 100644 index 92e80db57..000000000 --- a/src/services/clients/poe/graphql/ShareMessagesMutation.graphql +++ /dev/null @@ -1,9 +0,0 @@ -mutation ShareMessagesMutation( - $chatId: BigInt! - $messageIds: [BigInt!]! - $comment: String -) { - messagesShare(chatId: $chatId, messageIds: $messageIds, comment: $comment) { - shareCode - } -} diff --git a/src/services/clients/poe/graphql/SignupWithVerificationCodeMutation.graphql b/src/services/clients/poe/graphql/SignupWithVerificationCodeMutation.graphql deleted file mode 100644 index 06b2826fa..000000000 --- a/src/services/clients/poe/graphql/SignupWithVerificationCodeMutation.graphql +++ /dev/null @@ -1,13 +0,0 @@ -mutation SignupWithVerificationCodeMutation( - $verificationCode: String! - $emailAddress: String - $phoneNumber: String -) { - signupWithVerificationCode( - verificationCode: $verificationCode - emailAddress: $emailAddress - phoneNumber: $phoneNumber - ) { - status - } -} diff --git a/src/services/clients/poe/graphql/StaleChatUpdateMutation.graphql b/src/services/clients/poe/graphql/StaleChatUpdateMutation.graphql deleted file mode 100644 index de203d47c..000000000 --- a/src/services/clients/poe/graphql/StaleChatUpdateMutation.graphql +++ /dev/null @@ -1,7 +0,0 @@ -mutation StaleChatUpdateMutation($chatId: BigInt!) { - staleChatUpdate(chatId: $chatId) { - message { - ...MessageFragment - } - } -} diff --git a/src/services/clients/poe/graphql/SummarizePlainPostQuery.graphql b/src/services/clients/poe/graphql/SummarizePlainPostQuery.graphql deleted file mode 100644 index afa2a84c0..000000000 --- a/src/services/clients/poe/graphql/SummarizePlainPostQuery.graphql +++ /dev/null @@ -1,3 +0,0 @@ -query SummarizePlainPostQuery($comment: String!) { - summarizePlainPost(comment: $comment) -} diff --git a/src/services/clients/poe/graphql/SummarizeQuotePostQuery.graphql b/src/services/clients/poe/graphql/SummarizeQuotePostQuery.graphql deleted file mode 100644 index 5147c3c5b..000000000 --- a/src/services/clients/poe/graphql/SummarizeQuotePostQuery.graphql +++ /dev/null @@ -1,3 +0,0 @@ -query SummarizeQuotePostQuery($comment: String, $quotedPostId: BigInt!) { - summarizeQuotePost(comment: $comment, quotedPostId: $quotedPostId) -} diff --git a/src/services/clients/poe/graphql/SummarizeSharePostQuery.graphql b/src/services/clients/poe/graphql/SummarizeSharePostQuery.graphql deleted file mode 100644 index cb4a623c4..000000000 --- a/src/services/clients/poe/graphql/SummarizeSharePostQuery.graphql +++ /dev/null @@ -1,3 +0,0 @@ -query SummarizeSharePostQuery($comment: String!, $chatId: BigInt!, $messageIds: [BigInt!]!) { - summarizeSharePost(comment: $comment, chatId: $chatId, messageIds: $messageIds) -} diff --git a/src/services/clients/poe/graphql/UserSnippetFragment.graphql b/src/services/clients/poe/graphql/UserSnippetFragment.graphql deleted file mode 100644 index 17fc84264..000000000 --- a/src/services/clients/poe/graphql/UserSnippetFragment.graphql +++ /dev/null @@ -1,14 +0,0 @@ -fragment UserSnippetFragment on PoeUser { - id - uid - bio - handle - fullName - viewerIsFollowing - isPoeOnlyUser - profilePhotoURLTiny: profilePhotoUrl(size: tiny) - profilePhotoURLSmall: profilePhotoUrl(size: small) - profilePhotoURLMedium: profilePhotoUrl(size: medium) - profilePhotoURLLarge: profilePhotoUrl(size: large) - isFollowable -} diff --git a/src/services/clients/poe/graphql/ViewerInfoQuery.graphql b/src/services/clients/poe/graphql/ViewerInfoQuery.graphql deleted file mode 100644 index 1ecaf9e83..000000000 --- a/src/services/clients/poe/graphql/ViewerInfoQuery.graphql +++ /dev/null @@ -1,21 +0,0 @@ -query ViewerInfoQuery { - viewer { - id - uid - ...ViewerStateFragment - ...BioFragment - ...HandleFragment - hasCompletedMultiplayerNux - poeUser { - id - ...UserSnippetFragment - } - messageLimit{ - canSend - numMessagesRemaining - resetTime - shouldShowReminder - } - } -} - diff --git a/src/services/clients/poe/graphql/ViewerStateFragment.graphql b/src/services/clients/poe/graphql/ViewerStateFragment.graphql deleted file mode 100644 index 3cd83e9c9..000000000 --- a/src/services/clients/poe/graphql/ViewerStateFragment.graphql +++ /dev/null @@ -1,30 +0,0 @@ -fragment ViewerStateFragment on Viewer { - id - __typename - iosMinSupportedVersion: integerGate(gateName: "poe_ios_min_supported_version") - iosMinEncouragedVersion: integerGate( - gateName: "poe_ios_min_encouraged_version" - ) - macosMinSupportedVersion: integerGate( - gateName: "poe_macos_min_supported_version" - ) - macosMinEncouragedVersion: integerGate( - gateName: "poe_macos_min_encouraged_version" - ) - showPoeDebugPanel: booleanGate(gateName: "poe_show_debug_panel") - enableCommunityFeed: booleanGate(gateName: "enable_poe_shares_feed") - linkifyText: booleanGate(gateName: "poe_linkify_response") - enableSuggestedReplies: booleanGate(gateName: "poe_suggested_replies") - removeInviteLimit: booleanGate(gateName: "poe_remove_invite_limit") - enableInAppPurchases: booleanGate(gateName: "poe_enable_in_app_purchases") - availableBots { - nickname - displayName - profilePicture - isDown - disclaimer - subtitle - poweredBy - } -} - diff --git a/src/services/clients/poe/graphql/ViewerStateUpdatedSubscription.graphql b/src/services/clients/poe/graphql/ViewerStateUpdatedSubscription.graphql deleted file mode 100644 index dd6d2d1f4..000000000 --- a/src/services/clients/poe/graphql/ViewerStateUpdatedSubscription.graphql +++ /dev/null @@ -1,5 +0,0 @@ -subscription ViewerStateUpdatedSubscription { - viewerStateUpdated { - ...ViewerStateFragment - } -} diff --git a/src/services/clients/poe/index.mjs b/src/services/clients/poe/index.mjs deleted file mode 100644 index c8bef0eb8..000000000 --- a/src/services/clients/poe/index.mjs +++ /dev/null @@ -1,182 +0,0 @@ -// reference: https://github.com/muharamdani/poe - -import { connectWs, disconnectWs, listenWs } from './websocket.js' -import chatViewQuery from './graphql/ChatViewQuery.graphql' -import addMessageBreakMutation from './graphql/AddMessageBreakMutation.graphql' -import addHumanMessageMutation from './graphql/AddHumanMessageMutation.graphql' -import Browser from 'webextension-polyfill' -import md5 from 'md5' - -const queries = { - chatViewQuery: chatViewQuery.loc.source.body, - addMessageBreakMutation: addMessageBreakMutation.loc.source.body, - addHumanMessageMutation: addHumanMessageMutation.loc.source.body, -} - -export default class PoeAiClient { - constructor(chatId = null) { - this.headers = { - 'Content-Type': 'application/json', - Accept: 'application/json', - Origin: 'https://poe.com', - } - this.settings = null - this.ws = null - this.chatId = chatId - this.bot = null - } - - async ask(message, model, onMessage, onComplete) { - if (!this.settings) { - await this.getCredentials() - } - if (!this.bot) { - await this.initBot(model || 'Assistant') - } - if (!this.chatId) { - await this.getChatId(this.bot) - } - if (!this.ws) { - this.ws = await connectWs(this.settings) - await this.subscribe() - listenWs(this.ws, onMessage, onComplete) - } - await this.sendMsg(message) - } - - async close() { - if (this.ws) { - await disconnectWs(this.ws) - this.ws = null - } - } - - async getFormkey() { - const encoded = (await (await fetch('https://poe.com')).text()).match( - /