From 444e2ec2e89bb4b17de5914ab09dcc890538e9d5 Mon Sep 17 00:00:00 2001 From: CornerSkyless <573196853@qq.com> Date: Thu, 9 Mar 2023 17:56:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=8F=AF=E4=BB=A5=E6=98=AF=E5=90=A6=E8=A6=81=E5=8F=91?= =?UTF-8?q?=E9=80=81=E5=8E=86=E5=8F=B2=E4=B8=8A=E4=B8=8B=E6=96=87=E7=9A=84?= =?UTF-8?q?=E5=BC=80=E5=85=B3=20(#393)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 更新文档 * Improve zh-TW locale (#379) * fix: 移动端样式 * feat: typo * fix: 调整滚动回原样 * feat: 支持切换是否要发送前文信息 * style: 修复 lint --------- Co-authored-by: ChenZhaoYu <790348264@qq.com> Co-authored-by: Peter Dave Hello --- src/locales/en-US.ts | 3 +++ src/locales/zh-CN.ts | 3 +++ src/locales/zh-TW.ts | 3 +++ src/views/chat/index.vue | 26 +++++++++++++++++++++++++- 4 files changed, 34 insertions(+), 1 deletion(-) 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(() => { + + + + +