Compare commits

...

2 Commits

Author SHA1 Message Date
junleea 4f3d6b514d 添加功能选择模型从单选改多选 2025-03-30 19:30:06 +08:00
junleea b80d9f96c2 修改系统头显示头像,模型及会话添加token消耗查看 2025-03-30 16:54:44 +08:00
13 changed files with 103 additions and 13 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

@ -9,7 +9,7 @@
<el-input-number v-else-if="item.type === 'number'" v-model="form[item.prop]"
:disabled="item.disabled" controls-position="right"></el-input-number>
<el-select v-else-if="item.type === 'select'" v-model="form[item.prop]" :disabled="item.disabled"
:placeholder="item.placeholder" clearable >
:placeholder="item.placeholder" clearable :multiple="item.multiple?true:false">
<el-option v-for="opt in item.opts" :label="opt.label" :value="opt.value"></el-option>
</el-select>
<el-date-picker v-else-if="item.type === 'date'" type="date" v-model="form[item.prop]"
@ -39,6 +39,7 @@
<script lang="ts" setup>
import { FormOption } from '@/types/form-option';
import { json } from 'd3';
import { FormInstance, FormRules, UploadProps } from 'element-plus';
import { PropType, ref } from 'vue';
@ -62,7 +63,30 @@ const { options, formData, edit, update } = defineProps({
});
const form = ref({ ...(edit ? formData : {}) });
//const form = ref({ ...(edit ? formData : {}) });
const form = ref();
const doFormData = () => {
let a={}
let initialForm = { ...(edit ? formData : {}) };
options.list.forEach(item => {
if (item.type === 'select' && item.multiple) {
let ids = formData[item.prop];
let id_list = JSON.parse(ids);
console.log(id_list);
let selectedValues = [];
for (let i = 0; i < id_list.length; i++) {
selectedValues.push(id_list[i]["id"]);
}
if (!Array.isArray(initialForm[item.prop])) {
initialForm[item.prop] = selectedValues;
}
}
});
return initialForm;
};
form.value=doFormData();
const rules: FormRules = options.list.map(item => {
if (item.required) {

View File

@ -48,7 +48,7 @@ const routes: RouteRecordRaw[] = [
title: '功能管理',
permiss: '54',
},
component: () => import(/* webpackChunkName: "system-user" */ '../views/system/function.vue'),
component: () => import(/* webpackChunkName: "system-user" */ '../views/system/manage-function.vue'),
},
{
path: '/manage-file',

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

@ -6,6 +6,7 @@ export interface Function{
Name: string;
Info: string;
UserID: number;
ModelID: number;
ModelID: number | Object | Array<any>;
ModelIDs: string;
Function: string;
}

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

@ -124,7 +124,7 @@ let options_edit = ref<FormOption>({
span: 12,
list: [
{ type: 'input', label: '名称', prop: 'Name', required: true },
{ type: 'select', label: '模型', prop: 'ModelID', required: true, opts:model_select_opts.value, multiple: true},
{ type: 'select', label: '模型', prop: 'ModelIDS', required: true, opts:model_select_opts.value, multiple: true},
{ type: 'input', label: '功能', prop: 'Function', required: true },
{ type: 'input', label: '描述', prop: 'Info', required: true },
]
@ -138,19 +138,26 @@ const rowData = ref({});
const handleEdit = async (row: Function) => {
let data = row;
rowData.value = data;
console.log("edit_row_data:", rowData.value);
//console.log("edit_row_data:", rowData.value);
isEdit.value = true;
visible.value = true;
};
const updateData = async (data) => {
let model_id =[]
let model_id_list= data["ModelID"]
for (let i = 0; i < model_id_list.length; i++) {
model_id.push({"id":model_id_list[i]})
}
let model_ids = JSON.stringify(model_id)
let result ={}
try{
let req={
token:localStorage.getItem("token"),
id: data.ID,
name: data.Name,
model_id: data.ModelID,
model_id: model_id_list[0],
function: data.Function,
model_ids: model_ids,
info: data.Info
};
result = await UpdateFunctionService(req)

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 },

View File

@ -2,5 +2,46 @@
<div>
<h2>智能选题推荐</h2>
</div>
<el-select v-model="selected" placeholder="请选择" multiple>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button type="primary" @click="handleSearch">查询</el-button>
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue';
interface Option {
value: string;
label: string;
}
interface OptionList {
value: string;
label: string;
}
const selected = ref();
const options = ref<Option[]>([
{ value: 'option1', label: '选项1' },
{ value: 'option2', label: '选项2' },
{ value: 'option3', label: '选项3' },
{ value: 'option4', label: '选项4' },
]);
const handleSearch = async () => {
//
console.log('Selected:', selected.value);
//
// let req={
// token: localStorage.getItem('token'),
// type: "ID",
// id: parseInt(query.name)
// }
// let result = await FindModelService(req);
// tableData.value = result.data;
}
</script>