add cache for getting user info and system configs

This commit is contained in:
RockYang
2024-08-08 14:37:33 +08:00
parent 167c59a159
commit 2d4959aa7d
36 changed files with 185 additions and 110 deletions

View File

@@ -94,10 +94,10 @@
</template>
<script setup>
import {nextTick, onMounted, onUnmounted, ref} from 'vue';
import {nextTick, onUnmounted, ref} from 'vue';
import {Markmap} from 'markmap-view';
import {Transformer} from 'markmap-lib';
import {checkSession} from "@/action/session";
import {checkSession, getSystemInfo} from "@/store/cache";
import {httpGet} from "@/utils/http";
import {ElMessage} from "element-plus";
import {Download} from "@element-plus/icons-vue";
@@ -126,29 +126,20 @@ const models = ref([])
const modelID = ref(0)
const loading = ref(false)
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 功能开发各种强大的插件。
`
getSystemInfo().then(res => {
text.value = res.data['mark_map_text']
content.value = text.value
initData()
try {
markMap.value = Markmap.create(svgRef.value)
const {el} = Toolbar.create(markMap.value);
document.getElementById('toolbar').append(el);
update()
} catch (e) {
console.error(e)
}
nextTick(() => {
try {
markMap.value = Markmap.create(svgRef.value)
const {el} = Toolbar.create(markMap.value);
document.getElementById('toolbar').append(el);
update()
} catch (e) {
console.error(e)
}
})
}).catch(e => {
ElMessage.error("获取系统配置失败:" + e.message)
})
@@ -184,6 +175,10 @@ const update = () => {
}
const processContent = (text) => {
if (!text) {
return text
}
const arr = []
const lines = text.split("\n")
for (let line of lines) {