sync update from LAN repo (source master @ ca48c4ec)
This commit is contained in:
1 parent
8bc8b0e082
commit
ea9dcff9c0
873 files changed
+107866
-14011
No files matched your search
@@ -21,6 +21,7 @@ import {
|
||||
downloadLlmMetricsExcel,
|
||||
type LlmMetricsFilters,
|
||||
} from "@/core/llm-metrics/api";
|
||||
import { getAdminQueryDateTimeBounds } from "@/core/admin/query-window";
|
||||
import { useLlmMetrics } from "@/core/llm-metrics/hooks";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useTheme } from "@/contexts/ThemeContext";
|
||||
@@ -77,12 +78,13 @@ function speedColor(tps?: number | null): string {
|
||||
/** The original LLM-call metrics view, now one tab of the metrics page. */
|
||||
function LlmMetricsPanel() {
|
||||
const { theme } = useTheme();
|
||||
const queryDateTimeBounds = getAdminQueryDateTimeBounds();
|
||||
const [page, setPage] = useState(0);
|
||||
const [model, setModel] = useState("");
|
||||
const [user, setUser] = useState("");
|
||||
const [status, setStatus] = useState<StatusFilter>("all");
|
||||
const [since, setSince] = useState("");
|
||||
const [until, setUntil] = useState("");
|
||||
const [since, setSince] = useState(() => getAdminQueryDateTimeBounds().min);
|
||||
const [until, setUntil] = useState(() => getAdminQueryDateTimeBounds().max);
|
||||
const [exporting, setExporting] = useState(false);
|
||||
/** 成功 toast:仅暗色模式,浅色走 Sonner 默认 */
|
||||
const successToastDarkOptions = {
|
||||
@@ -140,11 +142,12 @@ const errorToastDarkOptions = {
|
||||
};
|
||||
|
||||
const resetFilters = () => {
|
||||
const nextBounds = getAdminQueryDateTimeBounds();
|
||||
setModel("");
|
||||
setUser("");
|
||||
setStatus("all");
|
||||
setSince("");
|
||||
setUntil("");
|
||||
setSince(nextBounds.min);
|
||||
setUntil(nextBounds.max);
|
||||
setPage(0);
|
||||
};
|
||||
|
||||
@@ -282,7 +285,7 @@ const errorToastDarkOptions = {
|
||||
<h2 className="text-lg font-semibold">大模型调用统计</h2>
|
||||
<p className="text-muted-foreground mt-1 text-sm">
|
||||
记录每一次大模型的实际调用,包括 token 数、耗时、估算速度和失败原因。
|
||||
后台无条件记录,与前端速度指示器开关无关。
|
||||
后台无条件记录,与前端速度指示器开关无关;默认仅查询最近 30 天。
|
||||
</p>
|
||||
</div>
|
||||
<Button onClick={handleExport} disabled={exporting}>
|
||||
@@ -342,8 +345,10 @@ const errorToastDarkOptions = {
|
||||
<Input
|
||||
type="datetime-local"
|
||||
value={since}
|
||||
min={queryDateTimeBounds.min}
|
||||
max={until || queryDateTimeBounds.max}
|
||||
onChange={(e) => {
|
||||
setSince(e.target.value);
|
||||
setSince(e.target.value || queryDateTimeBounds.min);
|
||||
setPage(0);
|
||||
}}
|
||||
/>
|
||||
@@ -353,8 +358,10 @@ const errorToastDarkOptions = {
|
||||
<Input
|
||||
type="datetime-local"
|
||||
value={until}
|
||||
min={since || queryDateTimeBounds.min}
|
||||
max={queryDateTimeBounds.max}
|
||||
onChange={(e) => {
|
||||
setUntil(e.target.value);
|
||||
setUntil(e.target.value || queryDateTimeBounds.max);
|
||||
setPage(0);
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user