feat(subagent): v0.7.5 — 适配 kimi-code 0.36.0 子代理模型池(双写兼容/池管理/force/前置校验)+ 热力图详情按需加载 + models.dev 刷新(GLM-5.3)
Release / Version consistency (push) Canceled after 0s
Release / Build (macos-latest) (push) Canceled after 0s
Release / Build (ubuntu-latest) (push) Canceled after 0s
Release / Build (windows-latest) (push) Canceled after 0s
Release / Attach macOS install script (push) Canceled after 0s

This commit is contained in:
KimiSwitch Dev committed 2026-08-15 23:21:22 +08:00
1 parent 89c71fbfe6
commit 9a3875d990
19 files changed
+152041 -140593

No files matched your search

+20 -12
View File
@@ -1,10 +1,11 @@
import { useMemo, useState, type ReactNode } from "react";
import { useState, type ReactNode } from "react";
import { createPortal } from "react-dom";
import { invoke } from "@tauri-apps/api/core";
import { useDashboard, type DashboardRange } from "../../hooks/useDashboard";
import { useCurrency } from "../../hooks/useCurrency";
import { useTranslation } from "../../i18n";
import { fmtInt, fmtPct, fmtTime, fmtTokens } from "../../lib/dashboard-format";
import { DailyBars, modelColor } from "./DailyBars";
import { DailyBars } from "./DailyBars";
import { DailyDetailModal } from "./DailyDetailModal";
import { Heatmap } from "./Heatmap";
import { TrendLineChart } from "./TrendLineChart";
@@ -62,11 +63,6 @@ export function DashboardPage() {
const [heatmapSelected, setHeatmapSelected] = useState<DailyRow | null>(null);
const daily = data?.stats.daily ?? [];
const detailDates = useMemo(() => new Set(daily.map((d) => d.date)), [daily]);
const heatmapColorMap = useMemo(() => {
const unique = [...new Set(daily.flatMap((d) => Object.keys(d.byModel || {})))];
return Object.fromEntries(unique.map((m, i) => [m, modelColor(i)]));
}, [daily]);
const RANGE_LABELS: Record<DashboardRange, string> = {
today: t("rangeToday"),
@@ -109,9 +105,21 @@ export function DashboardPage() {
const rangeTotals = data.rangeTotals;
const visibleModels = showAllModels ? models : models.slice(0, 8);
const onHeatmapCellDoubleClick = (cell: HeatmapCell) => {
const row = daily.find((d) => d.date === cell.date);
if (row) setHeatmapSelected(row);
const onHeatmapCellDoubleClick = async (cell: HeatmapCell) => {
try {
const row = await invoke<DailyRow | null>("get_day_detail", {
date: cell.date,
});
if (row) {
setHeatmapSelected(row);
} else {
setHeatmapSelected(null);
alert(t("dayDetailNoData", { date: cell.date }));
}
} catch (err) {
setHeatmapSelected(null);
alert(err instanceof Error ? err.message : String(err));
}
};
// Recent pagination
@@ -221,7 +229,7 @@ export function DashboardPage() {
{/* Heatmap — full row */}
<Card title={t("cardHeatmap")} subtitle={t("cardHeatmapSub")}>
<Heatmap heatmap={heatmap} detailDates={detailDates} onCellDoubleClick={onHeatmapCellDoubleClick} />
<Heatmap heatmap={heatmap} onCellDoubleClick={onHeatmapCellDoubleClick} />
</Card>
{/* Usage-trend tabs + Model table side by side */}
@@ -473,7 +481,7 @@ export function DashboardPage() {
<DailyDetailModal
day={heatmapSelected}
dimension="model"
colorMap={heatmapColorMap}
colorMap={{}}
unknownProviderLabel={t("providerUnknown")}
onClose={() => setHeatmapSelected(null)}
/>,
+3 -5
View File
@@ -7,9 +7,7 @@ import type { HeatmapCell, HeatmapData } from "../../types/dashboard";
interface HeatmapProps {
heatmap: HeatmapData;
/** Set of dates (YYYY-MM-DD) that have detail data in the current range. */
detailDates?: Set<string>;
/** Called when a cell with detail data is double-clicked. */
/** Called when a cell with data (level > 0) is double-clicked. */
onCellDoubleClick?: (cell: HeatmapCell) => void;
}
@@ -34,7 +32,7 @@ interface HoverState {
y: number;
}
export function Heatmap({ heatmap, detailDates, onCellDoubleClick }: HeatmapProps) {
export function Heatmap({ heatmap, onCellDoubleClick }: HeatmapProps) {
const { t, lang } = useTranslation();
const cells = heatmap?.cells || [];
const monthLabels = heatmap?.monthLabels || [];
@@ -176,7 +174,7 @@ export function Heatmap({ heatmap, detailDates, onCellDoubleClick }: HeatmapProp
);
}
const level = cell.level ?? 0;
const hasDetail = detailDates ? detailDates.has(cell.date) : level > 0;
const hasDetail = level > 0;
return (
<button
key={cell.date}