You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.1 KiB
63 lines
2.1 KiB
import type { AlertType, CargoType } from "@/lib/frontend/types";
|
|
import { QUOTE_TIMEOUT_MS } from "@/lib/constants/quote";
|
|
|
|
export const CARGO_TYPE_OPTIONS: { value: CargoType; label: string }[] = [
|
|
{ value: "general_freight", label: "普通货物" },
|
|
{ value: "machinery", label: "机械设备" },
|
|
{ value: "furniture", label: "家具" },
|
|
{ value: "electronics", label: "电子产品" },
|
|
{ value: "building_materials", label: "建材" },
|
|
{ value: "auto_parts", label: "汽车配件" },
|
|
{ value: "food_nonperishable", label: "非生鲜食品" },
|
|
{ value: "apparel", label: "服装" },
|
|
{ value: "other", label: "其他" },
|
|
];
|
|
|
|
export { US_STATES } from "@/lib/frontend/us-states";
|
|
|
|
export const ALERT_TYPE_LABEL: Record<AlertType, string> = {
|
|
PRICE_DEVIATION: "价格偏差",
|
|
STALE_FALLBACK: "降级使用旧报价",
|
|
RPA_FAILED: "RPA 抓取失败",
|
|
RPA_CAPTCHA: "RPA 触发验证码",
|
|
STRUCT_CHANGE: "页面结构变更",
|
|
SESSION_EXPIRED: "会话过期",
|
|
SECURITY: "安全事件",
|
|
MANUAL_FALLBACK: "人工兜底",
|
|
};
|
|
|
|
export const ALERT_TYPE_TONE: Record<
|
|
AlertType,
|
|
"warning" | "error" | "neutral"
|
|
> = {
|
|
PRICE_DEVIATION: "warning",
|
|
STALE_FALLBACK: "warning",
|
|
RPA_FAILED: "error",
|
|
RPA_CAPTCHA: "error",
|
|
STRUCT_CHANGE: "error",
|
|
SESSION_EXPIRED: "error",
|
|
SECURITY: "error",
|
|
MANUAL_FALLBACK: "warning",
|
|
};
|
|
|
|
export const POLL_INTERVAL_MS = 2_000;
|
|
/** 与后端 QUOTE_TIMEOUT_MS 对齐,避免 RPA 未完成前端先报超时 */
|
|
export const POLL_TIMEOUT_MS = QUOTE_TIMEOUT_MS;
|
|
/** 由超时窗口推导,供展示/测试参考 */
|
|
export const POLL_MAX_ATTEMPTS = Math.ceil(
|
|
POLL_TIMEOUT_MS / POLL_INTERVAL_MS,
|
|
);
|
|
export const SUBMIT_LOCK_MS = 3_000;
|
|
/** 地址候选 API 前端等待上限(毫秒):与后端 ADDRESS_CANDIDATES_TIMEOUT_MS 对齐 */
|
|
export const CANDIDATES_FETCH_TIMEOUT_MS = 300_000;
|
|
|
|
export const METRICS_THRESHOLDS = {
|
|
api_success_rate: 99,
|
|
rpa_success_rate: 95,
|
|
realtime_rate: 90,
|
|
cache_hit_rate: 30,
|
|
} as const;
|
|
|
|
export const AUTH_TOKEN_KEY = "chajia_admin_token";
|
|
export const AUTH_USER_KEY = "chajia_admin_user";
|