修改系统头显示头像,模型及会话添加token消耗查看

This commit is contained in:
junleea 2025-03-30 16:54:44 +08:00
parent fb7e6d8fe8
commit b80d9f96c2
8 changed files with 23 additions and 6 deletions

View File

@ -22,19 +22,19 @@
<i class="el-icon-lx-skin"></i>
</el-tooltip>
</div>
<div class="btn-icon" @click="router.push('/ucenter')">
<!-- <div class="btn-icon" @click="router.push('/ucenter')">
<el-tooltip effect="dark" :content="message ? `有${message}条未读消息` : `消息中心`" placement="bottom">
<i class="el-icon-lx-notice"></i>
</el-tooltip>
<span class="btn-bell-badge" v-if="message"></span>
</div>
</div> -->
<div class="btn-icon" @click="setFullScreen">
<el-tooltip effect="dark" content="全屏" placement="bottom">
<i class="el-icon-lx-full"></i>
</el-tooltip>
</div>
<!-- 用户头像 -->
<el-avatar class="user-avator" :size="30" :src="imgurl" />
<el-avatar class="user-avator" :size="30" :src="imgurl2" />
<!-- 用户名下拉菜单 -->
<el-dropdown class="user-name" trigger="click" @command="handleCommand">
<span class="el-dropdown-link">
@ -64,6 +64,7 @@ const username: string | null = localStorage.getItem('ms_username');
const message: number = 2;
const imgurl2: string = localStorage.getItem('ms_imgurl') || imgurl;
const sidebar = useSidebarStore();
//
const collapseChage = () => {

View File

@ -55,7 +55,7 @@ export const usePermissStore = defineStore("permiss", {
"56", //文件管理
"71", //用户功能管理
],
user: ["0", "71", "8", "7", "9", "61", "53", "51", "56"],
user: ["0", "8", "7", "9", "51" ,"53","55" ,"56","61", "71"],
},
};
},

View File

@ -9,4 +9,4 @@ export interface File {
file_store_name: string;
}
export const fileUrl ="https://pm.ljsea.top/file/";
export const fileUrl ="https://pm.ljsea.top/tool/file/";

View File

@ -9,6 +9,7 @@ export interface Model{
Type: string;
Parameter: string;
Description: string;
token: number; //消耗大模型的token
}
export interface ModelParameter{

View File

@ -7,4 +7,5 @@ export interface Session {
Countext: any;
Name: string;
UserID: number;
TokenUsage: number; //消耗大模型的token
}

View File

@ -280,6 +280,18 @@ const saveAvatar =async () => {
let formData = new FormData();
//
let file= dataURLtoFile(imgSrc.value, 'avatar.jpg');
//
const allowedTypes = ['image/jpeg', 'image/png', 'image/jpg'];
if (!allowedTypes.includes(file.type)) {
ElMessage.error('文件类型不符合要求请选择jpg或png格式的图片');
return;
}
//
const maxSize = 2 * 1024 * 1024; // 5MB
if (file.size > maxSize) {
ElMessage.error('文件大小超过限制最大2MB');
return;
}
formData.append('file', file);
//console.log("add file: " + this.file);
@ -297,7 +309,7 @@ const saveAvatar =async () => {
let resp_data = result.data;
//console.log("resp:",resp_data);
let url = "https://tx.ljsea.top/tool/file/"+resp_data.FileStoreName;
let url = "https://pm.ljsea.top/tool/file/"+resp_data.FileStoreName;
userInfo.value.Avatar = url;
avatarImg.value = url;

View File

@ -78,6 +78,7 @@ let columns = ref([
{prop: 'Description', label: '描述'},
{ prop: 'Parameter', label: '参数', width: 250 },
{prop: 'Url', label: 'URl'},
{ prop: 'token', label: '消耗token数',width:50},
{ prop: 'CreatedAt', label: '创建时间',type: 'date' },
{ prop: 'operator', label: '操作', width: 250 , operate: { view: true, edit: true, delete: true,push: {link: false,label:"继续该会话"},gen: {show: false,label:"下载文件"} }},
])

View File

@ -88,6 +88,7 @@ let columns = ref([
{ prop: 'ID', label: '会话ID', width: 50 },
{ prop: 'Name', label: '会话名' ,width: 300},
{ prop: 'MsgCount', label: '消息数',width:50},
{ prop: 'TokenUsage', label: '消耗token数',width:50},
{ prop: "Context", label: "会话背景参数" ,width: 100},
{ prop: 'CreatedAt', label: '创建时间',type: 'date',width: 150 },
{ prop: 'UpdatedAt', label: '更新时间',type: 'date',width: 150 },