|
|
|
@ -4,11 +4,12 @@ import {Local} from "@/utils/storage/storage";
|
|
|
|
|
import dayjs from "dayjs";
|
|
|
|
|
import {computed, onMounted, onUnmounted, ref, watch} from 'vue'
|
|
|
|
|
import {useRoute} from 'vue-router'
|
|
|
|
|
import {NAutoComplete, NButton, NInput, useDialog, useMessage, NBackTop} from 'naive-ui'
|
|
|
|
|
import {NAutoComplete, NButton, NInput, useDialog, useMessage, NBackTop,NIcon} from 'naive-ui'
|
|
|
|
|
import {AreaChartOutlined, PlusOutlined} from '@ant-design/icons-vue';
|
|
|
|
|
import html2canvas from 'html2canvas'
|
|
|
|
|
import {Message} from './components'
|
|
|
|
|
import {useScroll} from './hooks/useScroll'
|
|
|
|
|
import { FlashOutline } from '@vicons/ionicons5'
|
|
|
|
|
import {useChat} from './hooks/useChat'
|
|
|
|
|
import {useUsingContext} from './hooks/useUsingContext'
|
|
|
|
|
import HeaderComponent from './components/Header/index.vue'
|
|
|
|
@ -71,6 +72,7 @@ function handleSubmit() {
|
|
|
|
|
if (loading.value){
|
|
|
|
|
handleStop()
|
|
|
|
|
}else {
|
|
|
|
|
loading.value = true
|
|
|
|
|
dataSources.value.push({
|
|
|
|
|
dateTime: dayjs().format('YYYY/MM/DD HH:mm:ss'),
|
|
|
|
|
text: prompt.value?.trim(),
|
|
|
|
@ -140,7 +142,7 @@ const handleResponseStream = async (reader) => {
|
|
|
|
|
if (decoded !== "") {
|
|
|
|
|
if (decoded.trim() === "[DONE]") {
|
|
|
|
|
dataSources.value[dataSources.value.length - 1].loading = false
|
|
|
|
|
loading.value = false
|
|
|
|
|
loading.value = false
|
|
|
|
|
} else {
|
|
|
|
|
if (isStop.value) {
|
|
|
|
|
dataSources.value[dataSources.value.length - 1].loading = false
|
|
|
|
@ -512,7 +514,7 @@ const customRequest = async (file) => {
|
|
|
|
|
</main>
|
|
|
|
|
<footer :class="footerClass">
|
|
|
|
|
<div class="w-full max-w-screen-xl m-auto">
|
|
|
|
|
<div class="flex items-center justify-between space-x-2" style="flex-wrap: initial">
|
|
|
|
|
<div class="flex items-center justify-center space-x-2" style="flex-wrap: initial">
|
|
|
|
|
<a-popover :open="visible1" trigger="click">
|
|
|
|
|
<template #content>
|
|
|
|
|
<div class="clearfix">
|
|
|
|
@ -570,33 +572,48 @@ const customRequest = async (file) => {
|
|
|
|
|
<SvgIcon icon="ri:delete-bin-line" />
|
|
|
|
|
</span>
|
|
|
|
|
</HoverButton>-->
|
|
|
|
|
<HoverButton v-if="!isMobile" @click="handleExport">
|
|
|
|
|
<!-- <HoverButton v-if="!isMobile" @click="handleExport">
|
|
|
|
|
<span class="text-xl text-[#4f555e] dark:text-white">
|
|
|
|
|
<SvgIcon icon="ri:download-2-line"/>
|
|
|
|
|
</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>-->
|
|
|
|
|
<NAutoComplete v-model:value="prompt" :options="searchOptions" :render-label="renderOption">
|
|
|
|
|
<!-- <NAutoComplete v-model:value="prompt" :options="searchOptions" :render-label="renderOption">
|
|
|
|
|
<template #default="{ handleInput, handleBlur, handleFocus }">
|
|
|
|
|
<NInput
|
|
|
|
|
ref="inputRef"
|
|
|
|
|
v-model:value="prompt"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:placeholder="placeholder"
|
|
|
|
|
:autosize="{ minRows: 1, maxRows: isMobile ? 4 : 8 }"
|
|
|
|
|
@input="handleInput"
|
|
|
|
|
@focus="handleFocus"
|
|
|
|
|
@blur="handleBlur"
|
|
|
|
|
@keypress="handleEnter"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
</NAutoComplete>
|
|
|
|
|
<NButton color="#8a2be2" type="primary" :disabled="buttonDisabled" @click="handleSubmit">
|
|
|
|
|
<template #icon>
|
|
|
|
|
|
|
|
|
|
</NAutoComplete>-->
|
|
|
|
|
<!-- <NInput
|
|
|
|
|
ref="inputRef"
|
|
|
|
|
v-model:value="prompt"
|
|
|
|
|
type="textarea"
|
|
|
|
|
size="large"
|
|
|
|
|
:placeholder="placeholder"
|
|
|
|
|
:autosize="{ minRows: 1, maxRows: isMobile ? 4 : 8 }"
|
|
|
|
|
@input="handleInput"
|
|
|
|
|
@focus="handleFocus"
|
|
|
|
|
@blur="handleBlur"
|
|
|
|
|
@keypress="handleEnter"
|
|
|
|
|
/> -->
|
|
|
|
|
<NInput
|
|
|
|
|
style="width:75%"
|
|
|
|
|
ref="inputRef"
|
|
|
|
|
v-model:value="prompt"
|
|
|
|
|
type="textarea"
|
|
|
|
|
size="large"
|
|
|
|
|
:placeholder="placeholder"
|
|
|
|
|
:autosize="{ minRows: 1, maxRows: isMobile ? 4 : 8 }"
|
|
|
|
|
@keypress="handleEnter"
|
|
|
|
|
>
|
|
|
|
|
</NInput>
|
|
|
|
|
<NButton color="#8a2be2" type="primary" size="large" :disabled="buttonDisabled" @click="handleSubmit">
|
|
|
|
|
<template #icon>
|
|
|
|
|
<span class="dark:text-black" v-if="!loading">
|
|
|
|
|
<SvgIcon icon="ri:send-plane-fill"/>
|
|
|
|
|
</span>
|
|
|
|
@ -604,8 +621,8 @@ const customRequest = async (file) => {
|
|
|
|
|
<span class="dark:text-black" v-if="loading">
|
|
|
|
|
<svg style="width:100%;height:100%;" xmlns="http://www.w3.org/2000/svg" :style="{color:currentColor}" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 12 12"><g fill="none"><path d="M5 4a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H5zm6 2A5 5 0 1 1 1 6a5 5 0 0 1 10 0zm-1 0a4 4 0 1 0-8 0a4 4 0 0 0 8 0z" fill="currentColor"></path></g></svg>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</NButton>
|
|
|
|
|
</template>
|
|
|
|
|
</NButton>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</footer>
|
|
|
|
|