diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts index 8c3bdd0..e8b470b 100644 --- a/src/locales/en-US.ts +++ b/src/locales/en-US.ts @@ -27,6 +27,9 @@ export default { exportImageConfirm: 'Are you sure to export this chat to png?', exportSuccess: 'Export Success', exportFailed: 'Export Failed', + usingContext: 'Context Mode', + turnOnContext: 'In the current mode, sending messages will carry previous chat records.', + turnOffContext: 'In the current mode, sending messages will not carry previous chat records.', deleteMessage: 'Delete Message', deleteMessageConfirm: 'Are you sure to delete this message?', deleteHistoryConfirm: 'Are you sure to clear this history?', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index c9e5bb1..a0cb26b 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -27,6 +27,9 @@ export default { exportImageConfirm: '是否将会话保存为图片?', exportSuccess: '保存成功', exportFailed: '保存失败', + usingContext: '上下文模式', + turnOnContext: '当前模式下, 发送消息会携带之前的聊天记录', + turnOffContext: '当前模式下, 发送消息不会携带之前的聊天记录', deleteMessage: '删除消息', deleteMessageConfirm: '是否删除此消息?', deleteHistoryConfirm: '确定删除此记录?', diff --git a/src/locales/zh-TW.ts b/src/locales/zh-TW.ts index 5412fa7..fab8d12 100644 --- a/src/locales/zh-TW.ts +++ b/src/locales/zh-TW.ts @@ -27,6 +27,9 @@ export default { exportImageConfirm: '是否將對話儲存為圖片?', exportSuccess: '儲存成功', exportFailed: '儲存失敗', + usingContext: '上下文模式', + turnOnContext: '在當前模式下, 發送訊息會攜帶之前的聊天記錄。', + turnOffContext: '在當前模式下, 發送訊息不會攜帶之前的聊天記錄。', deleteMessage: '刪除訊息', deleteMessageConfirm: '是否刪除此訊息?', deleteHistoryConfirm: '確定刪除此紀錄?', diff --git a/src/views/chat/index.vue b/src/views/chat/index.vue index 2fefff9..d876a00 100644 --- a/src/views/chat/index.vue +++ b/src/views/chat/index.vue @@ -33,6 +33,7 @@ const conversationList = computed(() => dataSources.value.filter(item => (!item. const prompt = ref('') const loading = ref(false) +const usingContext = ref(true) function handleSubmit() { onConversation() @@ -68,7 +69,7 @@ async function onConversation() { let options: Chat.ConversationRequest = {} const lastContext = conversationList.value[conversationList.value.length - 1]?.conversationOptions - if (lastContext) + if (lastContext && usingContext.value) options = { ...lastContext } addChat( @@ -363,6 +364,24 @@ function handleStop() { } } +function toggleUsingContext() { + usingContext.value = !usingContext.value + if (usingContext.value) { + dialog.info({ + title: t('chat.usingContext'), + content: t('chat.turnOnContext'), + positiveText: t('common.yes'), + }) + } + else { + dialog.info({ + title: t('chat.usingContext'), + content: t('chat.turnOffContext'), + positiveText: t('common.yes'), + }) + } +} + const placeholder = computed(() => { if (isMobile.value) return t('chat.placeholderMobile') @@ -450,6 +469,11 @@ onUnmounted(() => { + + + + +