mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
fix: lint
This commit is contained in:
@@ -68,7 +68,7 @@ import { computed } from 'vue'
|
||||
import SvgIcon from '@jamescoyle/vue-icon'
|
||||
import { mdiRobot, mdiChatOutline, mdiCogBox } from '@mdi/js'
|
||||
import { useRouter,useRoute } from 'vue-router'
|
||||
import { useUserStore } from '@/store/User.ts'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import i18n from '@/i18n'
|
||||
import { ref } from 'vue'
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ import UserChat from './UserChat/index.vue'
|
||||
import RobotChat from './RobotChat/index.vue'
|
||||
import { inject, nextTick, ref, watch } from 'vue'
|
||||
import { useElementBounding } from '@vueuse/core'
|
||||
import { useChatList } from '@/store/ChatList'
|
||||
import { useChatList } from '@/store/chat-list'
|
||||
import { onBeforeRouteLeave } from 'vue-router'
|
||||
import { storeToRefs } from 'pinia'
|
||||
// 模拟一下数据
|
||||
@@ -54,13 +54,12 @@ import {
|
||||
ScrollArea,
|
||||
Textarea,
|
||||
Button,
|
||||
TextGenerateEffect
|
||||
} from '@memoh/ui'
|
||||
import SvgIcon from '@jamescoyle/vue-icon'
|
||||
import { mdiSendOutline } from '@mdi/js'
|
||||
import ChatList from '@/components/ChatList/index.vue'
|
||||
import ChatList from '@/components/chat-list/index.vue'
|
||||
import { provide, ref } from 'vue'
|
||||
import { useChatList } from '@/store/ChatList'
|
||||
import { useChatList } from '@/store/chat-list'
|
||||
import { storeToRefs } from 'pinia'
|
||||
const chatSay = ref('')
|
||||
const curInputSay = ref('')
|
||||
|
||||
@@ -108,7 +108,7 @@ import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import * as z from 'zod'
|
||||
import request from '@/utils/request'
|
||||
import { useUserStore } from '@/store/User.ts'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { ref } from 'vue'
|
||||
import { toast } from 'vue-sonner'
|
||||
const router = useRouter()
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import MainLayout from '@/layout/mainLayout/index.vue'
|
||||
import SideBar from '@/components/Sidebar/index.vue'
|
||||
import MainContainer from '@/components/MainContainer/index.vue'
|
||||
import SideBar from '@/components/sidebar/index.vue'
|
||||
import MainContainer from '@/components/main-container/index.vue'
|
||||
import { provide,ref } from 'vue'
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
<script setup lang="ts">
|
||||
import { useQuery,useMutation,useQueryCache } from '@pinia/colada'
|
||||
import request from '@/utils/request'
|
||||
import { watch, h, provide,ref, computed,reactive } from 'vue'
|
||||
import DataTable from '@/components/DataTable/index.vue'
|
||||
import CreateMCP from '@/components/CreateMCP/index.vue'
|
||||
import { h, provide,ref, computed } from 'vue'
|
||||
import DataTable from '@/components/data-table/index.vue'
|
||||
import CreateMCP from '@/components/create-mcp/index.vue'
|
||||
import { type ColumnDef } from '@tanstack/vue-table'
|
||||
import {
|
||||
Badge,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
// import type { Payment } from '@/components/columns'
|
||||
import { computed, ref, provide, watch, reactive } from 'vue'
|
||||
import modelSetting from './modelSetting.vue'
|
||||
import modelSetting from './model-setting.vue'
|
||||
import { useQuery, useQueryCache } from '@pinia/colada'
|
||||
import {
|
||||
ScrollArea,
|
||||
@@ -33,7 +33,7 @@ import { mdiMagnify,mdiListBoxOutline } from '@mdi/js'
|
||||
import SvgIcon from '@jamescoyle/vue-icon'
|
||||
import request from '@/utils/request'
|
||||
import { type ProviderInfo } from '@memoh/shared'
|
||||
import AddProvider from '@/components/AddProvider/index.vue'
|
||||
import AddProvider from '@/components/add-provider/index.vue'
|
||||
import { clientType } from '@memoh/shared'
|
||||
|
||||
const filterProvider = ref('')
|
||||
|
||||
+1
-1
@@ -268,7 +268,7 @@ import {
|
||||
SelectGroup,
|
||||
SelectItem
|
||||
} from '@memoh/ui'
|
||||
import CreateModel from '@/components/CreateModel/index.vue'
|
||||
import CreateModel from '@/components/create-model/index.vue'
|
||||
import { computed, inject, provide, reactive, ref, toRef, toValue, watch } from 'vue'
|
||||
import { type ProviderInfo } from '@memoh/shared'
|
||||
import { useMutation, useQuery, useQueryCache } from '@pinia/colada'
|
||||
@@ -210,7 +210,7 @@
|
||||
import { useMutation, useQuery } from '@pinia/colada'
|
||||
import request from '@/utils/request'
|
||||
import { watch, h, provide, ref } from 'vue'
|
||||
import AddPlatform from '@/components/AddPlatform/index.vue'
|
||||
import AddPlatform from '@/components/add-platform/index.vue'
|
||||
import {Card,CardHeader,CardFooter,CardContent,CardTitle,Switch,Button, Badge } from '@memoh/ui'
|
||||
|
||||
const open = ref(false)
|
||||
|
||||
@@ -218,7 +218,7 @@ import { toast } from 'vue-sonner'
|
||||
import i18n from '@/i18n'
|
||||
import { useColorMode } from '@vueuse/core'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useUserStore } from '../../store/User'
|
||||
import { useUserStore } from '../../store/user'
|
||||
const router=useRouter()
|
||||
|
||||
const { exitLogin } = useUserStore()
|
||||
|
||||
@@ -1,56 +1,60 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { reactive,watch } from 'vue'
|
||||
import { reactive, watch } from 'vue'
|
||||
import { useLocalStorage } from '@vueuse/core'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
|
||||
type user={
|
||||
'id': string,
|
||||
'username': string,
|
||||
'role': string,
|
||||
'displayName': string
|
||||
export interface UserInfo {
|
||||
id: string;
|
||||
username: string;
|
||||
role: string;
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
export const useUserStore = defineStore(
|
||||
'user',
|
||||
() => {
|
||||
const userInfo = reactive<UserInfo>({
|
||||
id: '',
|
||||
username: '',
|
||||
role: '',
|
||||
displayName: '',
|
||||
})
|
||||
|
||||
export const useUserStore = defineStore('user', () => {
|
||||
const userInfo = reactive<user>({
|
||||
'id': '',
|
||||
'username': '',
|
||||
'role': '',
|
||||
'displayName': ''
|
||||
})
|
||||
const localToken = useLocalStorage('token', '')
|
||||
|
||||
const localToken=useLocalStorage('token','')
|
||||
|
||||
|
||||
const login = (userData: user,token:string) => {
|
||||
localToken.value=token
|
||||
for (const key of Object.keys(userData) as (keyof user)[]) {
|
||||
userInfo[key] = userData[key]
|
||||
const login = (userData: UserInfo, token: string) => {
|
||||
localToken.value = token
|
||||
for (const key of Object.keys(userData) as (keyof UserInfo)[]) {
|
||||
userInfo[key] = userData[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const exitLogin = () => {
|
||||
localToken.value=''
|
||||
for (const key of Object.keys(userInfo) as (keyof user)[]) {
|
||||
userInfo[key]=''
|
||||
const exitLogin = () => {
|
||||
localToken.value = ''
|
||||
for (const key of Object.keys(userInfo) as (keyof UserInfo)[]) {
|
||||
userInfo[key as keyof UserInfo] = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
const router=useRouter()
|
||||
watch(localToken, () => {
|
||||
|
||||
if (!localToken.value) {
|
||||
exitLogin()
|
||||
router.replace({name:'Login'})
|
||||
const router = useRouter()
|
||||
watch(
|
||||
localToken,
|
||||
() => {
|
||||
if (!localToken.value) {
|
||||
exitLogin()
|
||||
router.replace({ name: 'Login' })
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
)
|
||||
return {
|
||||
userInfo,
|
||||
login,
|
||||
exitLogin,
|
||||
}
|
||||
}, {
|
||||
immediate: true
|
||||
})
|
||||
return {
|
||||
userInfo,
|
||||
login,
|
||||
exitLogin
|
||||
}
|
||||
}, {
|
||||
persist:true
|
||||
})
|
||||
},
|
||||
{
|
||||
persist: true,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user