@fish-under-sea/magpie-dragonapi 0.3.0 → 1.0.0

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/lib/usage.mjs CHANGED
@@ -52,6 +52,10 @@ export function fmtStamp(sec) {
52
52
  /** firstToken 取首字耗时(秒)。站点有时给 ttft,有时给 first_token_time。 */
53
53
  function firstToken(row) {
54
54
  const o = otherOf(row)
55
+ // 站点(本部署)把首字耗时写在 other.frt,单位是毫秒;-1000 表示缓存命中/未记录。
56
+ // 之前只认 ttft,于是所有请求的首字都显示「—」。
57
+ const frt = num(o?.frt) ?? num(row?.frt)
58
+ if (frt !== undefined && frt > 0) return frt / 1000
55
59
  return num(row?.ttft) ?? num(o?.ttft) ?? num(row?.first_token_time) ?? num(o?.first_token_time)
56
60
  }
57
61
 
@@ -110,6 +114,14 @@ export function rowsOf(items, cur, account = '') {
110
114
  model,
111
115
  group: pick(r?.group, other?.group),
112
116
  tokenName: pick(r?.token_name, r?.tokenName),
117
+ id: pick(r?.id, r?.log_id),
118
+ requestId: pick(r?.request_id, r?.requestId),
119
+ upRequestId: pick(r?.upstream_request_id, other?.upstream_request_id, r?.upRequestId),
120
+ // 这条请求是钱包扣费还是订阅扣费:站点写在 other.billing_source 里。
121
+ // 页面据此给费用胶囊换图标——两者额度口径不同,不能长一个样。
122
+ billingSource: pick(other?.billing_source, other?.billingSource, r?.billing_source),
123
+ // 分组倍率(站点写在 other 里),分组列第二行用。
124
+ groupRatio: num(other?.group_ratio) ?? num(other?.user_group_ratio) ?? num(r?.group_ratio),
113
125
  upModel: pick(other?.upstream_model, other?.up_model, other?.request_model),
114
126
  respModel: pick(other?.response_model, other?.downstream_model),
115
127
  effort: pick(other?.reasoning_effort, other?.effort),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fish-under-sea/magpie-dragonapi",
3
- "version": "0.3.0",
3
+ "version": "1.0.0",
4
4
  "description": "DragonAPI for magpie: a provider plugin whose models, groups and prices come from the site's public /api/pricing, with balance and per-call usage from an sk- key, plus a local page that lists the market (read-only), shows usage and can mint new keys for a group.",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
@@ -43,19 +43,19 @@
43
43
  "access": "public"
44
44
  },
45
45
  "magpie": {
46
- "icon": "page/icon.png",
47
- "name": "@fish-under-sea/magpie-dragonapi",
46
+ "icon": "page/star.png",
47
+ "name": "DragonAPI",
48
48
  "summary": {
49
49
  "zh": "把 DragonAPI 接进 magpie:模型目录、余额与用量,外加一个按分组建钥匙的本地控制台。",
50
50
  "en": "DragonAPI for magpie: model catalog, balance and usage, plus a local console for minting per-group keys."
51
51
  },
52
52
  "page": {
53
- "title": "@fish-under-sea/magpie-dragonapi",
53
+ "title": "DragonAPI",
54
54
  "titles": {
55
- "zh": "@fish-under-sea/magpie-dragonapi",
56
- "zh-TW": "@fish-under-sea/magpie-dragonapi",
57
- "ja": "@fish-under-sea/magpie-dragonapi",
58
- "de": "@fish-under-sea/magpie-dragonapi"
55
+ "zh": "DragonAPI",
56
+ "zh-TW": "DragonAPI",
57
+ "ja": "DragonAPI",
58
+ "de": "DragonAPI"
59
59
  },
60
60
  "file": "page/index.html",
61
61
  "icon": "page/star.png",
package/page/star.png CHANGED
Binary file