s
This commit is contained in:
parent
849c9b33f2
commit
6c2975fbbd
12
src/App.vue
12
src/App.vue
@ -7,7 +7,7 @@ import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
|||||||
|
|
||||||
const { theme, themeOverrides } = useTheme()
|
const { theme, themeOverrides } = useTheme()
|
||||||
const { language } = useLanguage()
|
const { language } = useLanguage()
|
||||||
localStorage.setItem('token','46d71a72d8d845ad7ed23eba9bdde260e635407190c2ce1bf7fd22088e41682ea07773ec65cae8946d2003f264d55961f96e0fc5da10eb96d3a348c1664e9644e756eda7154e1af9e70d1c9d2f100823a26885ea6df3249fe619995cb79dc5dbd5ead32d43b955d6b3ce83129097bb21bb8169898f48692de4f966db140c71b85a2065acfc948561c465279fc05194a79a1115f3b00170944b6c4bd6c52ada909a075c55d18d76c2ed2175602421b34b27362a05c350733ed73382471df0a08950f7f1e812a610c17bdac82d82d54be38969f6b41201af79b8d36ef177c5b94bdd0b97501291f5dc1988d078f75b7de7fde85696e7a51443d1971ab54a97988fb4ced751732ef87ea638352124e2645128eb8977fcc63e3316cf2c94f10a9ff967353f430059dcda7b3d4f48288fb374d56461b354dab136b5b28029f29cfe5d')
|
localStorage.setItem('token','46d71a72d8d845ad7ed23eba9bdde260e635407190c2ce1bf7fd22088e41682ea07773ec65cae8946d2003f264d55961f96e0fc5da10eb96d3a348c1664e9644e756eda7154e1af9e70d1c9d2f100823a26885ea6df3249fe619995cb79dc5dbd5ead32d43b955d6b3ce83129097bb21bb8169898f48692de4f966db140c71b85a2065acfc948561c465279fc05194a79a1115f3b00170944b6c4bd6c52ada909a075c55d18d76c2ed2175602421b34b27362a05c350733ed73382471df0a08950f7f1e812a610c17bdac82d82d54be38969f6b41201af79b8d36ef177c5b94bdd0b97501291f5dc1988d078f75b7de7bb902b70b460d03b130ea3172fffe37f766c751a46787bd5efff3becf755b544182ed4aa5d1622ca5093decade739e05bb85c590ef6a06c9bcb5c02e54a2b7b1a555d5e4a931de36687d42d6ab1b09b6')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -29,5 +29,15 @@ localStorage.setItem('token','46d71a72d8d845ad7ed23eba9bdde260e635407190c2ce1bf7
|
|||||||
--el-color-primary:#764CF6!important;
|
--el-color-primary:#764CF6!important;
|
||||||
--n-loading-color:#764CF6!important;
|
--n-loading-color:#764CF6!important;
|
||||||
--n-caret-color:#764CF6!important;
|
--n-caret-color:#764CF6!important;
|
||||||
|
|
||||||
|
}
|
||||||
|
:where(.css-dev-only-do-not-override-19yxfbp).ant-select-dropdown .ant-select-item-option-selected:not(.ant-select-item-option-disabled){
|
||||||
|
background-color: #dfd7f4;
|
||||||
|
}
|
||||||
|
:where(.css-dev-only-do-not-override-19yxfbp).ant-select:not(.ant-select-disabled):not(.ant-select-customize-input):not(.ant-pagination-size-changer):hover .ant-select-selector{
|
||||||
|
border-color: #764CF6!important;;
|
||||||
|
}
|
||||||
|
.ant-select-focused:where(.css-dev-only-do-not-override-19yxfbp).ant-select:not(.ant-select-disabled):not(.ant-select-customize-input):not(.ant-pagination-size-changer) .ant-select-selector{
|
||||||
|
border-color: #764CF6!important;;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -38,3 +38,13 @@ export const uploadImg = (data) => {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export const uploadFormData = (data) => {
|
||||||
|
return request({
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
},
|
||||||
|
url:'/chat/get-file-text',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -31,7 +31,7 @@ export default {
|
|||||||
chat: {
|
chat: {
|
||||||
newChatButton: '新建聊天',
|
newChatButton: '新建聊天',
|
||||||
newChatTitle: '新建聊天',
|
newChatTitle: '新建聊天',
|
||||||
placeholder: '来说点什么吧...(Shift + Enter = 换行,"/" 触发提示词)',
|
placeholder: '来说点什么吧...(Shift + Enter = 换行)',
|
||||||
placeholderMobile: '来说点什么...',
|
placeholderMobile: '来说点什么...',
|
||||||
copy: '复制',
|
copy: '复制',
|
||||||
copied: '复制成功',
|
copied: '复制成功',
|
||||||
|
@ -12,7 +12,7 @@ const routes: RouteRecordRaw[] = [
|
|||||||
redirect: '/chat',
|
redirect: '/chat',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/chat/:uuid?',
|
path: '/chat',
|
||||||
name: 'Chat',
|
name: 'Chat',
|
||||||
component: () => import('@/views/chat/index.vue'),
|
component: () => import('@/views/chat/index.vue'),
|
||||||
},
|
},
|
||||||
|
@ -8,6 +8,7 @@ export const sessionDetailForSetup = defineStore('session', () => {
|
|||||||
const currentListUuid=ref('')
|
const currentListUuid=ref('')
|
||||||
const gptMode=ref('gpt-3.5-turbo')
|
const gptMode=ref('gpt-3.5-turbo')
|
||||||
const dataList = ref([]);
|
const dataList = ref([]);
|
||||||
|
const isStop = ref(false);
|
||||||
const getDataList = async () => {
|
const getDataList = async () => {
|
||||||
const data = {
|
const data = {
|
||||||
page: 1,
|
page: 1,
|
||||||
@ -42,7 +43,6 @@ const currentListUuid=ref('')
|
|||||||
conversationOpt:null,
|
conversationOpt:null,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(sessionDetail.value,'sessionDetail.value')
|
|
||||||
detailData.value=res.data
|
detailData.value=res.data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,6 +53,7 @@ const currentListUuid=ref('')
|
|||||||
const res=await createSession(data)
|
const res=await createSession(data)
|
||||||
if (res.code===0){
|
if (res.code===0){
|
||||||
getDataList()
|
getDataList()
|
||||||
|
currentListUuid.value=res.data.listUuid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const deleteSession =async () => {
|
const deleteSession =async () => {
|
||||||
@ -61,5 +62,5 @@ const currentListUuid=ref('')
|
|||||||
getDataList()
|
getDataList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { sessionDetail,currentListUuid ,gptMode,getDataList,dataList,getSessionDetail,createSessionStore,deleteSession};
|
return { sessionDetail,currentListUuid ,gptMode,getDataList,dataList,getSessionDetail,createSessionStore,deleteSession,isStop};
|
||||||
});
|
});
|
||||||
|
@ -825,7 +825,7 @@ html {
|
|||||||
.markdown-body pre {
|
.markdown-body pre {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
font-size: 85%;
|
font-size: 100%;
|
||||||
line-height: 1.45;
|
line-height: 1.45;
|
||||||
background-color: var(--color-canvas-subtle);
|
background-color: var(--color-canvas-subtle);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { ElLoading } from 'element-plus'
|
import { ElLoading } from 'element-plus'
|
||||||
const request = axios.create({
|
const request = axios.create({
|
||||||
baseURL:'http://114.218.158.24:9020',
|
baseURL:import.meta.env.VITE_APP_API_BASE_URL,
|
||||||
timeout:5000
|
timeout:5000
|
||||||
});
|
});
|
||||||
let loading
|
let loading
|
||||||
@ -18,5 +18,7 @@ loading=ElLoading.service({
|
|||||||
request.interceptors.response.use((res)=>{
|
request.interceptors.response.use((res)=>{
|
||||||
loading.close()
|
loading.close()
|
||||||
return res.data;
|
return res.data;
|
||||||
|
},()=>{
|
||||||
|
loading.close()
|
||||||
});
|
});
|
||||||
export default request;
|
export default request;
|
||||||
|
@ -108,7 +108,7 @@ onUnmounted(() => {
|
|||||||
<div class="text-black" :class="wrapClass">
|
<div class="text-black" :class="wrapClass">
|
||||||
<div ref="textRef" class="leading-relaxed break-words">
|
<div ref="textRef" class="leading-relaxed break-words">
|
||||||
<div v-if="!inversion">
|
<div v-if="!inversion">
|
||||||
<div v-if="!asRawText" class="markdown-body" :class="{ 'markdown-body-generate': loading }" v-html="text" />
|
<div v-if="!asRawText" class="markdown-body" style="font-size: 14px" :class="{ 'markdown-body-generate': loading }" v-html="text" />
|
||||||
<div v-else class="whitespace-pre-wrap" v-text="text" />
|
<div v-else class="whitespace-pre-wrap" v-text="text" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="whitespace-pre-wrap" >
|
<div v-else class="whitespace-pre-wrap" >
|
||||||
|
@ -45,12 +45,12 @@ const options = computed(() => {
|
|||||||
label: t('chat.copy'),
|
label: t('chat.copy'),
|
||||||
key: 'copyText',
|
key: 'copyText',
|
||||||
icon: iconRender({ icon: 'ri:file-copy-2-line' }),
|
icon: iconRender({ icon: 'ri:file-copy-2-line' }),
|
||||||
},
|
}/* ,
|
||||||
{
|
{
|
||||||
label: t('common.delete'),
|
label: t('common.delete'),
|
||||||
key: 'delete',
|
key: 'delete',
|
||||||
icon: iconRender({ icon: 'ri:delete-bin-line' }),
|
icon: iconRender({ icon: 'ri:delete-bin-line' }),
|
||||||
},
|
}, */
|
||||||
]
|
]
|
||||||
|
|
||||||
if (!props.inversion) {
|
if (!props.inversion) {
|
||||||
@ -122,14 +122,15 @@ async function handleCopy() {
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:as-raw-text="asRawText"
|
:as-raw-text="asRawText"
|
||||||
/>
|
/>
|
||||||
<div class="flex flex-col">
|
|
||||||
<button
|
<div v-if="!loading" class="flex flex-col">
|
||||||
|
<!-- <button
|
||||||
v-if="!inversion"
|
v-if="!inversion"
|
||||||
class="mb-2 transition text-neutral-300 hover:text-neutral-800 dark:hover:text-neutral-300"
|
class="mb-2 transition text-neutral-300 hover:text-neutral-800 dark:hover:text-neutral-300"
|
||||||
@click="handleRegenerate"
|
@click="handleRegenerate"
|
||||||
>
|
>
|
||||||
<SvgIcon icon="ri:restart-line" />
|
<SvgIcon icon="ri:restart-line" />
|
||||||
</button>
|
</button>-->
|
||||||
<NDropdown
|
<NDropdown
|
||||||
:trigger="isMobile ? 'click' : 'hover'"
|
:trigger="isMobile ? 'click' : 'hover'"
|
||||||
:placement="!inversion ? 'right' : 'left'"
|
:placement="!inversion ? 'right' : 'left'"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script setup >
|
<script setup >
|
||||||
import {uploadImg} from "@/api/api";
|
import {uploadFormData, uploadImg} from "@/api/api";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { computed, onMounted, onUnmounted, ref,watch } from 'vue'
|
import { computed, onMounted, onUnmounted, ref,watch } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
@ -16,30 +16,21 @@ import { useBasicLayout } from '@/hooks/useBasicLayout'
|
|||||||
import { useChatStore, usePromptStore } from '@/store'
|
import { useChatStore, usePromptStore } from '@/store'
|
||||||
import { fetchChatAPIProcess } from '@/api'
|
import { fetchChatAPIProcess } from '@/api'
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
|
import { UploadOutlined } from '@ant-design/icons-vue';
|
||||||
import {storeToRefs} from 'pinia'
|
import {storeToRefs} from 'pinia'
|
||||||
import { sessionDetailForSetup } from '@/store'
|
import { sessionDetailForSetup } from '@/store'
|
||||||
const sessionDetailData=sessionDetailForSetup()
|
const sessionDetailData=sessionDetailForSetup()
|
||||||
let controller = new AbortController()
|
let controller = new AbortController()
|
||||||
const { sessionDetail:dataSources ,currentListUuid,gptMode} = storeToRefs(sessionDetailData)
|
const { sessionDetail:dataSources ,currentListUuid,gptMode,isStop} = storeToRefs(sessionDetailData)
|
||||||
const openLongReply = import.meta.env.VITE_GLOB_OPEN_LONG_REPLY === 'true'
|
|
||||||
const route = useRoute()
|
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
const ms = useMessage()
|
const ms = useMessage()
|
||||||
|
|
||||||
const chatStore = useChatStore()
|
const chatStore = useChatStore()
|
||||||
|
|
||||||
const { isMobile } = useBasicLayout()
|
const { isMobile } = useBasicLayout()
|
||||||
const { addChat, updateChat, updateChatSome, getChatByUuidAndIndex } = useChat()
|
const { addChat, updateChat, updateChatSome, getChatByUuidAndIndex } = useChat()
|
||||||
const { scrollRef, scrollToBottom, scrollToBottomIfAtBottom } = useScroll()
|
const { scrollRef, scrollToBottom, scrollToBottomIfAtBottom } = useScroll()
|
||||||
const { usingContext, toggleUsingContext } = useUsingContext()
|
const { usingContext, toggleUsingContext } = useUsingContext()
|
||||||
|
|
||||||
const { uuid } = route.params
|
|
||||||
if (uuid){
|
|
||||||
currentListUuid.value=uuid
|
|
||||||
sessionDetailData.getSessionDetail()
|
|
||||||
}
|
|
||||||
const conversationList = computed(() => dataSources.value.filter(item => (!item.inversion && !!item.conversationOptions)))
|
|
||||||
const dataSessionDetail=ref([])
|
|
||||||
const prompt = ref('')
|
const prompt = ref('')
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const inputRef = ref(null)
|
const inputRef = ref(null)
|
||||||
@ -59,15 +50,15 @@ dataSources.value.forEach((item, index) => {
|
|||||||
function handleSubmit() {
|
function handleSubmit() {
|
||||||
dataSources.value.push({
|
dataSources.value.push({
|
||||||
dateTime: dayjs().format('YYYY/MM/DD HH:mm:ss'),
|
dateTime: dayjs().format('YYYY/MM/DD HH:mm:ss'),
|
||||||
text: prompt.value,
|
text: prompt.value,
|
||||||
inversion: true,
|
inversion: true,
|
||||||
error: false,
|
error: false,
|
||||||
fileList:fileList.value.map(x=>x.url)
|
fileList:fileList.value.map(x=>x.url),
|
||||||
|
loading:false
|
||||||
})
|
})
|
||||||
sendDataStream()
|
sendDataStream()
|
||||||
/* onConversation() */
|
|
||||||
}
|
}
|
||||||
const API_URL = 'http://114.218.158.24:9020/chat/completion';
|
const API_URL = `${import.meta.env.VITE_APP_API_BASE_URL}/chat/completion`;
|
||||||
|
|
||||||
const createParams = () => {
|
const createParams = () => {
|
||||||
const messages = dataSources.value.map((x) => {
|
const messages = dataSources.value.map((x) => {
|
||||||
@ -85,6 +76,7 @@ const createParams = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
|
type:isFile.value?'custom':'',
|
||||||
listUuid: currentListUuid.value,
|
listUuid: currentListUuid.value,
|
||||||
messages,
|
messages,
|
||||||
frequency_penalty: 0,
|
frequency_penalty: 0,
|
||||||
@ -96,7 +88,6 @@ const createParams = () => {
|
|||||||
top_p: 1
|
top_p: 1
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleResponseStream = async (reader) => {
|
const handleResponseStream = async (reader) => {
|
||||||
const { done, value } = await reader.read();
|
const { done, value } = await reader.read();
|
||||||
if (!done) {
|
if (!done) {
|
||||||
@ -105,10 +96,16 @@ const handleResponseStream = async (reader) => {
|
|||||||
decodedArray.forEach((decoded) => {
|
decodedArray.forEach((decoded) => {
|
||||||
if (decoded !== "") {
|
if (decoded !== "") {
|
||||||
if (decoded.trim() === "[DONE]") {
|
if (decoded.trim() === "[DONE]") {
|
||||||
|
dataSources.value[dataSources.value.length - 1].loading=false
|
||||||
|
loading.value=false
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
console.log(decoded,'decoded')
|
if (isStop.value){
|
||||||
|
loading.value=false
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loading.value=true
|
||||||
|
dataSources.value[dataSources.value.length - 1].loading=true
|
||||||
const response = JSON.parse(decoded).choices[0].delta.content
|
const response = JSON.parse(decoded).choices[0].delta.content
|
||||||
? JSON.parse(decoded).choices[0].delta.content
|
? JSON.parse(decoded).choices[0].delta.content
|
||||||
: "";
|
: "";
|
||||||
@ -120,18 +117,21 @@ const handleResponseStream = async (reader) => {
|
|||||||
await handleResponseStream(reader);
|
await handleResponseStream(reader);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const sendDataStream = async () => {
|
const sendDataStream = async () => {
|
||||||
const params = createParams();
|
const params = createParams();
|
||||||
fileList.value=[]
|
fileList.value=[]
|
||||||
prompt.value=''
|
prompt.value=''
|
||||||
|
isStop.value=false
|
||||||
dataSources.value.push({
|
dataSources.value.push({
|
||||||
dateTime: dayjs().format('YYYY/MM/DD HH:mm:ss'),
|
dateTime: dayjs().format('YYYY/MM/DD HH:mm:ss'),
|
||||||
text: '',
|
text: '思考中..',
|
||||||
inversion: false,
|
inversion: false,
|
||||||
error: false,
|
error: false,
|
||||||
|
loading:true
|
||||||
});
|
});
|
||||||
|
visible.value=false
|
||||||
try {
|
try {
|
||||||
|
loading.value=true
|
||||||
const response = await fetch(API_URL, {
|
const response = await fetch(API_URL, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
@ -143,273 +143,16 @@ const sendDataStream = async () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(dataSources.value,'dataSources.value')
|
|
||||||
const contentType = response.headers.get('Content-Type');
|
const contentType = response.headers.get('Content-Type');
|
||||||
if (!contentType || !contentType.includes('application/json')) {
|
if (!contentType || !contentType.includes('application/json')) {
|
||||||
const reader = response.body.getReader();
|
const reader = response.body.getReader();
|
||||||
|
dataSources.value[dataSources.value.length-1].text=''
|
||||||
await handleResponseStream(reader);
|
await handleResponseStream(reader);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('发生错误:', error);
|
console.error('发生错误:', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async function onConversation() {
|
|
||||||
let message = prompt.value
|
|
||||||
|
|
||||||
if (loading.value)
|
|
||||||
return
|
|
||||||
|
|
||||||
if (!message || message.trim() === '')
|
|
||||||
return
|
|
||||||
|
|
||||||
controller = new AbortController()
|
|
||||||
|
|
||||||
addChat(
|
|
||||||
+uuid,
|
|
||||||
{
|
|
||||||
dateTime: new Date().toLocaleString(),
|
|
||||||
text: message,
|
|
||||||
inversion: true,
|
|
||||||
error: false,
|
|
||||||
conversationOptions: null,
|
|
||||||
requestOptions: { prompt: message, options: null },
|
|
||||||
},
|
|
||||||
)
|
|
||||||
scrollToBottom()
|
|
||||||
|
|
||||||
loading.value = true
|
|
||||||
prompt.value = ''
|
|
||||||
|
|
||||||
let options= {}
|
|
||||||
const lastContext = conversationList.value[conversationList.value.length - 1]?.conversationOptions
|
|
||||||
|
|
||||||
if (lastContext && usingContext.value)
|
|
||||||
options = { ...lastContext }
|
|
||||||
|
|
||||||
addChat(
|
|
||||||
+uuid,
|
|
||||||
{
|
|
||||||
dateTime: new Date().toLocaleString(),
|
|
||||||
text: t('chat.thinking'),
|
|
||||||
loading: true,
|
|
||||||
inversion: false,
|
|
||||||
error: false,
|
|
||||||
conversationOptions: null,
|
|
||||||
requestOptions: { prompt: message, options: { ...options } },
|
|
||||||
},
|
|
||||||
)
|
|
||||||
scrollToBottom()
|
|
||||||
|
|
||||||
try {
|
|
||||||
let lastText = ''
|
|
||||||
const fetchChatAPIOnce = async () => {
|
|
||||||
await fetchChatAPIProcess<Chat.ConversationResponse>({
|
|
||||||
prompt: message,
|
|
||||||
options,
|
|
||||||
signal: controller.signal,
|
|
||||||
onDownloadProgress: ({ event }) => {
|
|
||||||
const xhr = event.target
|
|
||||||
const { responseText } = xhr
|
|
||||||
// Always process the final line
|
|
||||||
const lastIndex = responseText.lastIndexOf('\n', responseText.length - 2)
|
|
||||||
let chunk = responseText
|
|
||||||
if (lastIndex !== -1)
|
|
||||||
chunk = responseText.substring(lastIndex)
|
|
||||||
try {
|
|
||||||
const data = JSON.parse(chunk)
|
|
||||||
updateChat(
|
|
||||||
+uuid,
|
|
||||||
dataSources.value.length - 1,
|
|
||||||
{
|
|
||||||
dateTime: new Date().toLocaleString(),
|
|
||||||
text: lastText + (data.text ?? ''),
|
|
||||||
inversion: false,
|
|
||||||
error: false,
|
|
||||||
loading: true,
|
|
||||||
conversationOptions: { conversationId: data.conversationId, parentMessageId: data.id },
|
|
||||||
requestOptions: { prompt: message, options: { ...options } },
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if (openLongReply && data.detail.choices[0].finish_reason === 'length') {
|
|
||||||
options.parentMessageId = data.id
|
|
||||||
lastText = data.text
|
|
||||||
message = ''
|
|
||||||
return fetchChatAPIOnce()
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollToBottomIfAtBottom()
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
updateChatSome(+uuid, dataSources.value.length - 1, { loading: false })
|
|
||||||
}
|
|
||||||
|
|
||||||
await fetchChatAPIOnce()
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
const errorMessage = error?.message ?? t('common.wrong')
|
|
||||||
|
|
||||||
if (error.message === 'canceled') {
|
|
||||||
updateChatSome(
|
|
||||||
+uuid,
|
|
||||||
dataSources.value.length - 1,
|
|
||||||
{
|
|
||||||
loading: false,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
scrollToBottomIfAtBottom()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentChat = getChatByUuidAndIndex(+uuid, dataSources.value.length - 1)
|
|
||||||
|
|
||||||
if (currentChat?.text && currentChat.text !== '') {
|
|
||||||
updateChatSome(
|
|
||||||
+uuid,
|
|
||||||
dataSources.value.length - 1,
|
|
||||||
{
|
|
||||||
text: `${currentChat.text}\n[${errorMessage}]`,
|
|
||||||
error: false,
|
|
||||||
loading: false,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
updateChat(
|
|
||||||
+uuid,
|
|
||||||
dataSources.value.length - 1,
|
|
||||||
{
|
|
||||||
dateTime: new Date().toLocaleString(),
|
|
||||||
text: errorMessage,
|
|
||||||
inversion: false,
|
|
||||||
error: true,
|
|
||||||
loading: false,
|
|
||||||
conversationOptions: null,
|
|
||||||
requestOptions: { prompt: message, options: { ...options } },
|
|
||||||
},
|
|
||||||
)
|
|
||||||
scrollToBottomIfAtBottom()
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* async function onRegenerate(index) {
|
|
||||||
if (loading.value)
|
|
||||||
return
|
|
||||||
|
|
||||||
controller = new AbortController()
|
|
||||||
|
|
||||||
const { requestOptions } = dataSources.value[index]
|
|
||||||
|
|
||||||
let message = requestOptions?.prompt ?? ''
|
|
||||||
|
|
||||||
let options = {}
|
|
||||||
|
|
||||||
if (requestOptions.options)
|
|
||||||
options = { ...requestOptions.options }
|
|
||||||
|
|
||||||
loading.value = true
|
|
||||||
|
|
||||||
updateChat(
|
|
||||||
+uuid,
|
|
||||||
index,
|
|
||||||
{
|
|
||||||
dateTime: new Date().toLocaleString(),
|
|
||||||
text: '',
|
|
||||||
inversion: false,
|
|
||||||
error: false,
|
|
||||||
loading: true,
|
|
||||||
conversationOptions: null,
|
|
||||||
requestOptions: { prompt: message, options: { ...options } },
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
try {
|
|
||||||
let lastText = ''
|
|
||||||
const fetchChatAPIOnce = async () => {
|
|
||||||
await fetchChatAPIProcess<Chat.ConversationResponse>({
|
|
||||||
prompt: message,
|
|
||||||
options,
|
|
||||||
signal: controller.signal,
|
|
||||||
onDownloadProgress: ({ event }) => {
|
|
||||||
const xhr = event.target
|
|
||||||
const { responseText } = xhr
|
|
||||||
// Always process the final line
|
|
||||||
const lastIndex = responseText.lastIndexOf('\n', responseText.length - 2)
|
|
||||||
let chunk = responseText
|
|
||||||
if (lastIndex !== -1)
|
|
||||||
chunk = responseText.substring(lastIndex)
|
|
||||||
try {
|
|
||||||
const data = JSON.parse(chunk)
|
|
||||||
updateChat(
|
|
||||||
+uuid,
|
|
||||||
index,
|
|
||||||
{
|
|
||||||
dateTime: new Date().toLocaleString(),
|
|
||||||
text: lastText + (data.text ?? ''),
|
|
||||||
inversion: false,
|
|
||||||
error: false,
|
|
||||||
loading: true,
|
|
||||||
conversationOptions: { conversationId: data.conversationId, parentMessageId: data.id },
|
|
||||||
requestOptions: { prompt: message, options: { ...options } },
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
if (openLongReply && data.detail.choices[0].finish_reason === 'length') {
|
|
||||||
options.parentMessageId = data.id
|
|
||||||
lastText = data.text
|
|
||||||
message = ''
|
|
||||||
return fetchChatAPIOnce()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
updateChatSome(+uuid, index, { loading: false })
|
|
||||||
}
|
|
||||||
await fetchChatAPIOnce()
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
if (error.message === 'canceled') {
|
|
||||||
updateChatSome(
|
|
||||||
+uuid,
|
|
||||||
index,
|
|
||||||
{
|
|
||||||
loading: false,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const errorMessage = error?.message ?? t('common.wrong')
|
|
||||||
|
|
||||||
updateChat(
|
|
||||||
+uuid,
|
|
||||||
index,
|
|
||||||
{
|
|
||||||
dateTime: new Date().toLocaleString(),
|
|
||||||
text: errorMessage,
|
|
||||||
inversion: false,
|
|
||||||
error: true,
|
|
||||||
loading: false,
|
|
||||||
conversationOptions: null,
|
|
||||||
requestOptions: { prompt: message, options: { ...options } },
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
|
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
if (loading.value)
|
if (loading.value)
|
||||||
return
|
return
|
||||||
@ -496,11 +239,10 @@ function handleEnter(event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleStop() {
|
function handleStop() {
|
||||||
if (loading.value) {
|
if (loading.value) {
|
||||||
controller.abort()
|
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
isStop.value=true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,15 +325,38 @@ const handlePreview = async (file) => {
|
|||||||
};
|
};
|
||||||
const value = ref('gpt-3.5-turbo');
|
const value = ref('gpt-3.5-turbo');
|
||||||
const visible=ref(false)
|
const visible=ref(false)
|
||||||
const options=ref([{ label: 'GPT-3.5', value: 'gpt-3.5-turbo' },
|
|
||||||
{ label: 'GPT-4.0', value: 'gpt-4-1106-preview' },
|
|
||||||
{ label: 'GPT-V', value: 'gpt-4-vision-preview' }])
|
|
||||||
const removeImg=(data)=>{
|
const removeImg=(data)=>{
|
||||||
fileList.value.splice(fileList.value.findIndex(x=>x.url===data.url),1)
|
fileList.value.splice(fileList.value.findIndex(x=>x.url===data.url),1)
|
||||||
}
|
}
|
||||||
watch(gptMode,()=>{
|
watch(gptMode,()=>{
|
||||||
|
currentListUuid.value=''
|
||||||
dataSources.value=[]
|
dataSources.value=[]
|
||||||
})
|
})
|
||||||
|
const visible1=ref(false)
|
||||||
|
const fileList1=ref([])
|
||||||
|
const isFile=ref(false)
|
||||||
|
const upItemImage1= async (file)=>{
|
||||||
|
const data = {
|
||||||
|
file: file.file,
|
||||||
|
}
|
||||||
|
const res=await uploadFormData(data)
|
||||||
|
if (res.code===0){
|
||||||
|
file.onSuccess()
|
||||||
|
dataSources.value=[...dataSources.value,...res.data.paragraph.flatMap(n=>[n,'']).map((x)=>{
|
||||||
|
return {
|
||||||
|
dateTime: dayjs().format('YYYY/MM/DD HH:mm:ss'),
|
||||||
|
text: x,
|
||||||
|
inversion: Boolean(x),
|
||||||
|
error: false,
|
||||||
|
}
|
||||||
|
})]
|
||||||
|
isFile.value=true
|
||||||
|
fileList1.value=[]
|
||||||
|
visible1.value=false
|
||||||
|
sendDataStream()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
const customRequest=async (file)=>{
|
const customRequest=async (file)=>{
|
||||||
const res=await uploadImg({file:file.file,source:'approval'})
|
const res=await uploadImg({file:file.file,source:'approval'})
|
||||||
if (res.code===0){
|
if (res.code===0){
|
||||||
@ -600,21 +365,10 @@ const customRequest=async (file)=>{
|
|||||||
url:res.data.ori_url
|
url:res.data.ori_url
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log(res,'res')
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col w-full h-full">
|
<div class="flex flex-col w-full h-full">
|
||||||
<div style="margin-top: 15px;margin-left: 15px">
|
|
||||||
<a-select
|
|
||||||
align="center"
|
|
||||||
v-model:value="gptMode"
|
|
||||||
style="width: 120px"
|
|
||||||
:dropdown-match-select-width="false"
|
|
||||||
>
|
|
||||||
<a-select-option align="center" v-for="(item,index) in options" :key="index" :value="item.value">{{item.label}}</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</div>
|
|
||||||
<HeaderComponent
|
<HeaderComponent
|
||||||
v-if="isMobile"
|
v-if="isMobile"
|
||||||
:using-context="usingContext"
|
:using-context="usingContext"
|
||||||
@ -631,13 +385,13 @@ const customRequest=async (file)=>{
|
|||||||
<template v-if="!dataSources.length">
|
<template v-if="!dataSources.length">
|
||||||
<div class="flex items-center justify-center mt-4 text-center text-neutral-300">
|
<div class="flex items-center justify-center mt-4 text-center text-neutral-300">
|
||||||
<SvgIcon icon="ri:bubble-chart-fill" class="mr-2 text-3xl" />
|
<SvgIcon icon="ri:bubble-chart-fill" class="mr-2 text-3xl" />
|
||||||
<span>{{ t('chat.newChatTitle') }}</span>
|
<span>当前没有会话哦</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div>
|
<div>
|
||||||
<Message
|
<Message
|
||||||
v-for="(item, index) of dataSources"
|
v-for="(item, index) of dataSources.filter(x=>x.text||x.fileList?.length>0)"
|
||||||
:key="index"
|
:key="index"
|
||||||
:date-time="item.dateTime"
|
:date-time="item.dateTime"
|
||||||
:text="item.text"
|
:text="item.text"
|
||||||
@ -645,7 +399,6 @@ const customRequest=async (file)=>{
|
|||||||
:inversion="item.inversion"
|
:inversion="item.inversion"
|
||||||
:error="item.error"
|
:error="item.error"
|
||||||
:loading="item.loading"
|
:loading="item.loading"
|
||||||
@regenerate="onRegenerate(index)"
|
|
||||||
@delete="handleDelete(index)"
|
@delete="handleDelete(index)"
|
||||||
/>
|
/>
|
||||||
<div class="sticky bottom-0 left-0 flex justify-center">
|
<div class="sticky bottom-0 left-0 flex justify-center">
|
||||||
@ -653,7 +406,7 @@ const customRequest=async (file)=>{
|
|||||||
<template #icon>
|
<template #icon>
|
||||||
<SvgIcon icon="ri:stop-circle-line" />
|
<SvgIcon icon="ri:stop-circle-line" />
|
||||||
</template>
|
</template>
|
||||||
{{ t('common.stopResponding') }}
|
停止响应
|
||||||
</NButton>
|
</NButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -664,6 +417,28 @@ const customRequest=async (file)=>{
|
|||||||
<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" style="flex-wrap: initial">
|
<div class="flex items-center justify-between space-x-2" style="flex-wrap: initial">
|
||||||
|
<a-popover :open="visible1" trigger="click">
|
||||||
|
<template #content>
|
||||||
|
<div class="clearfix">
|
||||||
|
<a-upload
|
||||||
|
:max-count="1"
|
||||||
|
v-model:file-list="fileList1"
|
||||||
|
name="file"
|
||||||
|
:customRequest="upItemImage1"
|
||||||
|
>
|
||||||
|
<a-button>
|
||||||
|
<upload-outlined></upload-outlined>
|
||||||
|
上传文件
|
||||||
|
</a-button>
|
||||||
|
</a-upload>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<HoverButton @click="visible1=!visible1">
|
||||||
|
<span class="text-xl text-[#4f555e] dark:text-white" style="display: flex;justify-content: center;align-items: center">
|
||||||
|
<SvgIcon icon="ri:upload-2-line" />
|
||||||
|
</span>
|
||||||
|
</HoverButton>
|
||||||
|
</a-popover>
|
||||||
<a-popover v-if="gptMode==='gpt-4-vision-preview'" :open="visible" trigger="click">
|
<a-popover v-if="gptMode==='gpt-4-vision-preview'" :open="visible" trigger="click">
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
@ -720,7 +495,7 @@ const customRequest=async (file)=>{
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</NAutoComplete>
|
</NAutoComplete>
|
||||||
<NButton type="primary" :disabled="buttonDisabled" @click="handleSubmit">
|
<NButton color="#8a2be2" type="primary" :disabled="buttonDisabled" @click="handleSubmit">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<span class="dark:text-black">
|
<span class="dark:text-black">
|
||||||
<SvgIcon icon="ri:send-plane-fill" />
|
<SvgIcon icon="ri:send-plane-fill" />
|
||||||
|
@ -35,7 +35,7 @@ const getContainerClass = computed(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="h-full dark:bg-[#24272e] transition-all" :class="[isMobile ? 'p-0' : 'p-4']">
|
<div class="h-full dark:bg-[#24272e] transition-all" :class="[isMobile ? 'p-0' : 'p-0']">
|
||||||
<div class="h-full overflow-hidden" :class="getMobileClass">
|
<div class="h-full overflow-hidden" :class="getMobileClass">
|
||||||
<NLayout class="z-40 transition" :class="getContainerClass" has-sider>
|
<NLayout class="z-40 transition" :class="getContainerClass" has-sider>
|
||||||
<Sider />
|
<Sider />
|
||||||
|
@ -8,44 +8,27 @@ import { useAppStore, useChatStore } from '@/store'
|
|||||||
import { useBasicLayout } from '@/hooks/useBasicLayout'
|
import { useBasicLayout } from '@/hooks/useBasicLayout'
|
||||||
import { sessionDetailForSetup } from '@/store'
|
import { sessionDetailForSetup } from '@/store'
|
||||||
const sessionDetailData=sessionDetailForSetup()
|
const sessionDetailData=sessionDetailForSetup()
|
||||||
const { dataList,gptMode,currentListUuid } = storeToRefs(sessionDetailData)
|
const { dataList,gptMode,currentListUuid,sessionDetail,isStop } = storeToRefs(sessionDetailData)
|
||||||
|
|
||||||
const { isMobile } = useBasicLayout()
|
|
||||||
const appStore = useAppStore()
|
|
||||||
const chatStore = useChatStore()
|
const chatStore = useChatStore()
|
||||||
async function handleSelect({ listUuid }) {
|
async function handleSelect({ listUuid }) {
|
||||||
|
if (isActive(listUuid)){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isStop.value=true
|
||||||
|
sessionDetail.value=[]
|
||||||
currentListUuid.value=listUuid
|
currentListUuid.value=listUuid
|
||||||
sessionDetailData.getSessionDetail()
|
sessionDetailData.getSessionDetail()
|
||||||
if (isActive(listUuid)){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chatStore.active)
|
|
||||||
chatStore.updateHistory(chatStore.active, { isEdit: false })
|
|
||||||
await chatStore.setActive(listUuid)
|
|
||||||
|
|
||||||
if (isMobile.value)
|
|
||||||
appStore.setSiderCollapsed(true)
|
|
||||||
}
|
}
|
||||||
sessionDetailData.getDataList()
|
sessionDetailData.getDataList()
|
||||||
|
function handleEdit({ listUuid }) {
|
||||||
function handleEdit({ listUuid }, isEdit, event) {
|
const item= dataList.value?.find((x)=>{
|
||||||
event?.stopPropagation()
|
return x.listUuid===listUuid
|
||||||
chatStore.updateHistory(listUuid, { isEdit })
|
})
|
||||||
|
item.isEdit=true
|
||||||
}
|
}
|
||||||
|
|
||||||
/* function handleDelete(index, event) {
|
|
||||||
event?.stopPropagation()
|
|
||||||
chatStore.deleteHistory(index)
|
|
||||||
if (isMobile.value)
|
|
||||||
appStore.setSiderCollapsed(true)
|
|
||||||
} */
|
|
||||||
|
|
||||||
//const handleDeleteDebounce = debounce(handleDelete, 600)
|
|
||||||
const handleDeleteDebounce = ()=>{
|
const handleDeleteDebounce = ()=>{
|
||||||
sessionDetailData.deleteSession()
|
sessionDetailData.deleteSession()
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleEnter({ listUuid }, isEdit, event) {
|
function handleEnter({ listUuid }, isEdit, event) {
|
||||||
event?.stopPropagation()
|
event?.stopPropagation()
|
||||||
if (event.key === 'Enter')
|
if (event.key === 'Enter')
|
||||||
@ -53,8 +36,9 @@ function handleEnter({ listUuid }, isEdit, event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isActive(listUuid) {
|
function isActive(listUuid) {
|
||||||
return chatStore.active === listUuid
|
return currentListUuid.value === listUuid
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -91,9 +75,9 @@ function isActive(listUuid) {
|
|||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<button class="p-1">
|
<!-- <button class="p-1">
|
||||||
<SvgIcon icon="ri:edit-line" @click.stop="handleEdit(item, true, $event)" />
|
<SvgIcon icon="ri:edit-line" @click.stop="handleEdit(item, true, $event)" />
|
||||||
</button>
|
</button>-->
|
||||||
|
|
||||||
<NPopconfirm placement="bottom" @positive-click.stop="handleDeleteDebounce(index, $event)">
|
<NPopconfirm placement="bottom" @positive-click.stop="handleDeleteDebounce(index, $event)">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {createSession} from "@/api/api";
|
import {createSession} from "@/api/api";
|
||||||
|
import {storeToRefs} from "pinia";
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { NButton, NLayoutSider, useDialog } from 'naive-ui'
|
import { NButton, NLayoutSider, useDialog } from 'naive-ui'
|
||||||
import List from './List.vue'
|
import List from './List.vue'
|
||||||
@ -9,7 +10,8 @@ import { useBasicLayout } from '@/hooks/useBasicLayout'
|
|||||||
import { PromptStore, SvgIcon } from '@/components/common'
|
import { PromptStore, SvgIcon } from '@/components/common'
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
import {sessionDetailForSetup} from "@/store";
|
import {sessionDetailForSetup} from "@/store";
|
||||||
|
const sessionDetailData=sessionDetailForSetup()
|
||||||
|
const {sessionDetail, dataList,gptMode,currentListUuid } = storeToRefs(sessionDetailData)
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const chatStore = useChatStore()
|
const chatStore = useChatStore()
|
||||||
|
|
||||||
@ -22,6 +24,7 @@ const collapsed = computed(() => appStore.siderCollapsed)
|
|||||||
|
|
||||||
async function handleAdd() {
|
async function handleAdd() {
|
||||||
await sessionDetailForSetup().createSessionStore()
|
await sessionDetailForSetup().createSessionStore()
|
||||||
|
await chatStore.setActive(currentListUuid.value)
|
||||||
/* chatStore.addHistory({ title: t('chat.newChatTitle'), uuid: Date.now(), isEdit: false })
|
/* chatStore.addHistory({ title: t('chat.newChatTitle'), uuid: Date.now(), isEdit: false })
|
||||||
if (isMobile.value)
|
if (isMobile.value)
|
||||||
appStore.setSiderCollapsed(true) */
|
appStore.setSiderCollapsed(true) */
|
||||||
@ -63,7 +66,9 @@ const mobileSafeArea = computed(() => {
|
|||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
})
|
})
|
||||||
|
const options=ref([{ label: 'GPT-3.5', value: 'gpt-3.5-turbo' },
|
||||||
|
{ label: 'GPT-4.0', value: 'gpt-4-1106-preview' },
|
||||||
|
{ label: 'GPT-V', value: 'gpt-4-vision-preview' }])
|
||||||
watch(
|
watch(
|
||||||
isMobile,
|
isMobile,
|
||||||
(val) => {
|
(val) => {
|
||||||
@ -79,8 +84,8 @@ watch(
|
|||||||
<template>
|
<template>
|
||||||
<NLayoutSider
|
<NLayoutSider
|
||||||
:collapsed="collapsed"
|
:collapsed="collapsed"
|
||||||
:collapsed-width="0"
|
:collapsed-width="15"
|
||||||
:width="260"
|
:width="270"
|
||||||
:show-trigger="isMobile ? false : 'arrow-circle'"
|
:show-trigger="isMobile ? false : 'arrow-circle'"
|
||||||
collapse-mode="transform"
|
collapse-mode="transform"
|
||||||
position="absolute"
|
position="absolute"
|
||||||
@ -90,10 +95,20 @@ watch(
|
|||||||
>
|
>
|
||||||
<div class="flex flex-col h-full" :style="mobileSafeArea">
|
<div class="flex flex-col h-full" :style="mobileSafeArea">
|
||||||
<main class="flex flex-col flex-1 min-h-0">
|
<main class="flex flex-col flex-1 min-h-0">
|
||||||
<div class="p-4">
|
<div class="p-4" style="display: flex">
|
||||||
<NButton dashed block @click="handleAdd">
|
<NButton color="#764CF6" style="flex:0.9;display: flex;justify-content: center;align-items: center;margin-right: auto" dashed block @click="handleAdd">
|
||||||
{{ $t('chat.newChatButton') }}
|
新建会话
|
||||||
</NButton>
|
</NButton>
|
||||||
|
<div >
|
||||||
|
<a-select
|
||||||
|
align="center"
|
||||||
|
v-model:value="gptMode"
|
||||||
|
style="width: 110px"
|
||||||
|
:dropdown-match-select-width="false"
|
||||||
|
>
|
||||||
|
<a-select-option align="center" v-for="(item,index) in options" :key="index" :value="item.value">{{item.label}}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 min-h-0 pb-4 overflow-hidden">
|
<div class="flex-1 min-h-0 pb-4 overflow-hidden">
|
||||||
<List />
|
<List />
|
||||||
|
Loading…
Reference in New Issue
Block a user