|
|
@ -34,6 +34,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)
|
|
|
|
const usingContext = ref<boolean>(true)
|
|
|
|
|
|
|
|
const actionVisible = ref<boolean>(true)
|
|
|
|
|
|
|
|
|
|
|
|
function handleSubmit() {
|
|
|
|
function handleSubmit() {
|
|
|
|
onConversation()
|
|
|
|
onConversation()
|
|
|
@ -367,20 +368,20 @@ function handleStop() {
|
|
|
|
|
|
|
|
|
|
|
|
function toggleUsingContext() {
|
|
|
|
function toggleUsingContext() {
|
|
|
|
usingContext.value = !usingContext.value
|
|
|
|
usingContext.value = !usingContext.value
|
|
|
|
if (usingContext.value) {
|
|
|
|
if (usingContext.value)
|
|
|
|
dialog.info({
|
|
|
|
ms.success(t('chat.turnOnContext'))
|
|
|
|
title: t('chat.usingContext'),
|
|
|
|
else
|
|
|
|
content: t('chat.turnOnContext'),
|
|
|
|
ms.warning(t('chat.turnOffContext'))
|
|
|
|
positiveText: t('common.yes'),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
dialog.info({
|
|
|
|
function onInputFocus() {
|
|
|
|
title: t('chat.usingContext'),
|
|
|
|
if (isMobile.value)
|
|
|
|
content: t('chat.turnOffContext'),
|
|
|
|
actionVisible.value = false
|
|
|
|
positiveText: t('common.yes'),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function onInputBlur() {
|
|
|
|
|
|
|
|
if (isMobile.value)
|
|
|
|
|
|
|
|
actionVisible.value = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const placeholder = computed(() => {
|
|
|
|
const placeholder = computed(() => {
|
|
|
@ -402,7 +403,7 @@ const wrapClass = computed(() => {
|
|
|
|
const footerClass = computed(() => {
|
|
|
|
const footerClass = computed(() => {
|
|
|
|
let classes = ['p-4']
|
|
|
|
let classes = ['p-4']
|
|
|
|
if (isMobile.value)
|
|
|
|
if (isMobile.value)
|
|
|
|
classes = ['sticky', 'left-0', 'bottom-0', 'right-0', 'p-2', 'pr-4', 'overflow-hidden']
|
|
|
|
classes = ['sticky', 'left-0', 'bottom-0', 'right-0', 'p-2', 'overflow-hidden']
|
|
|
|
return classes
|
|
|
|
return classes
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
@ -464,6 +465,7 @@ onUnmounted(() => {
|
|
|
|
<footer :class="footerClass">
|
|
|
|
<footer :class="footerClass">
|
|
|
|
<div class="w-full max-w-screen-xl m-auto">
|
|
|
|
<div class="w-full max-w-screen-xl m-auto">
|
|
|
|
<div class="flex items-center justify-between space-x-2">
|
|
|
|
<div class="flex items-center justify-between space-x-2">
|
|
|
|
|
|
|
|
<div v-if="actionVisible" class="flex items-center space-x-2">
|
|
|
|
<HoverButton @click="handleClear">
|
|
|
|
<HoverButton @click="handleClear">
|
|
|
|
<span class="text-xl text-[#4f555e] dark:text-white">
|
|
|
|
<span class="text-xl text-[#4f555e] dark:text-white">
|
|
|
|
<SvgIcon icon="ri:delete-bin-line" />
|
|
|
|
<SvgIcon icon="ri:delete-bin-line" />
|
|
|
@ -479,11 +481,14 @@ onUnmounted(() => {
|
|
|
|
<SvgIcon icon="ri:chat-history-line" />
|
|
|
|
<SvgIcon icon="ri:chat-history-line" />
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</HoverButton>
|
|
|
|
</HoverButton>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<NInput
|
|
|
|
<NInput
|
|
|
|
v-model:value="prompt"
|
|
|
|
v-model:value="prompt"
|
|
|
|
type="textarea"
|
|
|
|
type="textarea"
|
|
|
|
:autosize="{ minRows: 1, maxRows: 2 }"
|
|
|
|
:autosize="{ minRows: 1, maxRows: 2 }"
|
|
|
|
:placeholder="placeholder"
|
|
|
|
:placeholder="placeholder"
|
|
|
|
|
|
|
|
@focus="onInputFocus"
|
|
|
|
|
|
|
|
@blur="onInputBlur"
|
|
|
|
@keypress="handleEnter"
|
|
|
|
@keypress="handleEnter"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<NButton type="primary" :disabled="buttonDisabled" @click="handleSubmit">
|
|
|
|
<NButton type="primary" :disabled="buttonDisabled" @click="handleSubmit">
|
|
|
|