shine-code-submit 1.0.7 → 1.0.9

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.
@@ -172,6 +172,9 @@ function ProjectDetail({ p }: { p: ReportProject }) {
172
172
  <span className="rt-sum" title={fmtUsageFull(p.totalTokens)} style={{ marginLeft: "auto", color: "#9dbefe" }}>
173
173
  {fmtUsageLabeled(p.totalTokens)}
174
174
  </span>
175
+ <span className="rt-sum" title={`代码变更 +${p.totalLines.added} -${p.totalLines.deleted} M${p.totalLines.modified}`} style={{ color: "#9aa" }}>
176
+ +{p.totalLines.added} -{p.totalLines.deleted} M{p.totalLines.modified}
177
+ </span>
175
178
  </div>
176
179
 
177
180
  <div style={{ overflow: "auto", flex: "1 1 0", minHeight: 0 }}>
@@ -184,6 +187,7 @@ function ProjectDetail({ p }: { p: ReportProject }) {
184
187
  <th className="rt-num">输入 token</th>
185
188
  <th className="rt-num">输出 token</th>
186
189
  <th className="rt-num">总数</th>
190
+ <th className="rt-num">代码变更</th>
187
191
  </tr>
188
192
  </thead>
189
193
  <tbody>
@@ -197,6 +201,9 @@ function ProjectDetail({ p }: { p: ReportProject }) {
197
201
  <td className="rt-num">{fmtTokens(realInput(s.tokenTotal!))}</td>
198
202
  <td className="rt-num">{fmtTokens(s.tokenTotal!.output)}</td>
199
203
  <td className="rt-num">{fmtTokens(realInput(s.tokenTotal!) + s.tokenTotal!.output)}</td>
204
+ <td className="rt-num" title={s.linesTotal ? `+${s.linesTotal.added} -${s.linesTotal.deleted} M${s.linesTotal.modified}` : ""}>
205
+ {s.linesTotal ? `+${s.linesTotal.added} -${s.linesTotal.deleted} M${s.linesTotal.modified}` : "-"}
206
+ </td>
200
207
  </tr>
201
208
  ))}
202
209
  </tbody>
package/ui/lib/util.ts CHANGED
@@ -50,11 +50,11 @@ export function fmtTokens(n: number): string {
50
50
  return trimZero((n / 1_000_000_000_000).toFixed(2)) + "T";
51
51
  }
52
52
 
53
- /** 真实输入 token = 未缓存输入 + 缓存写 + 缓存读(每次 API 请求的完整 prompt 上下文)。
54
- * 直接累加 Anthropic API 返回的原始字段,不乘任何系数。 */
53
+ /** 计费输入 token = 未缓存输入 + 缓存写×1.25 + 缓存读×0.1(Anthropic 计费口径,对齐官方/智谱后台)。
54
+ * cache_creation 加价 1.25x,cache_read 命中折扣 0.1x;Math.round 避免浮点。 */
55
55
  export function realInput(u?: TokenUsage | null): number {
56
56
  if (!u) return 0;
57
- return u.input + u.cacheCreation + u.cacheRead;
57
+ return Math.round(u.input + u.cacheCreation * 1.25 + u.cacheRead * 0.1);
58
58
  }
59
59
 
60
60
  /** token 用量简写:↑真实输入 ↓输出(真实输入 = 未缓存 + 缓存写 + 缓存读)。无值返回空串。 */