add 'type' field for ChatModel, support Chat and Image model

This commit is contained in:
RockYang
2024-12-25 18:57:18 +08:00
parent cbf06eea24
commit acee2d9d81
35 changed files with 766 additions and 698 deletions

View File

@@ -1,40 +1,36 @@
<template>
<div :class="'sidebar '+theme">
<div :class="'sidebar ' + theme">
<a class="logo w-full" href="/" target="_blank">
<el-image :src="logo"/>
<el-image :src="logo" />
<span class="text" v-show="!sidebar.collapse">{{ title }}</span>
</a>
<el-menu
class="sidebar-el-menu"
:default-active="onRoutes"
:collapse="sidebar.collapse"
background-color="#324157"
text-color="#bfcbd9"
active-text-color="#20a0ff"
unique-opened
router
class="sidebar-el-menu"
:default-active="onRoutes"
:collapse="sidebar.collapse"
background-color="#324157"
text-color="#bfcbd9"
active-text-color="#20a0ff"
unique-opened
router
>
<template v-for="item in items">
<template v-if="item.subs">
<el-sub-menu :index="item.index" :key="item.index">
<template #title>
<i :class="'iconfont icon-'+item.icon"></i>
<i :class="'iconfont icon-' + item.icon"></i>
<span>{{ item.title }}</span>
</template>
<template v-for="subItem in item.subs">
<el-sub-menu
v-if="subItem.subs"
:index="subItem.index"
:key="subItem.index"
>
<el-sub-menu v-if="subItem.subs" :index="subItem.index" :key="subItem.index">
<template #title>{{ subItem.title }}</template>
<el-menu-item v-for="(threeItem, i) in subItem.subs" :key="i" :index="threeItem.index">
{{ threeItem.title }}
</el-menu-item>
</el-sub-menu>
<el-menu-item v-else :index="subItem.index" :key="subItem.index">
<i v-if="subItem.icon" :class="'iconfont icon-'+subItem.icon"></i>
<i v-if="subItem.icon" :class="'iconfont icon-' + subItem.icon"></i>
{{ subItem.title }}
</el-menu-item>
</template>
@@ -42,7 +38,7 @@
</template>
<template v-else>
<el-menu-item :index="item.index" :key="item.index">
<i :class="'iconfont icon-'+item.icon"></i>
<i :class="'iconfont icon-' + item.icon"></i>
<template #title>{{ item.title }}</template>
</el-menu-item>
</template>
@@ -52,120 +48,125 @@
</template>
<script setup>
import {computed, ref, watch} from 'vue';
import {setMenuItems, useSidebarStore} from '@/store/sidebar';
import {httpGet} from "@/utils/http";
import {ElMessage} from "element-plus";
import {useRoute} from "vue-router";
import {useSharedStore} from "@/store/sharedata";
import { computed, ref, watch } from "vue";
import { setMenuItems, useSidebarStore } from "@/store/sidebar";
import { httpGet } from "@/utils/http";
import { ElMessage } from "element-plus";
import { useRoute } from "vue-router";
import { useSharedStore } from "@/store/sharedata";
const title = ref('')
const logo = ref('')
const title = ref("");
const logo = ref("");
// 加载系统配置
httpGet('/api/admin/config/get?key=system').then(res => {
title.value = res.data.admin_title
logo.value = res.data.logo
}).catch(e => {
ElMessage.error("加载系统配置失败: " + e.message)
})
const store = useSharedStore()
const theme = ref(store.theme)
watch(() => store.theme, (val) => {
theme.value = val
})
httpGet("/api/admin/config/get?key=system")
.then((res) => {
title.value = res.data.admin_title;
logo.value = res.data.logo;
})
.catch((e) => {
ElMessage.error("加载系统配置失败: " + e.message);
});
const store = useSharedStore();
const theme = ref(store.theme);
watch(
() => store.theme,
(val) => {
theme.value = val;
}
);
const items = [
{
icon: 'home',
index: '/admin/dashboard',
title: '仪表盘',
icon: "home",
index: "/admin/dashboard",
title: "仪表盘",
},
{
icon: 'user-fill',
index: '/admin/user',
title: '用户管理',
icon: "user-fill",
index: "/admin/user",
title: "用户管理",
},
{
icon: 'menu',
index: '1',
title: '应用管理',
icon: "menu",
index: "1",
title: "应用管理",
subs: [
{
index: '/admin/app',
title: '应用列表',
index: "/admin/app",
title: "应用列表",
},
{
index: '/admin/app/type',
title: '应用分类',
index: "/admin/app/type",
title: "应用分类",
},
],
},
{
icon: 'api-key',
index: '/admin/apikey',
title: 'API-KEY',
icon: "api-key",
index: "/admin/apikey",
title: "API-KEY",
},
{
icon: 'model',
index: '/admin/chat/model',
title: '语言模型',
icon: "model",
index: "/admin/chat/model",
title: "模型管理",
},
{
icon: 'recharge',
index: '/admin/product',
title: '充值产品',
icon: "recharge",
index: "/admin/product",
title: "充值产品",
},
{
icon: 'order',
index: '/admin/order',
title: '充值订单',
icon: "order",
index: "/admin/order",
title: "充值订单",
},
{
icon: 'reward',
index: '/admin/redeem',
title: '兑换码',
icon: "reward",
index: "/admin/redeem",
title: "兑换码",
},
{
icon: 'control',
index: '/admin/functions',
title: '函数管理',
icon: "control",
index: "/admin/functions",
title: "函数管理",
},
{
icon: 'prompt',
index: '/admin/chats',
title: '对话管理',
icon: "prompt",
index: "/admin/chats",
title: "对话管理",
},
{
icon: 'image',
index: '/admin/images',
title: '绘图管理',
icon: "image",
index: "/admin/images",
title: "绘图管理",
},
{
icon: 'mp3',
index: '/admin/medias',
title: '音视频管理',
icon: "mp3",
index: "/admin/medias",
title: "音视频管理",
},
{
icon: 'role',
index: '/admin/manger',
title: '管理员',
icon: "role",
index: "/admin/manger",
title: "管理员",
},
{
icon: 'config',
index: '/admin/system',
title: '系统设置',
icon: "config",
index: "/admin/system",
title: "系统设置",
},
{
icon: 'log',
index: '/admin/powerLog',
title: '用户算力日志',
icon: "log",
index: "/admin/powerLog",
title: "用户算力日志",
},
{
icon: 'log',
index: '/admin/loginLog',
title: '用户登录日志',
icon: "log",
index: "/admin/loginLog",
title: "用户登录日志",
},
// {
// icon: 'menu',
@@ -198,7 +199,7 @@ const onRoutes = computed(() => {
});
const sidebar = useSidebarStore();
setMenuItems(items)
setMenuItems(items);
</script>
<style scoped lang="stylus">
@@ -291,5 +292,4 @@ setMenuItems(items)
border-color var(--el-border-color)
}
}
</style>