diff --git a/docs/changelog.md b/docs/changelog.md index c5c8f6fb..13a48049 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -6,6 +6,14 @@ Consider giving a star ⭐ on [Github](https://github.com/pnd280/complexity). 💖 Support the development via [Ko-fi](https://ko-fi.com/pnd280) or [Paypal](https://paypal.me/pnd280). +## v0.0.3.13 + +_Release date: 11th Oct, 2024_ + +- **FIX**: Adapt to new query box dynamic placeholders - fixed a bug where selectors are not showing. +- **REMOVE**: **Temporarily** removed **Auto-generate thread title** setting. + + ## v0.0.3.11 _Release date: 8th Oct, 2024_ diff --git a/src/content-script/index.ts b/src/content-script/index.ts index f729d563..2fceb40e 100644 --- a/src/content-script/index.ts +++ b/src/content-script/index.ts @@ -86,7 +86,6 @@ function initTrafficInterceptors() { WebpageMessageInterceptor.alterQueries(); WebpageMessageInterceptor.blockTelemetry(); WebpageMessageInterceptor.removeComplexityIdentifier(); - WebpageMessageInterceptor.autoRenameThread(); } function initConsoleMessage() { diff --git a/src/content-script/main-world/WebpageMessageInterceptors.ts b/src/content-script/main-world/WebpageMessageInterceptors.ts index 1f80de8c..ea447816 100644 --- a/src/content-script/main-world/WebpageMessageInterceptors.ts +++ b/src/content-script/main-world/WebpageMessageInterceptors.ts @@ -19,10 +19,8 @@ import { isWebSocketEventData, WsParsedMessage, } from "@/types/ws.types"; -import { DomHelperSelectors, DomSelectors } from "@/utils/DomSelectors"; import { queryClient } from "@/utils/ts-query-query-client"; -import UiUtils from "@/utils/UiUtils"; -import { jsonUtils, waitForElement, whereAmI } from "@/utils/utils"; +import { jsonUtils } from "@/utils/utils"; import WsMessageParser from "@/utils/WsMessageParser"; export default class WebpageMessageInterceptor { @@ -271,133 +269,6 @@ export default class WebpageMessageInterceptor { }); } - static autoRenameThread() { - const prompt = ` -# IDENTITY and PURPOSE - -You are an expert content summarizer. Your task is to generate a concise, one-line title that captures the essence of the provided text. - -## STEPS - -- Synthesize your understanding of the text into a single title consisting of 3-10 words, optionally starting with an emoji. -- Ensure the title is straightforward and easy to comprehend. -- The title should reflect the main topic, task, or purpose of the text. - -## OUTPUT INSTRUCTIONS - -- Provide the title in plain text without any special characters or Markdown formatting. -- Respond strictly with the title; do not include any additional text or context. -- The title must be in the same language as the original text. - -## THE TEXT: -`; - - if ( - !CplxUserSettings.get().generalSettings.qolTweaks.autoGenerateThreadTitle - ) - return; - - webpageMessenger.addInterceptor({ - matchCondition: (messageData: MessageData) => { - if (!isWebSocketEventData(messageData)) return { match: false }; - - if (messageData.payload.isInternal) { - return { match: false }; - } - - const parsedPayload = parseStructuredMessage(messageData); - - if (!parsedPayload) return { match: false }; - - if (parsedPayload.data[0]?.length < 1) return { match: false }; - - const { status, query_str, privacy_state } = parsedPayload.data[0]; - - if (status !== "completed" || privacy_state === "INCOGNITO") - return { match: false }; - - if (query_str == null) return { match: false }; - - return { - match: true, - args: [ - { - queryStr: query_str, - }, - ], - }; - }, - callback: async (messageData, args) => { - if (whereAmI() !== "thread") return messageData; - - if ($(DomHelperSelectors.THREAD.MESSAGE.BLOCK).length > 1) - return messageData; - - const queryStr = args[0].queryStr; - - webpageMessenger.sendMessage({ - event: "sendWebSocketMessage", - payload: WsMessageParser.stringify({ - messageCode: 420, - event: "perplexity_ask", - data: [ - prompt + queryStr, - { - version: "2.12", - source: "default", - language: "en-US", - search_focus: "writing", - mode: "concise", - model_preference: "turbo" as LanguageModel["code"], - is_incognito: true, - ignore_interceptor: true, - }, - ], - }), - timeout: 10000, - }); - - const title = - await WebpageMessageInterceptor.waitForThreadNameGeneration({ - queryStr: prompt + queryStr, - }); - - if (!title) return messageData; - - const div = await waitForElement({ - selector: DomSelectors.SICKY_NAVBAR_CHILD.THREAD_TITLE, - timeout: 1000, - }); - - if (div == null) return messageData; - - $(DomSelectors.SICKY_NAVBAR_CHILD.THREAD_TITLE_WRAPPER).css({ - opacity: 0, - }); - - (div as HTMLElement).click(); - - const input = await waitForElement({ - selector: DomSelectors.SICKY_NAVBAR_CHILD.THREAD_TITLE_INPUT, - timeout: 1000, - }); - - if (input == null) return messageData; - - UiUtils.setReactInputValue(input as HTMLInputElement, title); - - $(input).trigger("blur"); - - $(DomSelectors.SICKY_NAVBAR_CHILD.THREAD_TITLE_WRAPPER).css({ - opacity: 100, - }); - - return messageData; - }, - stopCondition: () => false, - }); - } - static waitForUpsertThreadCollection() { const matchCondition = (messageData: MessageData) => { const parsedPayload = parseStructuredMessage(messageData); diff --git a/src/cplx-user-settings/CplxUserSettings.ts b/src/cplx-user-settings/CplxUserSettings.ts index f3ce2108..46737999 100644 --- a/src/cplx-user-settings/CplxUserSettings.ts +++ b/src/cplx-user-settings/CplxUserSettings.ts @@ -34,7 +34,6 @@ export default class CplxUserSettings { blockTelemetry: false, noFileCreationOnPaste: false, fileDropableThreadWrapper: false, - autoGenerateThreadTitle: false, }, visualTweaks: { collapseEmptyThreadVisualColumns: false, diff --git a/src/cplx-user-settings/GeneralSettings.tsx b/src/cplx-user-settings/GeneralSettings.tsx index a0966540..ed54f8be 100644 --- a/src/cplx-user-settings/GeneralSettings.tsx +++ b/src/cplx-user-settings/GeneralSettings.tsx @@ -84,14 +84,6 @@ export default class GeneralSettings { "Automatically reload the page when Cloudflare session expires.", versionRelease: "0.0.0.12", }, - { - id: "auto-generate-thread-title", - label: "Auto-generate thread title", - settingKey: "autoGenerateThreadTitle", - experimental: true, - description: "Auto-generate a 3-10 word title for your thread.", - versionRelease: "0.0.4.0", - }, { id: "no-file-creation-on-paste", label: "No file creation on long text paste", diff --git a/src/cplx-user-settings/types/cplx-user-settings.types.ts b/src/cplx-user-settings/types/cplx-user-settings.types.ts index fb3936e9..c505ca77 100644 --- a/src/cplx-user-settings/types/cplx-user-settings.types.ts +++ b/src/cplx-user-settings/types/cplx-user-settings.types.ts @@ -39,7 +39,6 @@ export const cplxUserSettingsSchema = z.object({ blockTelemetry: z.boolean(), noFileCreationOnPaste: z.boolean(), fileDropableThreadWrapper: z.boolean(), - autoGenerateThreadTitle: z.boolean(), }), visualTweaks: z.object({ collapseEmptyThreadVisualColumns: z.boolean(),