main
parent
b7f46d1c22
commit
bf5f9f7752
@ -0,0 +1,9 @@
|
||||
# Glob API URL
|
||||
VITE_GLOB_API_URL=/api
|
||||
|
||||
VITE_APP_API_BASE_URL=https://erpapi.fontree.cn
|
||||
# Whether long replies are supported, which may result in higher API fees
|
||||
VITE_GLOB_OPEN_LONG_REPLY=true
|
||||
|
||||
# When you want to use PWA
|
||||
VITE_GLOB_APP_PWA=false
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" 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>
|
After Width: | Height: | Size: 303 B |
@ -1,128 +1,160 @@
|
||||
<script setup>
|
||||
import {createSession} from "@/api/api";
|
||||
import {Local} from "@/utils/storage/storage";
|
||||
import {storeToRefs} from "pinia";
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { NButton, NLayoutSider, useDialog,NSelect } from 'naive-ui'
|
||||
import {computed, ref, watch} from 'vue'
|
||||
import {NButton, NLayoutSider, useDialog, NSelect} from 'naive-ui'
|
||||
import List from './List.vue'
|
||||
import Footer from './Footer.vue'
|
||||
import { useAppStore, useChatStore } from '@/store'
|
||||
import { useBasicLayout } from '@/hooks/useBasicLayout'
|
||||
import { PromptStore, SvgIcon } from '@/components/common'
|
||||
import { t } from '@/locales'
|
||||
import {useAppStore, useChatStore} from '@/store'
|
||||
import {useBasicLayout} from '@/hooks/useBasicLayout'
|
||||
import {PromptStore, SvgIcon} from '@/components/common'
|
||||
import {t} from '@/locales'
|
||||
import {sessionDetailForSetup} from "@/store";
|
||||
const sessionDetailData=sessionDetailForSetup()
|
||||
const {sessionDetail, dataList,gptMode,currentListUuid,isGPT4 } = storeToRefs(sessionDetailData)
|
||||
|
||||
const sessionDetailData = sessionDetailForSetup()
|
||||
const {
|
||||
sessionDetail,
|
||||
dataList,
|
||||
gptMode,
|
||||
currentListUuid,
|
||||
isGPT4
|
||||
} = storeToRefs(sessionDetailData)
|
||||
const appStore = useAppStore()
|
||||
const chatStore = useChatStore()
|
||||
|
||||
const dialog = useDialog()
|
||||
|
||||
const { isMobile } = useBasicLayout()
|
||||
const {isMobile} = useBasicLayout()
|
||||
const show = ref(false)
|
||||
|
||||
const collapsed = computed(() => appStore.siderCollapsed)
|
||||
|
||||
async function handleAdd() {
|
||||
await sessionDetailForSetup().createSessionStore()
|
||||
sessionDetail.value=[]
|
||||
await chatStore.setActive(currentListUuid.value)
|
||||
await sessionDetailForSetup().createSessionStore()
|
||||
sessionDetail.value = []
|
||||
await chatStore.setActive(currentListUuid.value)
|
||||
}
|
||||
|
||||
function handleUpdateCollapsed() {
|
||||
appStore.setSiderCollapsed(!collapsed.value)
|
||||
appStore.setSiderCollapsed(!collapsed.value)
|
||||
}
|
||||
|
||||
function handleClearAll() {
|
||||
dialog.warning({
|
||||
title: t('chat.deleteMessage'),
|
||||
content: t('chat.clearHistoryConfirm'),
|
||||
positiveText: t('common.yes'),
|
||||
negativeText: t('common.no'),
|
||||
onPositiveClick: () => {
|
||||
chatStore.clearHistory()
|
||||
if (isMobile.value)
|
||||
appStore.setSiderCollapsed(true)
|
||||
},
|
||||
})
|
||||
dialog.warning({
|
||||
title: t('chat.deleteMessage'),
|
||||
content: t('chat.clearHistoryConfirm'),
|
||||
positiveText: t('common.yes'),
|
||||
negativeText: t('common.no'),
|
||||
onPositiveClick: () => {
|
||||
chatStore.clearHistory()
|
||||
if (isMobile.value) {
|
||||
appStore.setSiderCollapsed(true)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const getMobileClass = computed(() => {
|
||||
if (isMobile.value) {
|
||||
return {
|
||||
position: 'fixed',
|
||||
zIndex: 50,
|
||||
}
|
||||
}
|
||||
return {}
|
||||
if (isMobile.value) {
|
||||
return {
|
||||
position: 'fixed',
|
||||
zIndex: 50,
|
||||
}
|
||||
}
|
||||
return {}
|
||||
})
|
||||
|
||||
const mobileSafeArea = computed(() => {
|
||||
if (isMobile.value) {
|
||||
return {
|
||||
paddingBottom: 'env(safe-area-inset-bottom)',
|
||||
}
|
||||
}
|
||||
return {}
|
||||
})
|
||||
const options=ref([{ label: 'GPT-3.5', value: 'gpt-3.5-turbo' },
|
||||
{ label: 'GPT-4.0', value: 'gpt-4-1106-preview' ,permission:'isGPT4'},
|
||||
{ label: 'GPT-V', value: 'gpt-4-vision-preview',permission:'isGPT4' }])
|
||||
setTimeout(()=>{
|
||||
if (localStorage.getItem('isGPT4')!=='true'){
|
||||
options.value=options.value.filter(item=>item.permission!=='isGPT4')
|
||||
if (isMobile.value) {
|
||||
return {
|
||||
paddingBottom: 'env(safe-area-inset-bottom)',
|
||||
}
|
||||
}
|
||||
},1000)
|
||||
return {}
|
||||
})
|
||||
const options = () => {
|
||||
return Local.get('ruleBtn').find(x => x === 'gpt-4-btn') ? [{
|
||||
label: 'GPT-3.5',
|
||||
value: 'gpt-3.5-turbo',
|
||||
permission: 'gpt-3.5-btn'
|
||||
},
|
||||
{
|
||||
label: 'GPT-4.0',
|
||||
value: 'gpt-4-1106-preview',
|
||||
permission: 'gpt-4-btn'
|
||||
},
|
||||
{
|
||||
label: 'GPT-V',
|
||||
value: 'gpt-4-vision-preview',
|
||||
permission: 'gpt-4-btn'
|
||||
}] : [{
|
||||
label: 'GPT-4.0',
|
||||
value: 'gpt-4-1106-preview',
|
||||
permission: 'gpt-4-btn'
|
||||
},
|
||||
{
|
||||
label: 'GPT-V',
|
||||
value: 'gpt-4-vision-preview',
|
||||
permission: 'gpt-4-btn'
|
||||
}]
|
||||
}
|
||||
watch(
|
||||
isMobile,
|
||||
(val) => {
|
||||
appStore.setSiderCollapsed(val)
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
flush: 'post',
|
||||
},
|
||||
isMobile,
|
||||
(val) => {
|
||||
appStore.setSiderCollapsed(val)
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
flush: 'post',
|
||||
},
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NLayoutSider
|
||||
:collapsed="collapsed"
|
||||
:collapsed-width="15"
|
||||
:width="270"
|
||||
:show-trigger="isMobile ? false : 'arrow-circle'"
|
||||
collapse-mode="transform"
|
||||
position="absolute"
|
||||
bordered
|
||||
:style="getMobileClass"
|
||||
@update-collapsed="handleUpdateCollapsed"
|
||||
>
|
||||
<div class="flex flex-col h-full" :style="mobileSafeArea">
|
||||
<main class="flex flex-col flex-1 min-h-0">
|
||||
<div class="p-4" style="display: flex">
|
||||
<NButton color="#764CF6" style="flex:0.9;display: flex;justify-content: center;align-items: center;margin-right: auto" dashed block @click="handleAdd">
|
||||
新建会话
|
||||
</NButton>
|
||||
<div style="width: 110px">
|
||||
<n-select v-model:value="gptMode" :options="options" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-1 min-h-0 pb-4 overflow-hidden">
|
||||
<List />
|
||||
</div>
|
||||
<!-- <div class="flex items-center p-4 space-x-4">
|
||||
<div class="flex-1">
|
||||
<NButton block @click="show = true">
|
||||
{{ $t('store.siderButton') }}
|
||||
</NButton>
|
||||
</div>
|
||||
<NButton @click="handleClearAll">
|
||||
<SvgIcon icon="ri:close-circle-line" />
|
||||
</NButton>
|
||||
</div>-->
|
||||
</main>
|
||||
<!-- <Footer />-->
|
||||
</div>
|
||||
</NLayoutSider>
|
||||
<template v-if="isMobile">
|
||||
<div v-show="!collapsed" class="fixed inset-0 z-40 w-full h-full bg-black/40" @click="handleUpdateCollapsed" />
|
||||
</template>
|
||||
<PromptStore v-model:visible="show" />
|
||||
<NLayoutSider
|
||||
:collapsed="collapsed"
|
||||
:collapsed-width="15"
|
||||
:width="270"
|
||||
:show-trigger="isMobile ? false : 'arrow-circle'"
|
||||
collapse-mode="transform"
|
||||
position="absolute"
|
||||
bordered
|
||||
:style="getMobileClass"
|
||||
@update-collapsed="handleUpdateCollapsed"
|
||||
>
|
||||
<div class="flex flex-col h-full" :style="mobileSafeArea">
|
||||
<main class="flex flex-col flex-1 min-h-0">
|
||||
<div class="p-4" style="display: flex">
|
||||
<NButton color="#764CF6"
|
||||
style="flex:0.9;display: flex;justify-content: center;align-items: center;margin-right: auto" dashed
|
||||
block @click="handleAdd"
|
||||
>
|
||||
新建会话
|
||||
</NButton>
|
||||
<div style="width: 110px">
|
||||
<n-select v-model:value="gptMode" :options="options()"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-1 min-h-0 pb-4 overflow-hidden">
|
||||
<List/>
|
||||
</div>
|
||||
<!-- <div class="flex items-center p-4 space-x-4">
|
||||
<div class="flex-1">
|
||||
<NButton block @click="show = true">
|
||||
{{ $t('store.siderButton') }}
|
||||
</NButton>
|
||||
</div>
|
||||
<NButton @click="handleClearAll">
|
||||
<SvgIcon icon="ri:close-circle-line" />
|
||||
</NButton>
|
||||
</div>-->
|
||||
</main>
|
||||
<!-- <Footer />-->
|
||||
</div>
|
||||
</NLayoutSider>
|
||||
<template v-if="isMobile">
|
||||
<div v-show="!collapsed" class="fixed inset-0 z-40 w-full h-full bg-black/40" @click="handleUpdateCollapsed"/>
|
||||
</template>
|
||||
<PromptStore v-model:visible="show"/>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue