diff --git a/app.js b/app.js
index 8bb3140..14ea014 100644
--- a/app.js
+++ b/app.js
@@ -504,6 +504,9 @@ class CLIProxyManager {
const tokensHourBtn = document.getElementById('tokens-hour-btn');
const tokensDayBtn = document.getElementById('tokens-day-btn');
const chartLineSelects = document.querySelectorAll('.chart-line-select');
+ const modelPriceForm = document.getElementById('model-price-form');
+ const resetModelPricesBtn = document.getElementById('reset-model-prices');
+ const modelPriceSelect = document.getElementById('model-price-model-select');
if (refreshUsageStats) {
refreshUsageStats.addEventListener('click', () => this.loadUsageStats());
@@ -528,6 +531,18 @@ class CLIProxyManager {
});
});
}
+ if (modelPriceForm) {
+ modelPriceForm.addEventListener('submit', (event) => {
+ event.preventDefault();
+ this.handleModelPriceSubmit();
+ });
+ }
+ if (resetModelPricesBtn) {
+ resetModelPricesBtn.addEventListener('click', () => this.handleModelPriceReset());
+ }
+ if (modelPriceSelect) {
+ modelPriceSelect.addEventListener('change', () => this.prefillModelPriceInputs());
+ }
// 模态框
const closeBtn = document.querySelector('.close');
@@ -617,6 +632,7 @@ class CLIProxyManager {
// 使用统计状态
requestsChart = null;
tokensChart = null;
+ costChart = null;
currentUsageData = null;
chartLineSelections = ['none', 'none', 'none'];
chartLineSelectIds = ['chart-line-select-0', 'chart-line-select-1', 'chart-line-select-2'];
@@ -625,6 +641,9 @@ class CLIProxyManager {
{ borderColor: '#a855f7', backgroundColor: 'rgba(168, 85, 247, 0.15)' },
{ borderColor: '#10b981', backgroundColor: 'rgba(16, 185, 129, 0.15)' }
];
+ modelPriceStorageKey = 'cli-proxy-model-prices-v2';
+ modelPrices = {};
+ modelPriceInitialized = false;
showModal() {
const modal = document.getElementById('modal');
diff --git a/build.cjs b/build.cjs
index 702b064..f70f68b 100644
--- a/build.cjs
+++ b/build.cjs
@@ -169,42 +169,44 @@ function build() {
console.log(`使用版本号: ${version}`);
html = html.replace(/__VERSION__/g, version);
- html = html.replace(
- '',
- ``
- );
+ html = html.replace(
+ '',
+ () => ``
+ );
+
+ html = html.replace(
+ '',
+ () => ``
+ );
- html = html.replace(
- '',
- ``
- );
-
- const scriptTagRegex = /`
- );
+ const scriptTagRegex = /`
+ );
} else {
console.warn('未找到 app.js 脚本标签,未内联应用代码。');
}
- const logoDataUrl = loadLogoDataUrl();
- if (logoDataUrl) {
- const logoScript = ``;
- if (html.includes('