feat: 支持文心4.0模型,不同的用户可以订阅不同的AI模型

This commit is contained in:
RockYang
2023-10-26 13:41:49 +08:00
parent 5b5150e6d4
commit 01205af018
30 changed files with 193 additions and 47 deletions

View File

@@ -87,6 +87,38 @@
</template>
</el-input>
</el-form-item>
<el-form-item label="默认AI模型" prop="default_models">
<template #default>
<div class="tip-input">
<el-select
v-model="system['default_models']"
multiple
:filterable="true"
placeholder="选择AI模型多选"
style="width: 100%"
>
<el-option
v-for="item in models"
:key="item.id"
:label="item.name"
:value="item.value"
/>
</el-select>
<div class="info">
<el-tooltip
class="box-item"
effect="dark"
content="新用户注册默认开通的 AI 模型"
placement="right"
>
<el-icon>
<InfoFilled/>
</el-icon>
</el-tooltip>
</div>
</div>
</template>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="save('system')">保存</el-button>
</el-form-item>
@@ -198,6 +230,7 @@ const chat = ref({
const loading = ref(true)
const systemFormRef = ref(null)
const chatFormRef = ref(null)
const models = ref([])
onMounted(() => {
// 加载系统配置
@@ -233,6 +266,12 @@ onMounted(() => {
ElMessage.error("加载聊天配置失败: " + e.message)
})
httpGet('/api/admin/model/list').then(res => {
models.value = res.data
}).catch(e => {
ElMessage.error("获取模型失败:" + e.message)
})
})
const rules = reactive({
@@ -293,6 +332,7 @@ const uploadRewardImg = (file) => {
</script>
<style lang="stylus" scoped>
@import "@/assets/css/admin-form.styl"
.system-config {
display flex
justify-content center