添加主题

This commit is contained in:
sijinhui
2024-01-29 22:13:57 +08:00
parent 0aa5c33dae
commit 75da1568a2
4 changed files with 796 additions and 7 deletions

View File

@@ -30,12 +30,13 @@ async function handle(
// const matchResponse = request_data.logEntry.match(regex);
const regex_message = /(?<="content":")(.*?)(?="}[,\]])/g;
const matchAllMessage = request_data.logEntry.match(regex_message);
console.log(matchAllMessage, "=====");
// console.log(matchAllMessage, "=====");
if (matchAllMessage.length > 0) {
request_data.logToken =
getTokenLength(matchAllMessage.join(" ")) +
matchAllMessage.length * 3;
}
delete request_data["logEntry"];
}
} catch (e) {
console.log("[LOG]", "logToken", e);

View File

@@ -5,15 +5,12 @@ import * as echarts from "echarts";
import { DatePicker, DatePickerValue } from "@tremor/react";
import { zhCN } from "date-fns/locale";
import { EChartsOption } from "echarts";
import { OptionDataItem, OptionDataValue } from "echarts/types/src/util/types";
// import { param } from "ts-interface-checker"; // 导入 echarts
import { essos, walden } from "@/lib/charts_theme";
export default function UsageByModelChart() {
const [currentDate, setCurrentDate] = useState(new Date());
const [searchDate, setSearchDate] = useState("");
const [clientSide, setClientSide] = useState(false);
useEffect(() => {
let ignore = false;
// console.log('windows', window.location.href)
@@ -57,7 +54,8 @@ export default function UsageByModelChart() {
fetchData().then((option) => {
if (!ignore && option && typeof window !== "undefined") {
let chartDom = document.getElementById("usage-by-model-chart");
let myChart = echarts.init(chartDom);
echarts.registerTheme("default", essos);
let myChart = echarts.init(chartDom, "default");
option && myChart.setOption(option);
setSearchDate(currentDateString);
console.log("option计数", 1);