From 91e2fe47a57cd39b612d54177b548e4ec3432783 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 17 Aug 2026 14:50:48 +0800
Subject: [PATCH] feat:语义分割demo处理
---
apps/workbench-console/src/stores/artifacts.ts | 44 +++++++++++++++++++++++++++++++++++++++-----
1 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/apps/workbench-console/src/stores/artifacts.ts b/apps/workbench-console/src/stores/artifacts.ts
index 2f662a7..a0cf239 100644
--- a/apps/workbench-console/src/stores/artifacts.ts
+++ b/apps/workbench-console/src/stores/artifacts.ts
@@ -1,15 +1,49 @@
import { defineStore } from "pinia";
-import { loadDetectionArtifacts, loadTrajectoryArtifacts, type DetectionCase, type TrajectoryCase } from "@/api/artifacts";
-interface ArtifactState { detectionCases: Record<string, DetectionCase>; trajectoryCases: Record<string, TrajectoryCase>; loading: boolean; error: string | null; }
+import {
+ loadDetectionArtifacts,
+ loadSemanticArtifacts,
+ loadTrajectoryArtifacts,
+ type DetectionCase,
+ type SemanticCase,
+ type TrajectoryCase
+} from "@/api/artifacts";
+
+interface ArtifactState {
+ detectionCases: Record<string, DetectionCase>;
+ trajectoryCases: Record<string, TrajectoryCase>;
+ semanticCases: Record<string, SemanticCase>;
+ loading: boolean;
+ error: string | null;
+}
+
export const useArtifactStore = defineStore("artifacts", {
getters: {
detectionRun: (state) => Object.values(state.detectionCases)[0]?.run ?? null,
detectionImages: (state) => Object.values(state.detectionCases)[0]?.images ?? []
},
- state: (): ArtifactState => ({ detectionCases: {}, trajectoryCases: {}, loading: false, error: null }),
+ state: (): ArtifactState => ({ detectionCases: {}, trajectoryCases: {}, semanticCases: {}, loading: false, error: null }),
actions: {
- async loadDetection(force = false) { if (!force && Object.keys(this.detectionCases).length) return; this.loading = true; this.error = null; try { this.detectionCases = await loadDetectionArtifacts(); } catch (error) { this.error = error instanceof Error ? error.message : "目标检测结果读取失败"; } finally { this.loading = false; } },
- async loadTrajectory(force = false) { if (!force && Object.keys(this.trajectoryCases).length) return; this.loading = true; this.error = null; try { this.trajectoryCases = await loadTrajectoryArtifacts(); } catch (error) { this.error = error instanceof Error ? error.message : "轨迹分析结果读取失败"; } finally { this.loading = false; } }
+ async loadDetection(force = false) {
+ if (!force && Object.keys(this.detectionCases).length) return;
+ this.loading = true; this.error = null;
+ try { this.detectionCases = await loadDetectionArtifacts(); }
+ catch (error) { this.error = error instanceof Error ? error.message : "目标检测结果读取失败"; }
+ finally { this.loading = false; }
+ },
+ async loadTrajectory(force = false) {
+ if (!force && Object.keys(this.trajectoryCases).length) return;
+ this.loading = true; this.error = null;
+ try { this.trajectoryCases = await loadTrajectoryArtifacts(); }
+ catch (error) { this.error = error instanceof Error ? error.message : "轨迹分析结果读取失败"; }
+ finally { this.loading = false; }
+ },
+ async loadSemantic(force = false) {
+ if (!force && Object.keys(this.semanticCases).length) return;
+ this.loading = true; this.error = null;
+ try { this.semanticCases = await loadSemanticArtifacts(); }
+ catch (error) { this.error = error instanceof Error ? error.message : "语义分割结果读取失败"; }
+ finally { this.loading = false; }
+ }
}
});
--
Gitblit v1.9.3