From 137ca5ae1ab135b3f860b1d7a4651fd4b331bb79 Mon Sep 17 00:00:00 2001 From: Rafi Date: Thu, 6 Apr 2023 18:00:24 +0800 Subject: [PATCH] Support Frugal Mode --- components/Conversation.vue | 35 ++++++++++++++++++++++++++++++++++- components/MsgContent.vue | 1 - lang/en-US.json | 2 ++ lang/ru-RU.json | 2 ++ lang/zh-CN.json | 2 ++ 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/components/Conversation.vue b/components/Conversation.vue index ead2b96..659e869 100644 --- a/components/Conversation.vue +++ b/components/Conversation.vue @@ -7,6 +7,7 @@ const currentModel = useCurrentModel() const openaiApiKey = useApiKey() const fetchingResponse = ref(false) const messageQueue = [] +const frugalMode = ref(true) let isProcessingQueue = false const props = defineProps({ @@ -64,7 +65,8 @@ const fetchReply = async (message) => { const data = Object.assign({}, currentModel.value, { openaiApiKey: enableCustomApiKey.value ? openaiApiKey.value : null, message: message, - conversationId: props.conversation.id + conversationId: props.conversation.id, + frugalMode: frugalMode.value }, webSearchParams) try { @@ -259,11 +261,42 @@ onNuxtReady(() => { + + + + + diff --git a/components/MsgContent.vue b/components/MsgContent.vue index f622424..1095ffd 100644 --- a/components/MsgContent.vue +++ b/components/MsgContent.vue @@ -51,7 +51,6 @@ const bindCopyCodeToButtons = () => { } onMounted(() => { - console.log('mounted') bindCopyCodeToButtons() }) diff --git a/lang/en-US.json b/lang/en-US.json index a3921a1..97f807a 100644 --- a/lang/en-US.json +++ b/lang/en-US.json @@ -52,6 +52,8 @@ "genTitlePrompt": "Generate a short title for the following content, no more than 10 words. \n\nContent: ", "maxTokenTips1": "The maximum context length of the current model is", "maxTokenTips2": "token, which includes the length of the prompt and the length of the generated text. The `Max Tokens` here refers to the length of the generated text. Therefore, you should leave some space for your prompt and not set it too large or to the maximum.", + "frugalMode": "Frugal mode", + "frugalModeTip": "Activate frugal mode, the client will not send historical messages to ChatGPT, which can save token consumption. If you want ChatGPT to understand the context of the conversation, please turn off frugal mode.", "welcomeScreen": { "introduction1": "is an unofficial client for ChatGPT, but uses the official OpenAI API.", "introduction2": "You will need an OpenAI API Key before you can use this client.", diff --git a/lang/ru-RU.json b/lang/ru-RU.json index a27ad20..3026e92 100644 --- a/lang/ru-RU.json +++ b/lang/ru-RU.json @@ -52,6 +52,8 @@ "genTitlePrompt": "Придумайте короткий заголовок для следующего содержания, не более 10 слов. \n\nСодержание: ", "maxTokenTips1": "The maximum context length of the current model is", "maxTokenTips2": "token, which includes the length of the prompt and the length of the generated text. The `Max Tokens` here refers to the length of the generated text. Therefore, you should leave some space for your prompt and not set it too large or to the maximum.", + "frugalMode": "Frugal mode", + "frugalModeTip": "Activate frugal mode, the client will not send historical messages to ChatGPT, which can save token consumption. If you want ChatGPT to understand the context of the conversation, please turn off frugal mode.", "welcomeScreen": { "introduction1": "является неофициальным клиентом для ChatGPT, но использует официальный API OpenAI.", "introduction2": "Вам понадобится ключ API OpenAI, прежде чем вы сможете использовать этот клиент.", diff --git a/lang/zh-CN.json b/lang/zh-CN.json index 67e2dd7..e60353d 100644 --- a/lang/zh-CN.json +++ b/lang/zh-CN.json @@ -52,6 +52,8 @@ "genTitlePrompt": "为以下内容生成一个不超过10个字的简短标题。 \n\n内容: ", "maxTokenTips1": "当前模型的最大上下文长度为", "maxTokenTips2": "个 token,它包括了指令的长度和生成的文本长度。此处的最大 token 数量是指生成的文本长度。所以您应该为您的指令预留一些空间,不宜设置过大或拉满。", + "frugalMode": "节俭模式", + "frugalModeTip": "开启节俭模式,客户端不会把历史消息发送给ChatGPT,可以节省 token 的消耗。如果你想让 ChatGPT 了解对话的上下文,请关闭节俭模式。", "welcomeScreen": { "introduction1": "是一个非官方的ChatGPT客户端,但使用OpenAI的官方API", "introduction2": "在使用本客户端之前,您需要一个OpenAI API密钥。",