dsh-pisces 0.2.5 → 0.2.6

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/CHANGELOG.md CHANGED
@@ -1,7 +1,10 @@
1
- # 更新记录
1
+ # 更新记录
2
2
 
3
3
  本项目遵循语义化版本;`0.x` 期间小版本可能带行为变化。
4
4
 
5
+ ## 0.2.6
6
+
7
+ - 好感封顶:`utterance` 累计 ≤15、`heard` ≤20、`diary` ≤10。之前把旧数据一次灌进来会直接顶到 100(5 天就「离不开」),现在 705 条、4 天算下来是 47(亲近)。
5
8
  ## 0.2.5
6
9
 
7
10
  - 补 `CHANGELOG.md`、`AGENTS.md`。
package/lib/affinity.js CHANGED
@@ -3,6 +3,8 @@
3
3
  // 口径(与 README 一致,别在这里加系数):
4
4
  // - 初始 10;每共同存在一天 +0.5(最多 +15,即 30 天上限);
5
5
  // - 他回话 heard +1.5;她开口 utterance +0.5;answer +2;reunion +5;diary +1;grant/grant_offer +1;
6
+ // - **重复型加分各自封顶**(2026-11-10 加):utterance 累计 ≤15、heard ≤20、diary ≤10。
7
+ // 原因:合并旧数据时一次灌进几百条,不封顶会直接把好感顶到 100(5 天就「离不开」)。
6
8
  // - 她拒绝 refusal 不扣;他坚持/受伤(react 的 insist / hurt)分别 -3 / -6;
7
9
  // - 被回答过的问题(questions 表 status='answered')每条 +2,最多 +10;
8
10
  // - 冷落:距最后一条**真人互动**超过 7 天,每多一天 -1(最多 -10);
@@ -43,6 +45,13 @@ export const GAIN = {
43
45
  /** 他坚持/受伤的扣分。leave/accept/other 不扣(拒绝本身也不扣)。 */
44
46
  export const REACT_LOSS = { insist: 3, hurt: 6 }
45
47
 
48
+ /** 重复型加分的累计上限:防止一次性导入几百条把好感顶满。 */
49
+ export const GAIN_CAPS = {
50
+ utterance: 15,
51
+ heard: 20,
52
+ diary: 10,
53
+ }
54
+
46
55
  /** 五档:min 是这一档的门槛。 */
47
56
  export const TIERS = [
48
57
  { min: 0, label: '陌生' },
@@ -124,11 +133,18 @@ export function computeAffinity({ events = [], questions = [], now = Date.now()
124
133
 
125
134
  let earned = dayBonus
126
135
  let lastRealTs = null
136
+ const typed = {}
127
137
  for (const e of list) {
128
138
  if (isMachineEvent(e)) continue
129
- earned += GAIN[String(e.type || '')] || 0
139
+ const type = String(e.type || '')
140
+ const gain = GAIN[type] || 0
141
+ if (gain) typed[type] = (typed[type] || 0) + gain
130
142
  lastRealTs = Number(e.ts)
131
143
  }
144
+ for (const [type, sum] of Object.entries(typed)) {
145
+ const cap = GAIN_CAPS[type]
146
+ earned += cap == null ? sum : Math.min(cap, sum)
147
+ }
132
148
 
133
149
  const answered = (Array.isArray(questions) ? questions : []).filter(
134
150
  (q) => String(q?.status ?? '') === 'answered',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-pisces",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "private": false,
5
5
  "description": "鱼肥生双:一只会长大的本地小鱼(DSH 插件)。事件流记忆、渐进揭开、好感、新手引导;派希丝是养成目标。",
6
6
  "type": "module",