perf: 支持AI分析报错

This commit is contained in:
xiaojunnuo
2025-05-14 15:03:47 +08:00
parent abf015f485
commit aa96859798
8 changed files with 67 additions and 188 deletions
+8 -4
View File
@@ -74,8 +74,12 @@ const tokenTheme = computed(() => {
// settingStore.init();
const chatBox = ref();
onMounted(async () => {
// await util.sleep(5000);
// await chatBox.value.openChat({ q: "hello" });
});
// onMounted(async () => {
// await util.sleep(2000);
// await chatBox.value.openChat({ q: "hello" });
// });
const openChat = (q: string) => {
chatBox.value.openChat({ q });
};
provide("fn:ai.open", openChat);
</script>
@@ -24,7 +24,7 @@
</div>
<!-- 聊天按钮 -->
<div v-show="!chatVisible" class="maxkb-chat-button" :style="buttonPosition" @click="toggleChat">
<div v-show="!chatVisible" class="maxkb-chat-button" @click="toggleChat">
<img src="https://maxkb.handfree.work/ui/MaxKB.gif" />
</div>
@@ -123,7 +123,7 @@ onMounted(() => {
});
async function openChat(req: { q: string }) {
showGuide.value = true;
chatVisible.value = true;
const iframeId = "maxkb-chat";
@@ -227,10 +227,10 @@ defineExpose({
#maxkb .maxkb-tips .maxkb-button button::after {
border: none;
}
#maxkb .maxkb-tips . {
#maxkb .maxkb-tips {
position: absolute;
right: 20px;
top: 20px;
//top: 20px;
cursor: pointer;
}
#maxkb-chat-container {
@@ -248,7 +248,7 @@ defineExpose({
#maxkb .maxkb-chat-button {
position: fixed;
right: 0px;
right: 10px;
bottom: 30px;
cursor: pointer;
z-index: 10000;
@@ -21,7 +21,7 @@ async function batchUpdateGroupRequest(groupId: number) {
const pipelineGroupDictRef = dict({
url: "/pi/pipeline/group/all",
value: "id",
label: "name"
label: "name",
});
const { openCrudFormDialog } = useFormWrapper();
@@ -33,9 +33,9 @@ async function openGroupSelectDialog() {
type: "dict-select",
dict: pipelineGroupDictRef,
form: {
rules: [{ required: true, message: "请选择分组" }]
}
}
rules: [{ required: true, message: "请选择分组" }],
},
},
},
form: {
mode: "edit",
@@ -44,18 +44,18 @@ async function openGroupSelectDialog() {
await batchUpdateGroupRequest(form.groupId);
},
col: {
span: 22
span: 22,
},
labelCol: {
style: {
width: "100px"
}
width: "100px",
},
},
wrapper: {
title: "批量修改分组",
width: 600
}
}
width: 600,
},
},
} as any;
await openCrudFormDialog({ crudOptions });
}
@@ -22,6 +22,11 @@
</div>
</a-tab-pane>
</a-tabs>
<template #footer>
<fs-button key="aiChat" type="primary" icon="ion:color-wand-outline" @click="taskModal.onAiChat">AI分析</fs-button>
<fs-button key="cancel" icon="ion:close-circle-outline" @click="taskModal.onOk">关闭</fs-button>
<fs-button key="submit" icon="ion:checkmark-circle-outline" type="primary" @click="taskModal.onOk">确定</fs-button>
</template>
</a-modal>
</template>
@@ -37,11 +42,15 @@ export default {
props: {},
emits: ["run"],
setup(props: any, ctx: any) {
const openAiChat: any = inject("fn:ai.open", (q: string) => {});
const taskModal = ref({
open: false,
onOk() {
taskViewClose();
},
onAiChat() {
onAiChat();
},
cancelText: "关闭",
});
const { isMobile } = usePreferences();
@@ -52,6 +61,22 @@ export default {
return "left";
});
function onAiChat() {
debugger;
const logs = currentHistory.value?.logs[activeKey.value];
let logText = "";
for (let log of logs) {
logText += log + "\n";
}
const maxLength = 5000;
if (logText.length > maxLength) {
logText = logText.substring(logText.length - maxLength);
}
if (openAiChat) {
openAiChat(logText);
}
}
const detail = ref({ nodes: [] });
const activeKey = ref();
const currentHistory: Ref<RunHistory> | undefined = inject("currentHistory");
@@ -9,7 +9,10 @@
<a-col :span="6">
<statistic-card title="用户总数" :count="count.userCount">
<template #footer>
<router-link to="/sys/authority/user" class="flex"><fs-icon icon="ion:settings-outline" class="mr-5 fs-16" /> 管理用户</router-link>
<router-link to="/sys/authority/user" class="flex">
<fs-icon icon="ion:settings-outline" class="mr-5 fs-16" />
管理用户
</router-link>
</template>
</statistic-card>
</a-col>
@@ -21,7 +24,10 @@
<a-col :span="6">
<statistic-card title="全站流水线总数" :count="count.pipelineCount">
<template #footer>
<router-link to="/certd/pipeline" class="flex"><fs-icon icon="ion:settings-outline" class="mr-5 fs-16" /> 管理流水线</router-link>
<router-link to="/certd/pipeline" class="flex">
<fs-icon icon="ion:settings-outline" class="mr-5 fs-16" />
管理流水线
</router-link>
</template>
</statistic-card>
</a-col>
@@ -42,21 +48,23 @@
</template>
<script lang="ts" setup>
import { onMounted, ref } from "vue";
import { onMounted, ref, Ref } from "vue";
import { FsIcon } from "@fast-crud/fast-crud";
import StatisticCard from "/@/views/framework/home/dashboard/statistic-card.vue";
import DayCount from "/@/views/framework/home/dashboard/charts/day-count.vue";
import { GetStatisticCount } from "./api";
const count = ref({});
function transformCountPerDayToChartData(key) {
count.value[key] = count.value[key].map((item) => {
const count: Ref = ref({});
function transformCountPerDayToChartData(key: string) {
count.value[key] = count.value[key].map((item:any) => {
return {
name: item.date,
value: item.count
value: item.count,
};
});
}
async function loadCount() {
count.value = await GetStatisticCount();
transformCountPerDayToChartData("userRegisterCountPerDay");