|
|
@ -33,6 +33,7 @@ const conversationList = computed(() => dataSources.value.filter(item => (!item.
|
|
|
|
|
|
|
|
|
|
|
|
const prompt = ref<string>('')
|
|
|
|
const prompt = ref<string>('')
|
|
|
|
const loading = ref<boolean>(false)
|
|
|
|
const loading = ref<boolean>(false)
|
|
|
|
|
|
|
|
const usingContext = ref<boolean>(true)
|
|
|
|
|
|
|
|
|
|
|
|
function handleSubmit() {
|
|
|
|
function handleSubmit() {
|
|
|
|
onConversation()
|
|
|
|
onConversation()
|
|
|
@ -68,7 +69,7 @@ async function onConversation() {
|
|
|
|
let options: Chat.ConversationRequest = {}
|
|
|
|
let options: Chat.ConversationRequest = {}
|
|
|
|
const lastContext = conversationList.value[conversationList.value.length - 1]?.conversationOptions
|
|
|
|
const lastContext = conversationList.value[conversationList.value.length - 1]?.conversationOptions
|
|
|
|
|
|
|
|
|
|
|
|
if (lastContext)
|
|
|
|
if (lastContext && usingContext.value)
|
|
|
|
options = { ...lastContext }
|
|
|
|
options = { ...lastContext }
|
|
|
|
|
|
|
|
|
|
|
|
addChat(
|
|
|
|
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(() => {
|
|
|
|
const placeholder = computed(() => {
|
|
|
|
if (isMobile.value)
|
|
|
|
if (isMobile.value)
|
|
|
|
return t('chat.placeholderMobile')
|
|
|
|
return t('chat.placeholderMobile')
|
|
|
@ -450,6 +469,11 @@ onUnmounted(() => {
|
|
|
|
<SvgIcon icon="ri:download-2-line" />
|
|
|
|
<SvgIcon icon="ri:download-2-line" />
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</HoverButton>
|
|
|
|
</HoverButton>
|
|
|
|
|
|
|
|
<HoverButton @click="toggleUsingContext">
|
|
|
|
|
|
|
|
<span class="text-xl" :class="{ 'text-[#4b9e5f]': usingContext, 'text-[#a8071a]': !usingContext }">
|
|
|
|
|
|
|
|
<SvgIcon icon="ri:chat-history-line" />
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</HoverButton>
|
|
|
|
<NInput
|
|
|
|
<NInput
|
|
|
|
v-model:value="prompt"
|
|
|
|
v-model:value="prompt"
|
|
|
|
type="textarea"
|
|
|
|
type="textarea"
|
|
|
|