Skip to content

Commit

Permalink
Support Frugal Mode
Browse files Browse the repository at this point in the history
  • Loading branch information
WongSaang committed Apr 6, 2023
1 parent 8a9b705 commit 137ca5a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
35 changes: 34 additions & 1 deletion components/Conversation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -259,11 +261,42 @@ onNuxtReady(() => {
<v-switch
v-if="showWebSearchToggle"
v-model="enableWebSearch"
inline
hide-details
color="primary"
:label="$t('webSearch')"
></v-switch>
<v-spacer></v-spacer>
<v-switch
v-model="frugalMode"
inline
hide-details
color="primary"
:label="$t('frugalMode')"
></v-switch>
<v-dialog
transition="dialog-bottom-transition"
width="auto"
>
<template v-slot:activator="{ props }">
<v-icon
color="grey"
v-bind="props"
icon="help_outline"
></v-icon>
</template>
<template v-slot:default="{ isActive }">
<v-card>
<v-toolbar
color="primary"
:title="$t('frugalMode')"
></v-toolbar>
<v-card-text>
{{ $t('frugalModeTip') }}
</v-card-text>
</v-card>
</template>
</v-dialog>
</v-toolbar>
</div>
</v-footer>
Expand Down
1 change: 0 additions & 1 deletion components/MsgContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const bindCopyCodeToButtons = () => {
}
onMounted(() => {
console.log('mounted')
bindCopyCodeToButtons()
})
Expand Down
2 changes: 2 additions & 0 deletions lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 2 additions & 0 deletions lang/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -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, прежде чем вы сможете использовать этот клиент.",
Expand Down
2 changes: 2 additions & 0 deletions lang/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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密钥。",
Expand Down

0 comments on commit 137ca5a

Please # to comment.