update
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
2025-12-25 15:10:44 +08:00
parent 869a1424dd
commit b6ad29891b
2 changed files with 25 additions and 13 deletions

View File

@@ -6,9 +6,21 @@
</div> </div>
</template> </template>
<n-spin :show="aiStore.loading.ai" :delay="50"> <n-spin :show="aiStore.loading.ai" :delay="50">
<div class="container"> <n-flex align="center" justify="center" class="container">
<MdPreview :model-value="aiStore.mdContent" /> <n-button
</div> 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" />
</n-flex>
</n-spin> </n-spin>
</n-card> </n-card>
</template> </template>
@@ -16,17 +28,16 @@
import { useAIStore } from "oj/store/ai" import { useAIStore } from "oj/store/ai"
import { MdPreview } from "md-editor-v3" import { MdPreview } from "md-editor-v3"
import "md-editor-v3/lib/preview.css" import "md-editor-v3/lib/preview.css"
import { Icon } from "@iconify/vue"
const aiStore = useAIStore() const aiStore = useAIStore()
watch(
() => aiStore.loading.fetching, async function handleAnalyze() {
(isLoading) => { if (aiStore.loading.fetching || aiStore.loading.ai) {
if (!isLoading) { return
aiStore.fetchAIAnalysis()
} }
}, await aiStore.fetchAIAnalysis()
{ immediate: true }, }
)
</script> </script>
<style scoped> <style scoped>
.cool-title { .cool-title {
@@ -63,6 +74,7 @@ watch(
.container { .container {
min-height: 200px; min-height: 200px;
} }
:deep(.md-editor-preview h1) { :deep(.md-editor-preview h1) {
margin-top: 0; margin-top: 0;
} }

View File

@@ -173,7 +173,7 @@ const options: Array<DropdownOption | DropdownDividerOption> = [
{ {
label: "智能分析", label: "智能分析",
key: "ai-analysis", key: "ai-analysis",
icon: renderIcon("meteor-icons:openai"), icon: renderIcon("vscode-icons:file-type-gemini"),
props: { props: {
onClick: () => router.push("/ai-analysis"), onClick: () => router.push("/ai-analysis"),
}, },