feat(assets): add DeepSeek assistant with streaming results and voice input

This commit is contained in:
shishengliang
2026-09-23 14:16:36 +08:00
parent 822aabf2ca
commit 0c4a9bcd05
14 changed files with 3355 additions and 3 deletions
+88
View File
@@ -0,0 +1,88 @@
export const GROUPS = [
"region",
"city",
"type",
"model",
"department",
"status",
"none",
] as const;
export const CATEGORIES = [
"all",
"inventory",
"available",
"awaiting",
"operating",
"pending",
"abnormal",
] as const;
export type QueryPlan = {
kind: "assets" | "flow" | "clarify";
category: (typeof CATEGORIES)[number];
groupBy: (typeof GROUPS)[number];
view: "chart" | "table" | "list";
filters: Partial<
Record<"region" | "city" | "type" | "model" | "department", string>
>;
start?: string;
end?: string;
clarification?: string;
};
export type AssistantRow = {
id: string;
plate: string;
type: string;
model: string;
region: string;
city: string;
department: string;
status: string;
date?: string;
event?: string;
};
export type AssistantGroup = {
name: string;
count: number;
operating: number;
rate: number;
};
export type AssistantResult = {
plan: QueryPlan;
title: string;
summary: string;
source: string;
fetchedAt: string;
groups: AssistantGroup[];
rows: AssistantRow[];
metrics: { label: string; value: number; unit: string }[];
daily?: {
date: string;
delivered: number;
returned: number;
replaced: number;
total: number;
}[];
warning?: string;
};
export type AssistantEvent =
| { type: "step"; label: string }
| { type: "result"; result: AssistantResult }
| { type: "error"; message: string };
export const GROUP_LABELS: Record<QueryPlan["groupBy"], string> = {
region: "区域",
city: "城市",
type: "车型",
model: "型号",
department: "部门",
status: "运营状态",
none: "全部",
};
export const CATEGORY_LABELS: Record<QueryPlan["category"], string> = {
all: "全部资产",
inventory: "库存车辆",
available: "可运营库存",
awaiting: "待运营库存",
operating: "运营车辆",
pending: "待交车车辆",
abnormal: "异动车辆",
};