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>
|
<script setup>
|
||||||
import {createSession} from "@/api/api";
|
import {createSession} from "@/api/api";
|
||||||
|
import {Local} from "@/utils/storage/storage";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import { computed, ref, watch } from 'vue'
|
import {computed, ref, watch} from 'vue'
|
||||||
import { NButton, NLayoutSider, useDialog,NSelect } from 'naive-ui'
|
import {NButton, NLayoutSider, useDialog, NSelect} from 'naive-ui'
|
||||||
import List from './List.vue'
|
import List from './List.vue'
|
||||||
import Footer from './Footer.vue'
|
import Footer from './Footer.vue'
|
||||||
import { useAppStore, useChatStore } from '@/store'
|
import {useAppStore, useChatStore} from '@/store'
|
||||||
import { useBasicLayout } from '@/hooks/useBasicLayout'
|
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,isGPT4 } = storeToRefs(sessionDetailData)
|
const sessionDetailData = sessionDetailForSetup()
|
||||||
|
const {
|
||||||
|
sessionDetail,
|
||||||
|
dataList,
|
||||||
|
gptMode,
|
||||||
|
currentListUuid,
|
||||||
|
isGPT4
|
||||||
|
} = storeToRefs(sessionDetailData)
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const chatStore = useChatStore()
|
const chatStore = useChatStore()
|
||||||
|
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
|
|
||||||
const { isMobile } = useBasicLayout()
|
const {isMobile} = useBasicLayout()
|
||||||
const show = ref(false)
|
const show = ref(false)
|
||||||
|
|
||||||
const collapsed = computed(() => appStore.siderCollapsed)
|
const collapsed = computed(() => appStore.siderCollapsed)
|
||||||
|
|
||||||
async function handleAdd() {
|
async function handleAdd() {
|
||||||
await sessionDetailForSetup().createSessionStore()
|
await sessionDetailForSetup().createSessionStore()
|
||||||
sessionDetail.value=[]
|
sessionDetail.value = []
|
||||||
await chatStore.setActive(currentListUuid.value)
|
await chatStore.setActive(currentListUuid.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUpdateCollapsed() {
|
function handleUpdateCollapsed() {
|
||||||
appStore.setSiderCollapsed(!collapsed.value)
|
appStore.setSiderCollapsed(!collapsed.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleClearAll() {
|
function handleClearAll() {
|
||||||
dialog.warning({
|
dialog.warning({
|
||||||
title: t('chat.deleteMessage'),
|
title: t('chat.deleteMessage'),
|
||||||
content: t('chat.clearHistoryConfirm'),
|
content: t('chat.clearHistoryConfirm'),
|
||||||
positiveText: t('common.yes'),
|
positiveText: t('common.yes'),
|
||||||
negativeText: t('common.no'),
|
negativeText: t('common.no'),
|
||||||
onPositiveClick: () => {
|
onPositiveClick: () => {
|
||||||
chatStore.clearHistory()
|
chatStore.clearHistory()
|
||||||
if (isMobile.value)
|
if (isMobile.value) {
|
||||||
appStore.setSiderCollapsed(true)
|
appStore.setSiderCollapsed(true)
|
||||||
},
|
}
|
||||||
})
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const getMobileClass = computed(() => {
|
const getMobileClass = computed(() => {
|
||||||
if (isMobile.value) {
|
if (isMobile.value) {
|
||||||
return {
|
return {
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
zIndex: 50,
|
zIndex: 50,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
})
|
})
|
||||||
|
|
||||||
const mobileSafeArea = computed(() => {
|
const mobileSafeArea = computed(() => {
|
||||||
if (isMobile.value) {
|
if (isMobile.value) {
|
||||||
return {
|
return {
|
||||||
paddingBottom: 'env(safe-area-inset-bottom)',
|
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')
|
|
||||||
}
|
}
|
||||||
},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(
|
watch(
|
||||||
isMobile,
|
isMobile,
|
||||||
(val) => {
|
(val) => {
|
||||||
appStore.setSiderCollapsed(val)
|
appStore.setSiderCollapsed(val)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
immediate: true,
|
immediate: true,
|
||||||
flush: 'post',
|
flush: 'post',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NLayoutSider
|
<NLayoutSider
|
||||||
:collapsed="collapsed"
|
:collapsed="collapsed"
|
||||||
:collapsed-width="15"
|
:collapsed-width="15"
|
||||||
:width="270"
|
:width="270"
|
||||||
:show-trigger="isMobile ? false : 'arrow-circle'"
|
:show-trigger="isMobile ? false : 'arrow-circle'"
|
||||||
collapse-mode="transform"
|
collapse-mode="transform"
|
||||||
position="absolute"
|
position="absolute"
|
||||||
bordered
|
bordered
|
||||||
:style="getMobileClass"
|
:style="getMobileClass"
|
||||||
@update-collapsed="handleUpdateCollapsed"
|
@update-collapsed="handleUpdateCollapsed"
|
||||||
>
|
>
|
||||||
<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" style="display: flex">
|
<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 color="#764CF6"
|
||||||
新建会话
|
style="flex:0.9;display: flex;justify-content: center;align-items: center;margin-right: auto" dashed
|
||||||
</NButton>
|
block @click="handleAdd"
|
||||||
<div style="width: 110px">
|
>
|
||||||
<n-select v-model:value="gptMode" :options="options" />
|
新建会话
|
||||||
</div>
|
</NButton>
|
||||||
</div>
|
<div style="width: 110px">
|
||||||
<div class="flex-1 min-h-0 pb-4 overflow-hidden">
|
<n-select v-model:value="gptMode" :options="options()"/>
|
||||||
<List />
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="flex items-center p-4 space-x-4">
|
<div class="flex-1 min-h-0 pb-4 overflow-hidden">
|
||||||
<div class="flex-1">
|
<List/>
|
||||||
<NButton block @click="show = true">
|
</div>
|
||||||
{{ $t('store.siderButton') }}
|
<!-- <div class="flex items-center p-4 space-x-4">
|
||||||
</NButton>
|
<div class="flex-1">
|
||||||
</div>
|
<NButton block @click="show = true">
|
||||||
<NButton @click="handleClearAll">
|
{{ $t('store.siderButton') }}
|
||||||
<SvgIcon icon="ri:close-circle-line" />
|
</NButton>
|
||||||
</NButton>
|
</div>
|
||||||
</div>-->
|
<NButton @click="handleClearAll">
|
||||||
</main>
|
<SvgIcon icon="ri:close-circle-line" />
|
||||||
<!-- <Footer />-->
|
</NButton>
|
||||||
</div>
|
</div>-->
|
||||||
</NLayoutSider>
|
</main>
|
||||||
<template v-if="isMobile">
|
<!-- <Footer />-->
|
||||||
<div v-show="!collapsed" class="fixed inset-0 z-40 w-full h-full bg-black/40" @click="handleUpdateCollapsed" />
|
</div>
|
||||||
</template>
|
</NLayoutSider>
|
||||||
<PromptStore v-model:visible="show" />
|
<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>
|
</template>
|
||||||
|
Loading…
Reference in New Issue