fix(frontend): stop chart svg height warnings and idle consult status 404s
This commit is contained in:
@@ -585,8 +585,8 @@ export async function fetchConsultationStatus(sessionId: string, requestId: stri
|
||||
|
||||
export async function fetchActiveConsultationStatus(signal?: AbortSignal): Promise<ConsultationStatus | null> {
|
||||
const response = await fetch("/api/consult/status", { signal, cache: "no-store" });
|
||||
if (response.status === 204 || response.status === 404) return null;
|
||||
const payload: unknown = await response.json().catch(() => null);
|
||||
if (response.status === 404) return null;
|
||||
if (!response.ok) throw new Error(payloadMessage(payload, "暂时无法恢复后台回答"));
|
||||
const status = parseConsultationStatus(payload);
|
||||
if (status.status !== "reserved") throw new Error("后台回答状态无效");
|
||||
|
||||
@@ -34,8 +34,7 @@ export function reportChartExportSvg(chart: NorthIndianChartModel, ariaLabel: st
|
||||
const rendered = serializeSvgNode(VedicChartSvgDrawing({ chart, ariaLabel, chartId: "export-chart" }))
|
||||
.replace(/<defs>[\s\S]*?<\/defs>/g, "")
|
||||
.replace(/ clip-path="[^"]*"/g, "")
|
||||
.replace(/<svg\b/, '<svg xmlns="http://www.w3.org/2000/svg"')
|
||||
.replace(/height="auto"/, 'height="452"')
|
||||
.replace(/<svg\b/, '<svg xmlns="http://www.w3.org/2000/svg" height="452"')
|
||||
.replace(/class="([^"]*)"/g, (_match, classes: string) => {
|
||||
if (classes.includes("personal-report-chart-cell")) return 'fill="none" stroke="currentColor" stroke-width="1.25"';
|
||||
if (classes.includes("personal-report-chart-retrograde")) return 'stroke="currentColor" stroke-width="1.9"';
|
||||
|
||||
Reference in New Issue
Block a user