feat: The 'chat_models' field of user table, holds the model IDS in place of the model values

This commit is contained in:
RockYang
2024-03-18 15:37:46 +08:00
parent 172d498618
commit c72d963f45
13 changed files with 73 additions and 76 deletions

View File

@@ -142,6 +142,7 @@
color: #fff;
}
#app .common-layout .el-main .chat-head .chat-config .el-select {
max-width: 150px;
margin-right: 10px;
}
#app .common-layout .el-main .chat-head .chat-config .role-select {

View File

@@ -181,7 +181,7 @@ $borderColor = #4676d0;
}
.el-select {
//max-width 150px;
max-width 150px;
margin-right 10px;
}
@@ -202,6 +202,7 @@ $borderColor = #4676d0;
.is-circle {
margin-left 5px
.iconfont {
margin-right 0
}

View File

@@ -82,7 +82,7 @@
<el-main v-loading="loading" element-loading-background="rgba(122, 122, 122, 0.3)">
<div class="chat-head">
<div class="chat-config">
<span class="role-select-label">聊天角色</span>
<!-- <span class="role-select-label">聊天角色</span>-->
<el-select v-model="roleId" filterable placeholder="角色" class="role-select" @change="newChat">
<el-option
v-for="item in roles"

View File

@@ -266,6 +266,7 @@ const edit = function (row) {
const save = function () {
formRef.value.validate((valid) => {
item.value.temperature = parseFloat(item.value.temperature)
if (valid) {
showDialog.value = false
httpPost('/api/admin/model/save', item.value).then((res) => {

View File

@@ -36,7 +36,14 @@
<el-form-item label="VIP每月赠送算力" prop="vip_month_power">
<el-input v-model.number="system['vip_month_power']" placeholder="VIP用户每月赠送算力"/>
</el-form-item>
<el-form-item label="每日赠送算力" prop="daily_power">
<div class="tip-input-line">
<el-input v-model.number="system['daily_power']" placeholder="默认值0"/>
<div class="tip">
如果设置0表示不赠送用户享受完免费算力额度之后就不能再发起对话了如果设置为N则系统每天将算力值小于N的用户自动补充到N注意此功能要配合XXL-JOB启用
</div>
</div>
</el-form-item>
<el-form-item label="开放注册" prop="enabled_register">
<el-switch v-model="system['enabled_register']"/>
<el-tooltip
@@ -144,7 +151,7 @@
v-for="item in models"
:key="item.id"
:label="item.name"
:value="item.value"
:value="item.id"
/>
</el-select>
<div class="info">
@@ -167,12 +174,12 @@
<el-switch v-model="system['enable_context']"/>
</el-form-item>
<el-form-item label="会话上下文深度">
<div style="width:100%">
<div class="tip-input-line">
<el-input-number v-model="system['context_deep']" :min="0" :max="10"/>
</div>
<div class="tip" style="margin-top: 10px; ">会话上下文深度在老会话中继续会话默认加载多少条聊天记录作为上下文如果设置为
0
则不加载聊天记录仅仅使用当前角色的上下文该配置参数最好设置需要为偶数否则将无法兼容百度的 API
<div class="tip">会话上下文深度在老会话中继续会话默认加载多少条聊天记录作为上下文如果设置为
0
则不加载聊天记录仅仅使用当前角色的上下文该配置参数最好设置需要为偶数否则将无法兼容百度的 API
</div>
</div>
</el-form-item>
<el-form-item>
@@ -202,17 +209,6 @@ import 'md-editor-v3/lib/style.css';
const activeName = ref('basic')
const system = ref({models: []})
const chat = ref({
open_ai: {temperature: 1, max_tokens: 1024},
azure: {temperature: 1, max_tokens: 1024},
chat_gml: {temperature: 0.95, max_tokens: 1024},
baidu: {temperature: 0.95, max_tokens: 1024},
xun_fei: {temperature: 0.5, max_tokens: 1024},
context_deep: 0,
enable_context: true,
enable_history: true,
dall_api_url: "",
})
const loading = ref(true)
const systemFormRef = ref(null)
const chatFormRef = ref(null)
@@ -226,14 +222,6 @@ onMounted(() => {
}).catch(e => {
ElMessage.error("加载系统配置失败: " + e.message)
})
// 加载聊天配置
httpGet('/api/admin/config/get?key=chat').then(res => {
chat.value = res.data
}).catch(e => {
ElMessage.error("加载聊天配置失败: " + e.message)
})
// 加载聊天配置
httpGet('/api/admin/config/get?key=notice').then(res => {
notice.value = res.data['content']
@@ -361,12 +349,6 @@ const onUploadImg = (files, callback) => {
padding-left 10px;
}
.tip {
color #c1c1c1
font-size 12px;
line-height 1.5;
}
.el-icon {
font-size 16px
margin-left 10px
@@ -378,6 +360,15 @@ const onUploadImg = (files, callback) => {
position relative
top 3px
}
.tip-input-line {
.tip {
margin-top 10px
color #c1c1c1
font-size 12px;
line-height 1.5;
}
}
}
}

View File

@@ -116,7 +116,7 @@
v-for="item in models"
:key="item.id"
:label="item.name"
:value="item.value"
:value="item.id"
/>
</el-select>
</el-form-item>
@@ -297,7 +297,6 @@ const saveUser = function () {
}
const handleSelectionChange = function (rows) {
// TODO: 批量删除操作
console.log(rows)
}