mirror of
https://github.com/Chanzhaoyu/chatgpt-web.git
synced 2025-07-23 14:03:43 +00:00
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:
@@ -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"
|
||||
|
Reference in New Issue
Block a user