@lijinzhao8/opencode-usage 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli/index.js CHANGED
@@ -102,7 +102,7 @@ function getAdminHTML() {
102
102
 
103
103
  <div class="header">
104
104
  <h1>opencode-usage 管理界面</h1>
105
- <span class="badge">v1.1.2</span>
105
+ <span class="badge">v1.1.3</span>
106
106
  </div>
107
107
 
108
108
  <div class="container">
@@ -133,11 +133,11 @@ function getAdminHTML() {
133
133
  <div class="form-row">
134
134
  <div class="form-group">
135
135
  <label>货币符号</label>
136
- <input id="cfg-currency" type="text" placeholder="$">
136
+ <input id="cfg-currency" type="text" placeholder="¥">
137
137
  </div>
138
138
  <div class="form-group">
139
139
  <label>费用小数位数</label>
140
- <input id="cfg-decimals" type="number" min="0" max="8" placeholder="4">
140
+ <input id="cfg-decimals" type="number" min="0" max="8" placeholder="2">
141
141
  </div>
142
142
  </div>
143
143
  <div class="form-row">
@@ -160,7 +160,7 @@ function getAdminHTML() {
160
160
  </div>
161
161
 
162
162
  <script>
163
- let config = { groups: [], providers: [], currency: "$", cost_decimals: 4, show_per_message: true, show_session_totals: true };
163
+ let config = { groups: [], providers: [], currency: "¥", cost_decimals: 2, show_per_message: true, show_session_totals: true };
164
164
 
165
165
  // ── Tabs ──
166
166
  document.querySelectorAll(".tab").forEach(tab => {
@@ -178,8 +178,8 @@ async function loadConfig() {
178
178
  config = await res.json();
179
179
  renderGroups();
180
180
  renderProviders();
181
- document.getElementById("cfg-currency").value = config.currency || "$";
182
- document.getElementById("cfg-decimals").value = config.cost_decimals ?? 4;
181
+ document.getElementById("cfg-currency").value = config.currency || "¥";
182
+ document.getElementById("cfg-decimals").value = config.cost_decimals ?? 2;
183
183
  document.getElementById("cfg-per-msg").checked = config.show_per_message !== false;
184
184
  document.getElementById("cfg-totals").checked = config.show_session_totals !== false;
185
185
  }
@@ -230,7 +230,7 @@ function renderGroups() {
230
230
  <input value="\${(g.provider_ids||[]).join(', ')}" onchange="config.groups[\${i}].provider_ids=this.value.split(',').map(s=>s.trim()).filter(Boolean)" placeholder="api-proxy, xiaomi-token-plan">
231
231
  </div>
232
232
  <div class="form-group">
233
- <label>初始余额($)</label>
233
+ <label>初始余额(¥)</label>
234
234
  <input type="number" step="0.01" value="\${g.initial_balance||0}" onchange="config.groups[\${i}].initial_balance=parseFloat(this.value)||0">
235
235
  </div>
236
236
  <div class="form-group">
package/config.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "currency": "$",
3
- "cost_decimals": 4,
2
+ "currency": "¥",
3
+ "cost_decimals": 2,
4
4
  "show_per_message": true,
5
5
  "show_session_totals": true,
6
6
  "groups": [
package/dist/tui.js CHANGED
@@ -66,8 +66,8 @@ var tui_default = {
66
66
  tui: async (api, options, meta) => {
67
67
  const t = api.theme.current;
68
68
  const fileConfig = getConfig();
69
- const currency = options?.currency ?? fileConfig.currency ?? "$";
70
- const costDecimals = options?.cost_decimals ?? fileConfig.cost_decimals ?? 4;
69
+ const currency = options?.currency ?? fileConfig.currency ?? "¥";
70
+ const costDecimals = options?.cost_decimals ?? fileConfig.cost_decimals ?? 2;
71
71
  const showPerMsg = options?.show_per_message ?? fileConfig.show_per_message ?? true;
72
72
  const showTotals = options?.show_session_totals ?? fileConfig.show_session_totals ?? true;
73
73
  const groups = options?.groups ?? fileConfig.groups ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lijinzhao8/opencode-usage",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "OpenCode plugin for real-time API usage and cost tracking in the TUI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",