优化版权显示逻辑,允许激活用户更改自定义版权

This commit is contained in:
RockYang
2024-07-15 18:44:14 +08:00
parent 0df700ec18
commit f22c6bf658
14 changed files with 83 additions and 52 deletions

View File

@@ -11,7 +11,7 @@
<div class="title">{{ title }}</div>
</div>
<div class="menu-item">
<span v-if="!licenseConfig.de_copy">
<span v-if="!license.de_copy">
<a :href="docsURL" target="_blank">
<el-button type="primary" round>
<i class="iconfont icon-book"></i>
@@ -57,9 +57,7 @@
<!-- <div id="animation-container"></div>-->
</div>
<div class="footer" v-if="!licenseConfig.de_copy">
<footer-bar />
</div>
<footer-bar />
</div>
</template>
@@ -82,7 +80,7 @@ if (isMobile()) {
const title = ref("Geek-AI 创作系统")
const logo = ref("/images/logo.png")
const slogan = ref("我辈之人,先干为敬,陪您先把 AI 用起来")
const licenseConfig = ref({})
const license = ref({})
const winHeight = window.innerHeight - 150
const bgImgUrl = ref('')
const isLogin = ref(false)
@@ -106,7 +104,7 @@ onMounted(() => {
})
httpGet("/api/config/license").then(res => {
licenseConfig.value = res.data
license.value = res.data
}).catch(e => {
ElMessage.error("获取 License 配置:" + e.message)
})

View File

@@ -55,10 +55,8 @@
</div>
<reset-pass @hide="showResetPass = false" :show="showResetPass"/>
<footer class="footer" v-if="!licenseConfig.de_copy">
<footer-bar/>
</footer>
<footer-bar/>
</div>
</div>
</template>

View File

@@ -106,19 +106,10 @@ import {useSharedStore} from "@/store/sharedata";
const leftBoxHeight = ref(window.innerHeight - 105)
const rightBoxHeight = ref(window.innerHeight - 115)
const title = ref("")
const prompt = ref("")
const text = ref(`# Geek-AI 助手
- 完整的开源系统,前端应用和后台管理系统皆可开箱即用。
- 基于 Websocket 实现,完美的打字机体验。
- 内置了各种预训练好的角色应用,轻松满足你的各种聊天和应用需求。
- 支持 OPenAIAzure文心一言讯飞星火清华 ChatGLM等多个大语言模型。
- 支持 MidJourney / Stable Diffusion AI 绘画集成,开箱即用。
- 支持使用个人微信二维码作为充值收费的支付渠道,无需企业支付通道。
- 已集成支付宝支付功能,微信支付,支持多种会员套餐和点卡购买功能。
- 集成插件 API 功能,可结合大语言模型的 function 功能开发各种强大的插件。
`)
const text = ref("")
const md = require('markdown-it')({breaks: true});
const content = ref(text.value)
const html = ref("")
@@ -135,7 +126,20 @@ const models = ref([])
const modelID = ref(0)
const loading = ref(false)
onMounted(() => {
httpGet("/api/config/get?key=system").then(res => {
title.value = res.data.title??process.env.VUE_APP_TITLE
text.value = `# ${title.value}
- 完整的开源系统,前端应用和后台管理系统皆可开箱即用。
- 基于 Websocket 实现,完美的打字机体验。
- 内置了各种预训练好的角色应用,轻松满足你的各种聊天和应用需求。
- 支持 OPenAIAzure文心一言讯飞星火清华 ChatGLM等多个大语言模型。
- 支持 MidJourney / Stable Diffusion AI 绘画集成,开箱即用。
- 支持使用个人微信二维码作为充值收费的支付渠道,无需企业支付通道。
- 已集成支付宝支付功能,微信支付,支持多种会员套餐和点卡购买功能。
- 集成插件 API 功能,可结合大语言模型的 function 功能开发各种强大的插件。
`
content.value = text.value
initData()
try {
markMap.value = Markmap.create(svgRef.value)
@@ -145,7 +149,9 @@ onMounted(() => {
} catch (e) {
console.error(e)
}
});
}).catch(e => {
ElMessage.error("获取系统配置失败:" + e.message)
})
const initData = () => {
httpGet("/api/model/list").then(res => {

View File

@@ -53,6 +53,10 @@
</div>
</el-form-item>
<el-form-item label="版权信息" prop="copyright">
<el-input v-model="system['copyright']" placeholder="更改此选项需要获取 License 授权"/>
</el-form-item>
<el-form-item label="开放注册" prop="enabled_register">
<div class="tip-input">
<el-switch v-model="system['enabled_register']"/>
@@ -391,11 +395,12 @@ import {InfoFilled, UploadFilled,Select,CloseBold} from "@element-plus/icons-vue
import MdEditor from "md-editor-v3";
import 'md-editor-v3/lib/style.css';
import Menu from "@/views/admin/Menu.vue";
import {dateFormat} from "@/utils/libs";
import {copyObj, dateFormat} from "@/utils/libs";
import AIDrawing from "@/views/admin/AIDrawing.vue";
const activeName = ref('basic')
const system = ref({models: []})
const configBak = ref({})
const loading = ref(true)
const systemFormRef = ref(null)
const models = ref([])
@@ -407,6 +412,7 @@ onMounted(() => {
// 加载系统配置
httpGet('/api/admin/config/get?key=system').then(res => {
system.value = res.data
configBak.value = copyObj(system.value)
}).catch(e => {
ElMessage.error("加载系统配置失败: " + e.message)
})
@@ -447,7 +453,7 @@ const save = function (key) {
systemFormRef.value.validate((valid) => {
if (valid) {
system.value['power_price'] = parseFloat(system.value['power_price']) ?? 0
httpPost('/api/admin/config/update', {key: key, config: system.value}).then(() => {
httpPost('/api/admin/config/update', {key: key, config: system.value, config_bak: configBak.value}).then(() => {
ElMessage.success("操作成功!")
}).catch(e => {
ElMessage.error("操作失败:" + e.message)