diff --git a/ui/src/enums/common.ts b/ui/src/enums/common.ts
new file mode 100644
index 000000000..dd655309b
--- /dev/null
+++ b/ui/src/enums/common.ts
@@ -0,0 +1,4 @@
+export enum DeviceType {
+ Mobile = 'Mobile',
+ Desktop = 'Desktop'
+}
diff --git a/ui/src/enums/document.ts b/ui/src/enums/document.ts
new file mode 100644
index 000000000..0a03c9c12
--- /dev/null
+++ b/ui/src/enums/document.ts
@@ -0,0 +1,4 @@
+export enum hitHandlingMethod {
+ optimization = '模型优化',
+ directly_return = '直接回答'
+}
diff --git a/ui/src/enums/team.ts b/ui/src/enums/team.ts
new file mode 100644
index 000000000..4e72f3690
--- /dev/null
+++ b/ui/src/enums/team.ts
@@ -0,0 +1,6 @@
+export enum TeamEnum {
+ MANAGE = 'MANAGE',
+ USE = 'USE',
+ DATASET = 'DATASET',
+ APPLICATION = 'APPLICATION'
+}
diff --git a/ui/src/layout/hooks/useResize.ts b/ui/src/layout/hooks/useResize.ts
new file mode 100644
index 000000000..854bf4ced
--- /dev/null
+++ b/ui/src/layout/hooks/useResize.ts
@@ -0,0 +1,36 @@
+import { watch, onBeforeMount, onMounted, onBeforeUnmount } from 'vue'
+import { useRoute } from 'vue-router'
+import useStore from '@/stores'
+import { DeviceType } from '@/enums/common'
+/** 参考 Bootstrap 的响应式设计 WIDTH = 600 */
+const WIDTH = 600
+
+/** 根据大小变化重新布局 */
+export default () => {
+ const { common } = useStore()
+ const _isMobile = () => {
+ const rect = document.body.getBoundingClientRect()
+ return rect.width - 1 < WIDTH
+ }
+
+ const _resizeHandler = () => {
+ if (!document.hidden) {
+ const isMobile = _isMobile()
+ common.toggleDevice(isMobile ? DeviceType.Mobile : DeviceType.Desktop)
+ }
+ }
+
+ onBeforeMount(() => {
+ window.addEventListener('resize', _resizeHandler)
+ })
+
+ onMounted(() => {
+ if (_isMobile()) {
+ common.toggleDevice(DeviceType.Mobile)
+ }
+ })
+
+ onBeforeUnmount(() => {
+ window.removeEventListener('resize', _resizeHandler)
+ })
+}
diff --git a/ui/src/stores/modules/common.ts b/ui/src/stores/modules/common.ts
index 606d574f0..d02841157 100644
--- a/ui/src/stores/modules/common.ts
+++ b/ui/src/stores/modules/common.ts
@@ -1,9 +1,11 @@
import { defineStore } from 'pinia'
+import { DeviceType } from '@/enums/common'
export interface commonTypes {
breadcrumb: any
paginationConfig: any | null
search: any
+ device: string
}
const useCommonStore = defineStore({
@@ -12,7 +14,8 @@ const useCommonStore = defineStore({
breadcrumb: null,
// 搜索和分页缓存
paginationConfig: {},
- search: {}
+ search: {},
+ device: DeviceType.Desktop
}),
actions: {
saveBreadcrumb(data: any) {
@@ -23,6 +26,12 @@ const useCommonStore = defineStore({
},
saveCondition(val: string, data: any) {
this.search[val] = data
+ },
+ toggleDevice(value: DeviceType) {
+ this.device = value
+ },
+ isMobile() {
+ return this.device === DeviceType.Mobile
}
}
})
diff --git a/ui/src/views/chat/embed/index.vue b/ui/src/views/chat/embed/index.vue
index 01740ad45..3e166596c 100644
--- a/ui/src/views/chat/embed/index.vue
+++ b/ui/src/views/chat/embed/index.vue
@@ -32,7 +32,7 @@
历史记录
-
+
+
+
+
+
+
+
-../utils
\ No newline at end of file
diff --git a/ui/src/views/team/index.vue b/ui/src/views/team/index.vue
index 07179efed..1cee31194 100644
--- a/ui/src/views/team/index.vue
+++ b/ui/src/views/team/index.vue
@@ -82,7 +82,7 @@ import type { TeamMember } from '@/api/type/team'
import CreateMemberDialog from './component/CreateMemberDialog.vue'
import PermissionSetting from './component/PermissionSetting.vue'
import { MsgSuccess, MsgConfirm } from '@/utils/message'
-import { DATASET, APPLICATION, isManage } from './utils'
+import { TeamEnum } from '@/enums/team'
const CreateMemberRef = ref>()
const loading = ref(false)
@@ -94,18 +94,18 @@ const currentType = ref('')
const filterText = ref('')
-const activeName = ref(DATASET)
+const activeName = ref(TeamEnum.DATASET)
const tableHeight = ref(0)
const settingTags = reactive([
{
label: '知识库',
- value: DATASET,
+ value: TeamEnum.DATASET,
data: [] as any
},
{
label: '应用',
- value: APPLICATION,
+ value: TeamEnum.APPLICATION,
data: [] as any
}
])
@@ -118,6 +118,10 @@ watch(filterText, (val) => {
}
})
+function isManage(type: String) {
+ return type === 'manage'
+}
+
function submitPermissions() {
rLoading.value = true
const obj: any = {
diff --git a/ui/src/views/team/utils.ts b/ui/src/views/team/utils.ts
deleted file mode 100644
index 358151cf1..000000000
--- a/ui/src/views/team/utils.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export const MANAGE = 'MANAGE'
-export const USE = 'USE'
-export const DATASET = 'DATASET'
-export const APPLICATION = 'APPLICATION'
-
-export function isManage(type: String) {
- return type === 'manage'
-}