Merge branch 'main' of github.com:1Panel-dev/MaxKB into main

This commit is contained in:
zhangshaohu 2024-03-20 15:56:31 +08:00
commit 7933b15a38
8 changed files with 185 additions and 8 deletions

View File

@ -14,12 +14,12 @@ on:
type: choice
options:
- linux/amd64
- linux/arm64
- linux/amd64,linux/arm64
#- linux/arm64
#- linux/amd64,linux/arm64
registry:
description: 'Push To Registry'
required: true
default: 'dockerhub, fit2cloud-registry'
default: 'dockerhub'
type: choice
options:
- dockerhub

View File

@ -35,6 +35,9 @@ docker run -d --name=maxkb -p 8080:8080 -v ~/.maxkb:/var/lib/postgresql/data 1pa
</tr>
</table>
## 在线文档
[在线文档](https://github.com/1Panel-dev/MaxKB/wiki/1-%E5%AE%89%E8%A3%85%E9%83%A8%E7%BD%B2)
## 社区交流
[论坛](https://bbs.fit2cloud.com/c/mk/11)

View File

@ -29,7 +29,6 @@ RUN mv /opt/maxkb/app/model/* /opt/maxkb/model && \
pip3 cache purge && \
rm -rf /var/lib/apt/lists/*
# 启动命令
VOLUME /opt/maxkb/conf
EXPOSE 8080
COPY installer/run-maxkb.sh /usr/bin/
RUN chmod 755 /usr/bin/run-maxkb.sh

View File

@ -0,0 +1,38 @@
import { Result } from '@/request/Result'
import { get, post, del, put } from '@/request/index'
import type { pageRequest } from '@/api/type/common'
import { type Ref } from 'vue'
const prefix = '/email_setting'
/**
*
*/
const getEmailSetting: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
return get(`${prefix}`, undefined, loading)
}
/**
*
*/
const postTestEmail: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
data,
loading
) => {
return post(`${prefix}`, data, undefined, loading)
}
/**
*
*/
const putEmailSetting: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
data,
loading
) => {
return put(`${prefix}`, data, undefined, loading)
}
export default {
getEmailSetting,
postTestEmail,
putEmailSetting
}

View File

@ -33,7 +33,7 @@ const settingRouter = {
meta: {
icon: 'app-team',
iconActive: 'app-team-active',
title: '团队管理',
title: '团队成员',
activeMenu: '/setting',
parentPath: '/setting',
parentName: 'setting'
@ -46,12 +46,25 @@ const settingRouter = {
meta: {
icon: 'app-template',
iconActive: 'app-template-active',
title: '模型管理',
title: '模型设置',
activeMenu: '/setting',
parentPath: '/setting',
parentName: 'setting'
},
component: () => import('@/views/template/index.vue')
},
{
path: '/email',
name: 'email',
meta: {
icon: 'Message',
title: '邮箱设置',
activeMenu: '/setting',
parentPath: '/setting',
parentName: 'setting',
permission: new Role('ADMIN')
},
component: () => import('@/views/email/index.vue')
}
]
}

View File

@ -0,0 +1,124 @@
<template>
<LayoutContainer header="邮箱设置">
<div class="email-setting main-calc-height">
<el-scrollbar>
<div class="p-24" v-loading="loading">
<el-form
ref="emailFormRef"
:rules="rules"
:model="form"
label-position="top"
require-asterisk-position="right"
>
<el-form-item label="SMTP 主机" prop="email_host">
<el-input v-model="form.email_host" placeholder="请输入 SMTP 主机" />
</el-form-item>
<el-form-item label="SMTP 端口" prop="email_port">
<el-input v-model="form.email_port" placeholder="请输入 SMTP 端口" />
</el-form-item>
<el-form-item label="SMTP 账户" prop="email_host_user">
<el-input v-model="form.email_host_user" placeholder="请输入 SMTP 账户" />
</el-form-item>
<el-form-item label="发件人邮箱" prop="from_email">
<el-input v-model="form.from_email" placeholder="请输入发件人邮箱" />
</el-form-item>
<el-form-item label="密码" prop="email_host_password">
<el-input
v-model="form.email_host_password"
placeholder="请输入发件人密码"
show-password
/>
</el-form-item>
<el-form-item>
<el-checkbox v-model="form.email_use_ssl"
>开启SSL(如果SMTP端口是465通常需要启用SSL)
</el-checkbox>
</el-form-item>
<el-form-item>
<el-checkbox v-model="form.email_use_tls"
>开启TLS(如果SMTP端口是587通常需要启用TLS)</el-checkbox
>
</el-form-item>
<el-button @click="submit(emailFormRef, 'test')" :disabled="loading">
测试连接
</el-button>
</el-form>
<div class="text-right">
<el-button @click="submit(emailFormRef)" type="primary" :disabled="loading">
保存
</el-button>
</div>
</div>
</el-scrollbar>
</div>
</LayoutContainer>
</template>
<script setup lang="ts">
import { reactive, ref, watch, onMounted } from 'vue'
import emailApi from '@/api/email-setting'
import type { FormInstance, FormRules } from 'element-plus'
import { MsgSuccess } from '@/utils/message'
const form = ref<any>({
email_host: '',
email_port: '',
email_host_user: '',
email_host_password: '',
email_use_tls: false,
email_use_ssl: false,
from_email: ''
})
const emailFormRef = ref()
const loading = ref(false)
const rules = reactive<FormRules<any>>({
email_host: [{ required: true, message: '请输入 SMTP 主机', trigger: 'blur' }],
email_port: [{ required: true, message: '请输入 SMTP 端口', trigger: 'blur' }],
email_host_user: [{ required: true, message: '请输入 SMTP 账户', trigger: 'blur' }],
email_host_password: [{ required: true, message: '请输入发件人邮箱密码', trigger: 'blur' }],
from_email: [{ required: true, message: '请输入发件人邮箱', trigger: 'blur' }]
})
const submit = async (formEl: FormInstance | undefined, test?: string) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
if (test) {
emailApi.postTestEmail(form.value, loading).then((res) => {
MsgSuccess('测试连接成功')
})
} else {
emailApi.putEmailSetting(form.value, loading).then((res) => {
MsgSuccess('设置成功')
})
}
} else {
console.log('error submit!')
}
})
}
function getDetail() {
emailApi.getEmailSetting(loading).then((res: any) => {
if (res.data && JSON.stringify(res.data) !== '{}') {
form.value = res.data
}
})
}
onMounted(() => {
getDetail()
})
</script>
<style lang="scss" scoped>
.email-setting {
width: 70%;
margin: 0 auto;
:deep(.el-checkbox__label) {
font-weight: 400;
}
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<LayoutContainer header="团队管理">
<LayoutContainer header="团队成员">
<div class="team-manage flex main-calc-height">
<div class="team-member p-8 border-r">
<div class="flex-between p-16">

View File

@ -1,5 +1,5 @@
<template>
<LayoutContainer header="模型管理">
<LayoutContainer header="模型设置">
<div class="template-manage flex main-calc-height">
<div class="template-manage__left p-8 border-r">
<h4 class="p-16" style="padding-bottom: 8px">供应商</h4>