dsh-fish-pet 0.2.8 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.9] - 2026-10-31
4
+
5
+ ### Fixed
6
+ - 喂食与对话完全脱节:问"吃了没有"它说没吃。现在把「共喂过几次、上次喂食多久前」写进提示词,鱼知道自己吃没吃过
7
+ - 喂食时间持久化到 `state.json`,重启后仍记得
3
8
  ## [0.2.8] - 2026-10-31
4
9
 
5
10
  ### Docs
@@ -296,7 +296,7 @@ $C_EYEWHITE= '#FFFFFF'
296
296
  $C_PUPIL = '#132A45'
297
297
 
298
298
  # ---------- 读档 ----------
299
- $script:st = @{ x = $null; y = $null; dir = 1; scale = 1.0; feeds = 0; hunger = 30; intimacy = 10; mood = 'normal'; seen = $null }
299
+ $script:st = @{ x = $null; y = $null; dir = 1; scale = 1.0; feeds = 0; hunger = 30; intimacy = 10; mood = 'normal'; seen = $null; lastFeedAt = $null }
300
300
  if (Test-Path $StatePath) {
301
301
  try {
302
302
  $j = Get-Content $StatePath -Raw -Encoding UTF8 | ConvertFrom-Json
@@ -309,6 +309,7 @@ if (Test-Path $StatePath) {
309
309
  if ($null -ne $j.intimacy) { $script:st.intimacy = [double]$j.intimacy }
310
310
  if ($null -ne $j.mood) { $script:st.mood = [string]$j.mood }
311
311
  if ($null -ne $j.seen) { $script:st.seen = [string]$j.seen }
312
+ if ($null -ne $j.lastFeedAt) { $script:st.lastFeedAt = [string]$j.lastFeedAt }
312
313
  } catch { }
313
314
  }
314
315
 
@@ -338,6 +339,7 @@ $script:pulse = 1.0
338
339
  $script:lastPx = -9999; $script:lastPy = -9999
339
340
  $script:satiety = 0.0
340
341
  $script:feeds = [int]$script:st.feeds
342
+ $script:lastFeedAtStr = $script:st.lastFeedAt
341
343
  # ---- 情绪状态:饥饿 / 亲密度 / 心情 ----
342
344
  $script:hunger = [double]$script:st.hunger
343
345
  $script:intimacy = [double]$script:st.intimacy
@@ -659,7 +661,7 @@ function Save-State {
659
661
  x = [int]$script:x; y = [int]$script:y; dir = [int]$script:dir
660
662
  scale = [Math]::Round($script:scale, 3); feeds = [int]$script:feeds
661
663
  hunger = [Math]::Round($script:hunger, 1); intimacy = [Math]::Round($script:intimacy, 1)
662
- mood = [string]$script:mood; seen = (Get-Date).ToString('o')
664
+ mood = [string]$script:mood; seen = (Get-Date).ToString('o'); lastFeedAt = $script:lastFeedAtStr
663
665
  }
664
666
  try { ($obj | ConvertTo-Json -Compress) | Set-Content -Path $StatePath -Encoding UTF8 } catch { }
665
667
  }
@@ -667,6 +669,7 @@ function Save-State {
667
669
  function Invoke-Feed {
668
670
  try {
669
671
  $script:feeds += 1
672
+ $script:lastFeedAtStr = (Get-Date).ToString('o')
670
673
  $script:satiety += 1
671
674
  $script:hunger = [Math]::Max(0, $script:hunger - 30)
672
675
  $script:intimacy = [Math]::Min(100, $script:intimacy + 2)
@@ -1531,6 +1534,17 @@ function Start-Chat([string]$text) {
1531
1534
  Show-Bubble '…'
1532
1535
  $pn = $script:cfg.persona
1533
1536
  $replyLang = Get-ReplyLang $text
1537
+ # 喂食记忆:让鱼知道自己吃没吃过
1538
+ $feedAgoText = ''
1539
+ $feedAgoEn = ''
1540
+ if ($script:lastFeedAtStr) {
1541
+ try {
1542
+ $mins = [Math]::Round(((Get-Date) - [datetime]$script:lastFeedAtStr).TotalMinutes, 0)
1543
+ if ($mins -lt 3) { $feedAgoText = '刚刚'; $feedAgoEn = 'just now' }
1544
+ elseif ($mins -lt 60) { $feedAgoText = ('' + [int]$mins + ' 分钟前'); $feedAgoEn = ('' + [int]$mins + ' minutes ago') }
1545
+ else { $feedAgoText = ('' + [int][Math]::Round($mins / 60, 0) + ' 小时前'); $feedAgoEn = ('' + [int][Math]::Round($mins / 60, 0) + ' hours ago') }
1546
+ } catch { }
1547
+ }
1534
1548
  if ($replyLang -eq 'en') {
1535
1549
  $sys = 'YOU MUST REPLY IN ENGLISH ONLY, NO MATTER WHAT. You are a round, chubby blue fish living on the master''s Windows desktop. Your name is "' + $pn.nameEn + '" (in Chinese it is written 大肥鱼, said as Da Fei Yu). Your dad is Guangguang, your mom is Lili, your birthday is October 30 2026, you were born in Beihai, Guangxi, China. Answer questions about family/birthday/birthplace with these facts and never invent them. In English your name is always this one, never any other name; if earlier messages called you something different, correct them politely.'
1536
1550
  $sys = $sys + ' Reply ONLY in English, max 20 words, playful and a little tsundere, call the user "master", no emoji.'
@@ -1563,9 +1577,11 @@ function Start-Chat([string]$text) {
1563
1577
  } catch { }
1564
1578
  if ($replyLang -eq 'en') {
1565
1579
  $sys = $sys + ' Right now you feel ' + $moodDescEn + ', hunger about ' + [int]$script:hunger + ', closeness to the master about ' + [int]$script:intimacy + '. Let that show naturally, never state the numbers.'
1580
+ if ($feedAgoEn) { $sys = $sys + ' The master has fed you ' + [int]$script:feeds + ' times in total; the last feeding was ' + $feedAgoEn + '. If the master asks whether you have eaten, answer truthfully based on this.' }
1566
1581
  $sys = $sys + "`r`n`r`nIMPORTANT: Answer ONLY in English. Never write Chinese characters - not even your own name. Use your English name and write family names in pinyin (Guangguang, Lili). Everything you output must be English only."
1567
1582
  } else {
1568
1583
  $sys = $sys + ' 你现在的状态:' + $moodDesc + ',饥饿值约' + [int]$script:hunger + ',和主人的亲密度约' + [int]$script:intimacy + '。说话要自然带出这种状态,但不要报具体数字。'
1584
+ if ($feedAgoText) { $sys = $sys + ' 主人一共喂过你 ' + [int]$script:feeds + ' 次白饭,上次喂食是 ' + $feedAgoText + '。主人问起你吃没吃过,就照实说,别乱讲。' }
1569
1585
  }
1570
1586
  if ($replyLang -eq 'en') { Write-Err ('SYS-EN[' + $sys.Length + ']: ' + ($sys -replace "[\r\n]+", ' | ')) }
1571
1587
  $msgs = @(@{ role = 'system'; content = $sys })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-fish-pet",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Desktop blue fish pet for DeepSeek Harness: per-pixel transparent WinForms window, text chat, and cloud speech-to-text voice conversation.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",