mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-17 16:56:38 +08:00
feat: system notice function is ready
This commit is contained in:
parent
0140713e86
commit
479f94c372
@ -6,6 +6,7 @@
|
|||||||
* 功能新增:后台新增配置微信客服二维码,可以上传自己的微信客服二维码
|
* 功能新增:后台新增配置微信客服二维码,可以上传自己的微信客服二维码
|
||||||
* 功能新增:新增网站公告,可以在管理后台自定义配置
|
* 功能新增:新增网站公告,可以在管理后台自定义配置
|
||||||
* 功能新增:新增阿里通义千问大模型支持
|
* 功能新增:新增阿里通义千问大模型支持
|
||||||
|
* Bug修复:修复 MJ 放大任务失败时候 img_call 会增加的 Bug
|
||||||
|
|
||||||
|
|
||||||
## v3.2.5
|
## v3.2.5
|
||||||
|
@ -33,8 +33,9 @@ func (h *ConfigHandler) Update(c *gin.Context) {
|
|||||||
resp.ERROR(c, types.InvalidArgs)
|
resp.ERROR(c, types.InvalidArgs)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
str := utils.JsonEncode(&data.Config)
|
|
||||||
config := model.Config{Key: data.Key, Config: str}
|
value := utils.JsonEncode(&data.Config)
|
||||||
|
config := model.Config{Key: data.Key, Config: value}
|
||||||
res := h.db.FirstOrCreate(&config, model.Config{Key: data.Key})
|
res := h.db.FirstOrCreate(&config, model.Config{Key: data.Key})
|
||||||
if res.Error != nil {
|
if res.Error != nil {
|
||||||
resp.ERROR(c, res.Error.Error())
|
resp.ERROR(c, res.Error.Error())
|
||||||
@ -42,7 +43,7 @@ func (h *ConfigHandler) Update(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if config.Id > 0 {
|
if config.Id > 0 {
|
||||||
config.Config = str
|
config.Config = value
|
||||||
res := h.db.Updates(&config)
|
res := h.db.Updates(&config)
|
||||||
if res.Error != nil {
|
if res.Error != nil {
|
||||||
resp.ERROR(c, res.Error.Error())
|
resp.ERROR(c, res.Error.Error())
|
||||||
|
@ -227,37 +227,14 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="showDemoNotice"
|
v-model="showNotice"
|
||||||
:show-close="true"
|
:show-close="true"
|
||||||
|
custom-class="notice-dialog"
|
||||||
title="网站公告"
|
title="网站公告"
|
||||||
>
|
>
|
||||||
<div class="notice">
|
<div class="notice">
|
||||||
<el-text type="primary">
|
<el-text type="primary">
|
||||||
注意:当前站点仅为开源项目
|
<div v-html="notice"></div>
|
||||||
<a style="color: #F56C6C" href="https://github.com/yangjian102621/chatgpt-plus" target="_blank">ChatPlus</a>
|
|
||||||
的演示项目,本项目单纯就是给大家体验项目功能使用。<br/>
|
|
||||||
|
|
||||||
体验额度用完之后请不要在当前站点进行任何充值操作!!!<br/>
|
|
||||||
体验额度用完之后请不要在当前站点进行任何充值操作!!!<br/>
|
|
||||||
体验额度用完之后请不要在当前站点进行任何充值操作!!!<br/>
|
|
||||||
|
|
||||||
如果觉得好用你就花几分钟自己部署一套,没有API KEY 的同学可以去
|
|
||||||
<a href="https://gpt.bemore.lol" target="_blank"
|
|
||||||
style="font-size: 20px;color:#F56C6C">https://gpt.bemore.lol</a>
|
|
||||||
购买,现在有超级优惠,价格远低于 OpenAI 官方。<br/>
|
|
||||||
GPT-3.5,GPT-4,DALL-E3 绘图......你都可以随意使用,无需魔法。<br/>
|
|
||||||
|
|
||||||
MidJourney API 购买地址:
|
|
||||||
<a href="https://api.chat-plus.net" target="_blank"
|
|
||||||
style="font-size: 20px;color:#F56C6C">https://api.chat-plus.net</a><br/>
|
|
||||||
|
|
||||||
接入教程: <a href="https://ai.r9it.com/docs/install/" target="_blank"
|
|
||||||
style="font-size: 20px;color:#F56C6C">https://ai.r9it.com/docs/install/</a><br/>
|
|
||||||
|
|
||||||
本项目源码地址:
|
|
||||||
<a href="https://github.com/yangjian102621/chatgpt-plus" target="_blank">
|
|
||||||
https://github.com/yangjian102621/chatgpt-plus
|
|
||||||
</a>
|
|
||||||
</el-text>
|
</el-text>
|
||||||
|
|
||||||
<p style="text-align: right">
|
<p style="text-align: right">
|
||||||
@ -323,8 +300,9 @@ const isLogin = ref(false)
|
|||||||
const showHello = ref(true)
|
const showHello = ref(true)
|
||||||
const textInput = ref(null)
|
const textInput = ref(null)
|
||||||
const showFeedbackDialog = ref(false)
|
const showFeedbackDialog = ref(false)
|
||||||
const showDemoNotice = ref(false)
|
const showNotice = ref(false)
|
||||||
const showNoticeKey = ref("SHOW_DEMO_NOTICE_")
|
const notice = ref("")
|
||||||
|
const noticeKey = ref("SYSTEM_NOTICE")
|
||||||
const wechatCardURL = ref("/images/wx.png")
|
const wechatCardURL = ref("/images/wx.png")
|
||||||
|
|
||||||
if (isMobile()) {
|
if (isMobile()) {
|
||||||
@ -372,16 +350,25 @@ onMounted(() => {
|
|||||||
ElMessage.error("加载会话列表失败!")
|
ElMessage.error("加载会话列表失败!")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 获取系统配置
|
||||||
httpGet("/api/admin/config/get?key=system").then(res => {
|
httpGet("/api/admin/config/get?key=system").then(res => {
|
||||||
title.value = res.data.title
|
title.value = res.data.title
|
||||||
const show = localStorage.getItem(showNoticeKey.value + loginUser.value.username)
|
|
||||||
if (!show) {
|
|
||||||
showDemoNotice.value = res.data['show_demo_notice']
|
|
||||||
}
|
|
||||||
wechatCardURL.value = res.data['wechat_card_url']
|
wechatCardURL.value = res.data['wechat_card_url']
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
ElMessage.error("获取系统配置失败:" + e.message)
|
ElMessage.error("获取系统配置失败:" + e.message)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 获取系统公告
|
||||||
|
httpGet("/api/admin/config/get?key=notice").then(res => {
|
||||||
|
notice.value = md.render(res.data['content'])
|
||||||
|
const oldNotice = localStorage.getItem(noticeKey.value);
|
||||||
|
// 如果公告有更新,则显示公告
|
||||||
|
if (oldNotice !== notice.value) {
|
||||||
|
showNotice.value = true
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
ElMessage.error("获取系统配置失败:" + e.message)
|
||||||
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
router.push('/login')
|
router.push('/login')
|
||||||
});
|
});
|
||||||
@ -900,8 +887,8 @@ const getModelValue = (model_id) => {
|
|||||||
|
|
||||||
|
|
||||||
const notShow = () => {
|
const notShow = () => {
|
||||||
localStorage.setItem(showNoticeKey.value + loginUser.value.username, true)
|
localStorage.setItem(noticeKey.value, notice.value)
|
||||||
showDemoNotice.value = false
|
showNotice.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 插入文件路径
|
// 插入文件路径
|
||||||
@ -913,3 +900,11 @@ const insertURL = (url) => {
|
|||||||
<style scoped lang="stylus">
|
<style scoped lang="stylus">
|
||||||
@import "@/assets/css/chat-plus.styl"
|
@import "@/assets/css/chat-plus.styl"
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style lang="stylus">
|
||||||
|
.notice-dialog {
|
||||||
|
.el-dialog__body {
|
||||||
|
padding 0 20px
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -261,6 +261,9 @@
|
|||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="公告配置" name="notice">
|
<el-tab-pane label="公告配置" name="notice">
|
||||||
<md-editor class="mgb20" v-model="notice" @on-upload-img="onUploadImg"/>
|
<md-editor class="mgb20" v-model="notice" @on-upload-img="onUploadImg"/>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="save('notice')">保存</el-button>
|
||||||
|
</el-form-item>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
@ -305,13 +308,20 @@ onMounted(() => {
|
|||||||
// 加载聊天配置
|
// 加载聊天配置
|
||||||
httpGet('/api/admin/config/get?key=chat').then(res => {
|
httpGet('/api/admin/config/get?key=chat').then(res => {
|
||||||
chat.value = res.data
|
chat.value = res.data
|
||||||
loading.value = false
|
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
ElMessage.error("加载聊天配置失败: " + e.message)
|
ElMessage.error("加载聊天配置失败: " + e.message)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 加载聊天配置
|
||||||
|
httpGet('/api/admin/config/get?key=notice').then(res => {
|
||||||
|
notice.value = res.data['content']
|
||||||
|
}).catch(e => {
|
||||||
|
ElMessage.error("公告信息失败: " + e.message)
|
||||||
|
})
|
||||||
|
|
||||||
httpGet('/api/admin/model/list').then(res => {
|
httpGet('/api/admin/model/list').then(res => {
|
||||||
models.value = res.data
|
models.value = res.data
|
||||||
|
loading.value = false
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
ElMessage.error("获取模型失败:" + e.message)
|
ElMessage.error("获取模型失败:" + e.message)
|
||||||
})
|
})
|
||||||
@ -350,6 +360,12 @@ const save = function (key) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else if (key === 'notice') {
|
||||||
|
httpPost('/api/admin/config/update', {key: key, config: {content: notice.value, updated: true}}).then(() => {
|
||||||
|
ElMessage.success("操作成功!")
|
||||||
|
}).catch(e => {
|
||||||
|
ElMessage.error("操作失败:" + e.message)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user