修改文件上传管理员限制,修改通用智能与提示词部分的模型参数选择展示设置
This commit is contained in:
parent
ead2961500
commit
bf05991f5d
|
|
@ -29,7 +29,7 @@ const handle = (rawFile: any) => {
|
||||||
console.log(rawFile);
|
console.log(rawFile);
|
||||||
};
|
};
|
||||||
const allowedTypes = ['doc', 'docx', 'pdf', 'txt', 'png', 'jpg', 'jpeg','md', "epub", 'go', 'java', 'py', 'js', 'html', 'css', 'json', 'xml', 'yaml', 'yml'];
|
const allowedTypes = ['doc', 'docx', 'pdf', 'txt', 'png', 'jpg', 'jpeg','md', "epub", 'go', 'java', 'py', 'js', 'html', 'css', 'json', 'xml', 'yaml', 'yml'];
|
||||||
|
const userRole = localStorage.getItem('ms_role') || '';
|
||||||
interface UploadData {
|
interface UploadData {
|
||||||
upload_type: string;
|
upload_type: string;
|
||||||
auth_type: string;
|
auth_type: string;
|
||||||
|
|
@ -62,17 +62,27 @@ const headers = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const beforeUpload = (file: any) => {
|
const beforeUpload = (file: any) => {
|
||||||
|
if(userRole == "admin"){
|
||||||
|
}
|
||||||
const fileExtension = file.name.split('.').pop().toLowerCase();
|
const fileExtension = file.name.split('.').pop().toLowerCase();
|
||||||
const isAllowedType = allowedTypes.includes(fileExtension);
|
const isAllowedType = allowedTypes.includes(fileExtension);
|
||||||
if (!isAllowedType) {
|
if (!isAllowedType && userRole != "admin") {
|
||||||
ElMessage.error('不允许的文件类型,仅支持 doc, docx, pdf, txt, png, jpg, jpeg, md, epub 及代码文本格式');
|
ElMessage.error('不允许的文件类型,仅支持 doc, docx, pdf, txt, png, jpg, jpeg, md, epub 及代码文本格式');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if(!isAllowedType && userRole == "admin"){
|
||||||
|
//提示不允许的文件类型,是否继续上传,确认后继续上传
|
||||||
|
confirm('不允许的文件类型,是否继续上传?') ? isAllowedType : false;
|
||||||
|
}
|
||||||
// 可以在这里进行文件验证等操作
|
// 可以在这里进行文件验证等操作
|
||||||
const isLt2M = file.size / 1024 / 1024 < 5;
|
const isLt2M = file.size / 1024 / 1024 < 5;
|
||||||
if (!isLt2M) {
|
if (!isLt2M && userRole != "admin") {
|
||||||
ElMessage.error('上传文件大小不能超过 5MB');
|
ElMessage.error('上传文件大小不能超过 5MB');
|
||||||
}
|
}
|
||||||
|
if(!isLt2M && userRole == "admin"){
|
||||||
|
//提示文件过大,是否继续上传,确认后继续上传
|
||||||
|
confirm('文件过大,是否继续上传?') ? isLt2M : false;
|
||||||
|
}
|
||||||
return isLt2M;
|
return isLt2M;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,7 @@ const getMyUserInfo = async (id) => {
|
||||||
localStorage.setItem("ms_imgurl", result["data"]["Avatar"]);
|
localStorage.setItem("ms_imgurl", result["data"]["Avatar"]);
|
||||||
permiss.handleSet(keys);
|
permiss.handleSet(keys);
|
||||||
localStorage.setItem("ms_keys", JSON.stringify(keys));
|
localStorage.setItem("ms_keys", JSON.stringify(keys));
|
||||||
|
localStorage.setItem("ms_role", result["data"]["Role"]);
|
||||||
router.push("/");
|
router.push("/");
|
||||||
|
|
||||||
//alert("video_func:" + localStorage.getItem("video_func")+" type:" +typeof(localStorage.getItem("video_func")));
|
//alert("video_func:" + localStorage.getItem("video_func")+" type:" +typeof(localStorage.getItem("video_func")));
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ const getMyUserInfo = async (id) => {
|
||||||
permiss.defaultList[result["data"]["Role"] == "admin" ? "admin" : "user"];
|
permiss.defaultList[result["data"]["Role"] == "admin" ? "admin" : "user"];
|
||||||
permiss.handleSet(keys);
|
permiss.handleSet(keys);
|
||||||
localStorage.setItem("ms_keys", JSON.stringify(keys));
|
localStorage.setItem("ms_keys", JSON.stringify(keys));
|
||||||
|
localStorage.setItem("ms_role", result["data"]["Role"]);
|
||||||
router.push("/");
|
router.push("/");
|
||||||
|
|
||||||
//alert("video_func:" + localStorage.getItem("video_func")+" type:" +typeof(localStorage.getItem("video_func")));
|
//alert("video_func:" + localStorage.getItem("video_func")+" type:" +typeof(localStorage.getItem("video_func")));
|
||||||
|
|
|
||||||
|
|
@ -100,18 +100,75 @@
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
>发送</el-button
|
>发送</el-button
|
||||||
>
|
>
|
||||||
<div>
|
<el-dropdown trigger="click" class="model-dropdown">
|
||||||
<p>模型参数</p>
|
<span class="el-dropdown-link">
|
||||||
<el-slider v-model="temperature" :min="0" :max="1" :step="0.1"
|
<span>模型参数</span>
|
||||||
>temperature</el-slider
|
<el-icon><ArrowDown /></el-icon>
|
||||||
>
|
</span>
|
||||||
<el-slider
|
<template #dropdown>
|
||||||
v-model="topP"
|
<div class="dropdown-content">
|
||||||
:min="0"
|
<div class="model-params">
|
||||||
:max="1"
|
<h4>模型参数
|
||||||
:step="0.1"
|
<el-tooltip
|
||||||
></el-slider>
|
effect="dark"
|
||||||
</div>
|
placement="right"
|
||||||
|
content="建议仅调整 temperature 或 top_p 其中之一,不建议两者都修改"
|
||||||
|
>
|
||||||
|
<el-icon class="tip-icon"><QuestionFilled /></el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<!-- 温度参数 -->
|
||||||
|
<div class="param-item">
|
||||||
|
<div class="param-label">
|
||||||
|
<span>温度 (Temperature)</span>
|
||||||
|
<el-tooltip
|
||||||
|
effect="dark"
|
||||||
|
placement="right"
|
||||||
|
content="采样温度,控制生成随机性(0: 保守,2: 随机)"
|
||||||
|
>
|
||||||
|
<el-icon class="tip-icon"><QuestionFilled /></el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
<el-slider
|
||||||
|
v-model="temperature"
|
||||||
|
:min="0"
|
||||||
|
:max="2"
|
||||||
|
:step="0.1"
|
||||||
|
:show-tooltip="false"
|
||||||
|
/>
|
||||||
|
<div class="param-value">{{ temperature.toFixed(1) }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Top P 参数 -->
|
||||||
|
<div class="param-item">
|
||||||
|
<div class="param-label">
|
||||||
|
<span>Top P</span>
|
||||||
|
<el-tooltip
|
||||||
|
effect="dark"
|
||||||
|
placement="right"
|
||||||
|
content="限制候选词范围(0: 严格,1: 宽松)"
|
||||||
|
>
|
||||||
|
<el-icon class="tip-icon"><QuestionFilled /></el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
<el-slider
|
||||||
|
v-model="topP"
|
||||||
|
:min="0"
|
||||||
|
:max="1"
|
||||||
|
:step="0.1"
|
||||||
|
:show-tooltip="false"
|
||||||
|
/>
|
||||||
|
<div class="param-value">{{ topP.toFixed(1) }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="3" style="text-align: center">
|
<el-col :span="3" style="text-align: center">
|
||||||
<el-select v-model="selectModel" placeholder="选择模型">
|
<el-select v-model="selectModel" placeholder="选择模型">
|
||||||
|
|
@ -286,7 +343,7 @@ const sessionIsShow = ref(false);
|
||||||
const sessionName = ref("");
|
const sessionName = ref("");
|
||||||
const ModelList = ref<Model[]>([]);
|
const ModelList = ref<Model[]>([]);
|
||||||
const selectModel = ref(0);
|
const selectModel = ref(0);
|
||||||
const temperature = ref(0.5);
|
const temperature = ref(0.8);
|
||||||
const topP = ref(0.9);
|
const topP = ref(0.9);
|
||||||
const selectedFiles = ref<File[]>([]); // 用于存储已选文件
|
const selectedFiles = ref<File[]>([]); // 用于存储已选文件
|
||||||
const selectFileVisible = ref(false); // 控制文件选择对话框的显示与隐藏
|
const selectFileVisible = ref(false); // 控制文件选择对话框的显示与隐藏
|
||||||
|
|
@ -1000,4 +1057,55 @@ const getFileListData = async () => {
|
||||||
.el-icon-document {
|
.el-icon-document {
|
||||||
color: #409eff;
|
color: #409eff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.model-dropdown {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-content {
|
||||||
|
width: 400px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.model-params {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
.param-value {
|
||||||
|
margin-top: 5px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-item {
|
||||||
|
margin: 25px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tip-icon {
|
||||||
|
margin-left: 8px;
|
||||||
|
color: #909399;
|
||||||
|
cursor: help;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-value {
|
||||||
|
margin-top: 8px;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 自定义滑块样式 */
|
||||||
|
:deep(.el-slider__runway) {
|
||||||
|
height: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-slider__button) {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,60 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="model-params">
|
<div class="model-params">
|
||||||
<h4>模型参数</h4>
|
<h4>模型参数
|
||||||
<el-slider v-model="temperature" :min="0" :max="1" :step="0.1"></el-slider>
|
<el-tooltip
|
||||||
<div class="param-value">{{ temperature }}</div>
|
effect="dark"
|
||||||
<el-slider v-model="topP" :min="0" :max="1" :step="0.1"></el-slider>
|
placement="right"
|
||||||
<div class="param-value">{{ topP }}</div>
|
content="建议仅调整 temperature 或 top_p 其中之一,不建议两者都修改"
|
||||||
</div>
|
>
|
||||||
|
<el-icon class="tip-icon"><QuestionFilled /></el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<!-- 温度参数 -->
|
||||||
|
<div class="param-item">
|
||||||
|
<div class="param-label">
|
||||||
|
<span>温度 (Temperature)</span>
|
||||||
|
<el-tooltip
|
||||||
|
effect="dark"
|
||||||
|
placement="right"
|
||||||
|
content="采样温度,控制生成随机性(0: 保守,2: 随机)"
|
||||||
|
>
|
||||||
|
<el-icon class="tip-icon"><QuestionFilled /></el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
<el-slider
|
||||||
|
v-model="temperature"
|
||||||
|
:min="0"
|
||||||
|
:max="2"
|
||||||
|
:step="0.1"
|
||||||
|
:show-tooltip="false"
|
||||||
|
/>
|
||||||
|
<div class="param-value">{{ temperature.toFixed(1) }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Top P 参数 -->
|
||||||
|
<div class="param-item">
|
||||||
|
<div class="param-label">
|
||||||
|
<span>Top P</span>
|
||||||
|
<el-tooltip
|
||||||
|
effect="dark"
|
||||||
|
placement="right"
|
||||||
|
content="限制候选词范围(0: 严格,1: 宽松)"
|
||||||
|
>
|
||||||
|
<el-icon class="tip-icon"><QuestionFilled /></el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
<el-slider
|
||||||
|
v-model="topP"
|
||||||
|
:min="0"
|
||||||
|
:max="1"
|
||||||
|
:step="0.1"
|
||||||
|
:show-tooltip="false"
|
||||||
|
/>
|
||||||
|
<div class="param-value">{{ topP.toFixed(1) }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|
@ -375,8 +423,35 @@ onUnmounted(() => {
|
||||||
.model-params {
|
.model-params {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.param-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tip-icon {
|
||||||
|
margin-left: 8px;
|
||||||
|
color: #909399;
|
||||||
|
cursor: help;
|
||||||
|
}
|
||||||
|
|
||||||
.param-value {
|
.param-value {
|
||||||
margin-top: 5px;
|
margin-top: 8px;
|
||||||
text-align: right;
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 自定义滑块样式 */
|
||||||
|
:deep(.el-slider__runway) {
|
||||||
|
height: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-slider__button) {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue