feat: 增加了一个可以是否要发送历史上下文的开关 (#393)

* 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 <hsu@peterdavehello.org>
This commit is contained in:
CornerSkyless
2023-03-09 17:56:11 +08:00
committed by GitHub
parent 60b7874f65
commit 444e2ec2e8
4 changed files with 34 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ const conversationList = computed(() => dataSources.value.filter(item => (!item.
const prompt = ref<string>('')
const loading = ref<boolean>(false)
const usingContext = ref<boolean>(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(() => {
<SvgIcon icon="ri:download-2-line" />
</span>
</HoverButton>
<HoverButton @click="toggleUsingContext">
<span class="text-xl" :class="{ 'text-[#4b9e5f]': usingContext, 'text-[#a8071a]': !usingContext }">
<SvgIcon icon="ri:chat-history-line" />
</span>
</HoverButton>
<NInput
v-model:value="prompt"
type="textarea"