update
This commit is contained in:
@@ -7,19 +7,24 @@
|
||||
</template>
|
||||
<n-spin :show="aiStore.loading.ai" :delay="50">
|
||||
<n-flex align="center" justify="center" class="container">
|
||||
<n-button
|
||||
v-if="!aiStore.mdContent && !aiStore.loading.ai"
|
||||
type="primary"
|
||||
size="large"
|
||||
:loading="aiStore.loading.fetching"
|
||||
@click="handleAnalyze"
|
||||
>
|
||||
<template #icon>
|
||||
<Icon icon="mingcute:ai-line" />
|
||||
</template>
|
||||
开始分析
|
||||
</n-button>
|
||||
<MdPreview v-else :model-value="aiStore.mdContent" />
|
||||
<template v-if="aiStore.pinnedReport">
|
||||
<MdPreview :model-value="aiStore.pinnedReport.analysis" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<n-button
|
||||
v-if="!aiStore.mdContent && !aiStore.loading.ai"
|
||||
type="primary"
|
||||
size="large"
|
||||
:loading="aiStore.loading.fetching"
|
||||
@click="handleAnalyze"
|
||||
>
|
||||
<template #icon>
|
||||
<Icon icon="mingcute:ai-line" />
|
||||
</template>
|
||||
开始分析
|
||||
</n-button>
|
||||
<MdPreview v-else :model-value="aiStore.mdContent" />
|
||||
</template>
|
||||
</n-flex>
|
||||
</n-spin>
|
||||
</n-card>
|
||||
@@ -38,6 +43,12 @@ async function handleAnalyze() {
|
||||
}
|
||||
await aiStore.fetchAIAnalysis()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
if (!aiStore.targetUsername) {
|
||||
await aiStore.fetchPinnedReport()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
.cool-title {
|
||||
|
||||
@@ -308,6 +308,10 @@ export function getAILoginSummary() {
|
||||
return http.get("ai/login_summary")
|
||||
}
|
||||
|
||||
export function getAIPinnedReport() {
|
||||
return http.get("ai/pinned")
|
||||
}
|
||||
|
||||
// ==================== 相似题目推荐 ====================
|
||||
|
||||
export function getSimilarProblems(problemId: string) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { DetailsData, DurationData } from "utils/types"
|
||||
import { consumeJSONEventStream } from "utils/stream"
|
||||
import { getAIDetailData, getAIDurationData, getAIHeatmapData } from "../api"
|
||||
import { getAIDetailData, getAIDurationData, getAIHeatmapData, getAIPinnedReport } from "../api"
|
||||
import { getCSRFToken } from "utils/functions"
|
||||
|
||||
export const useAIStore = defineStore("ai", () => {
|
||||
@@ -27,6 +27,7 @@ export const useAIStore = defineStore("ai", () => {
|
||||
})
|
||||
|
||||
const mdContent = ref("")
|
||||
const pinnedReport = ref<{ analysis: string } | null>(null)
|
||||
|
||||
async function fetchDetailsData(start: string, end: string) {
|
||||
const res = await getAIDetailData(
|
||||
@@ -156,10 +157,16 @@ export const useAIStore = defineStore("ai", () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchPinnedReport() {
|
||||
const res = await getAIPinnedReport()
|
||||
pinnedReport.value = res.data
|
||||
}
|
||||
|
||||
return {
|
||||
fetchAnalysisData,
|
||||
fetchHeatmapData,
|
||||
fetchAIAnalysis,
|
||||
fetchPinnedReport,
|
||||
durationData,
|
||||
detailsData,
|
||||
heatmapData,
|
||||
@@ -167,5 +174,6 @@ export const useAIStore = defineStore("ai", () => {
|
||||
targetUsername,
|
||||
loading,
|
||||
mdContent,
|
||||
pinnedReport,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user