luckytri 1.0.6 → 1.0.8
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/LICENSE +21 -21
- package/README.en.md +7 -3
- package/README.md +7 -3
- package/docs/en/CHANGELOG.md +35 -16
- package/docs/en/chat-style.md +28 -9
- package/docs/en/guide.md +5 -5
- package/docs/en/her-life.md +2 -2
- package/docs/en/webui.md +1 -1
- package/docs/zh/CHANGELOG.md +35 -16
- package/docs/zh/chat-style.md +30 -9
- package/docs/zh/guide.md +5 -5
- package/docs/zh/her-life.md +2 -2
- package/docs/zh/webui.md +1 -1
- package/package.json +1 -1
- package/public/app/assets/{ChatsPage-DCYMkJ91.js → ChatsPage-CshdtTzV.js} +2 -2
- package/public/app/assets/ChatsPage-DfyPCS9N.css +1 -0
- package/public/app/assets/{Empty-CLyZkxR5.js → Empty-C7yzOBzy.js} +1 -1
- package/public/app/assets/{Empty-DIobYG3x.css → Empty-DmUB2-Bk.css} +1 -1
- package/public/app/assets/{Field-BpaRwLI_.js → Field-BjFv4Rfn.js} +1 -1
- package/public/app/assets/HeartPage-Bft9wZp5.css +1 -0
- package/public/app/assets/{HeartPage-BIOMTiwr.js → HeartPage-eqo6ru16.js} +1 -1
- package/public/app/assets/LifePage-BUi5euBF.css +1 -0
- package/public/app/assets/{LifePage-BCgM4JkR.js → LifePage-CN8GE5NK.js} +1 -1
- package/public/app/assets/{MemoryPage-vShvRqMt.js → MemoryPage-CCpMN4Wg.js} +1 -1
- package/public/app/assets/MemoryPage-cZvXfkXb.css +1 -0
- package/public/app/assets/{NaturePage-Cy9ptr4G.js → NaturePage-C0JqdBTR.js} +2 -2
- package/public/app/assets/NaturePage-CHkpb5NK.css +1 -0
- package/public/app/assets/PeoplePage-BTU0H1pM.css +1 -0
- package/public/app/assets/{PeoplePage-CUZekB2E.js → PeoplePage-BXGBbO4u.js} +1 -1
- package/public/app/assets/{PluginsPage-1RM4rmJP.js → PluginsPage-Dksp5AV5.js} +1 -1
- package/public/app/assets/{SystemPage-BI2CB5Ig.css → SystemPage-BenIyTvk.css} +1 -1
- package/public/app/assets/{SystemPage-BeT5TmIV.js → SystemPage-Cd7aa8eE.js} +1 -1
- package/public/app/assets/TimePage-BOms_n4I.css +1 -0
- package/public/app/assets/{TimePage-taTmPMM8.js → TimePage-Bs_zImb4.js} +2 -2
- package/public/app/assets/{index-DY5AM0Hz.css → index-BHZcHUMh.css} +1 -1
- package/public/app/assets/{index-DdYwC5ZU.js → index-CyRtYxP3.js} +3 -3
- package/public/app/assets/{knowledge-DJmfu2KN.js → knowledge-BJOIyuJo.js} +1 -1
- package/public/app/assets/{media-BEtnE0Gv.js → media-Bwtx8blz.js} +1 -1
- package/public/app/assets/{mind-Dtiw0-QK.js → mind-DtTVrW6Z.js} +1 -1
- package/public/app/index.html +5 -6
- package/public/guide.en.html +3 -3
- package/public/guide.html +3 -3
- package/scripts/import-data.js +128 -128
- package/scripts/proxy-config.js +167 -167
- package/scripts/update-instance.js +201 -201
- package/server/channels/adapters.js +27 -27
- package/server/channels/onebot/adapter.js +288 -288
- package/server/channels/qqbot/adapter.js +253 -253
- package/server/channels/qqbot/api.js +199 -199
- package/server/channels/qqbot/credentials.js +11 -11
- package/server/channels/qqbot/gateway.js +274 -274
- package/server/channels/qqbot/index.js +389 -389
- package/server/channels/segments.js +40 -40
- package/server/channels/session-key.js +153 -153
- package/server/channels/state.js +42 -42
- package/server/core/api.js +564 -564
- package/server/core/context-builder.js +288 -288
- package/server/core/context-compactor.js +454 -454
- package/server/core/conversation-cues.js +385 -325
- package/server/core/conversation-grounding.js +304 -0
- package/server/core/conversation-manager.js +87 -87
- package/server/core/dialogue-context.js +244 -0
- package/server/core/dialogue-contract.js +35 -0
- package/server/core/feedback.js +8 -8
- package/server/core/group-style.js +72 -72
- package/server/core/initiative-context.js +68 -66
- package/server/core/input-budget.js +32 -32
- package/server/core/local-demo.js +98 -98
- package/server/core/message-manager.js +118 -118
- package/server/core/message-scheduler.js +78 -78
- package/server/core/model-json.js +190 -190
- package/server/core/model-manager.js +5 -8
- package/server/core/model-presets.js +900 -900
- package/server/core/name-call.js +29 -29
- package/server/core/network.js +157 -157
- package/server/core/person-name.js +22 -22
- package/server/core/persona-manager.js +359 -269
- package/server/core/reader-check.js +62 -0
- package/server/core/reply-delivery.js +537 -404
- package/server/core/reply-target-resolver.js +50 -50
- package/server/core/response-generator.js +92 -50
- package/server/core/response-validator.js +53 -32
- package/server/core/retired-prompts.js +51 -51
- package/server/core/sessions.js +109 -109
- package/server/core/speaker-names.js +92 -92
- package/server/core/topic-tracker.js +65 -65
- package/server/core/turn.js +82 -15
- package/server/http.js +18 -18
- package/server/i18n/decisions.js +209 -209
- package/server/i18n/errors.js +2 -0
- package/server/i18n/index.js +144 -144
- package/server/i18n/labels.js +6 -10
- package/server/i18n/models.js +111 -111
- package/server/knowledge/api.js +342 -342
- package/server/knowledge/embedding-profile.js +114 -114
- package/server/knowledge/index.js +13 -13
- package/server/knowledge/retrieval.js +93 -93
- package/server/knowledge/schema.js +158 -158
- package/server/knowledge/vector-index.js +90 -90
- package/server/mind/affect.js +265 -265
- package/server/mind/attention.js +200 -200
- package/server/mind/bonds.js +565 -565
- package/server/mind/clock.js +83 -83
- package/server/mind/context-selection.js +16 -4
- package/server/mind/continuity.js +562 -562
- package/server/mind/conversation-origin.js +175 -175
- package/server/mind/days.js +210 -210
- package/server/mind/evidence-read.js +45 -45
- package/server/mind/expression-grounding.js +21 -0
- package/server/mind/faces.js +373 -373
- package/server/mind/guard.js +68 -60
- package/server/mind/initiative.js +338 -338
- package/server/mind/life/activities.js +21 -21
- package/server/mind/life/context.js +330 -330
- package/server/mind/life/growth.js +261 -261
- package/server/mind/life/presence.js +305 -305
- package/server/mind/meetings.js +1069 -1069
- package/server/mind/memory-policy.js +48 -48
- package/server/mind/memory.js +888 -888
- package/server/mind/nature.js +358 -358
- package/server/mind/novelty.js +19 -19
- package/server/mind/own-voice.js +35 -0
- package/server/mind/periods.js +118 -118
- package/server/mind/reading.js +132 -120
- package/server/mind/relationship-context.js +71 -71
- package/server/mind/relationships.js +390 -390
- package/server/mind/salience.js +201 -201
- package/server/mind/schema.js +567 -567
- package/server/mind/self.js +496 -484
- package/server/mind/thoughts.js +274 -274
- package/server/mind/time/agenda.js +242 -242
- package/server/mind/time/api.js +200 -200
- package/server/mind/time/attention.js +34 -34
- package/server/mind/time/availability.js +23 -1
- package/server/mind/time/executor.js +4 -2
- package/server/mind/time/games.js +20 -11
- package/server/mind/time/index.js +9 -2
- package/server/mind/time/kinds.js +29 -2
- package/server/mind/time/material-relevance.js +19 -0
- package/server/mind/time/model-material.js +77 -77
- package/server/mind/time/presentation.js +35 -51
- package/server/mind/time/reading-input.js +31 -0
- package/server/mind/time/schedule.js +83 -83
- package/server/mind/time/schema.js +84 -84
- package/server/mind/time/search.js +383 -383
- package/server/mind/time/sharing.js +482 -472
- package/server/mind/time/task-links.js +311 -311
- package/server/mind/time/tasks.js +41 -3
- package/server/mind/time/works.js +527 -432
- package/server/mind/traits.js +191 -191
- package/server/mind/view.js +62 -12
- package/server/runtime/installation.js +116 -116
- package/server/runtime/update-manager.js +140 -140
- package/server/storage/data-package.js +298 -298
- package/server/storage/data-transfer-api.js +50 -50
- package/server/storage/data-transfer-worker.js +18 -18
- package/server/storage/data-transfer.js +416 -416
- package/server/studio/display-names.js +139 -139
- package/server/studio/management.js +102 -102
- package/server/studio/updates.js +144 -144
- package/server/version.js +10 -10
- package/public/app/assets/ChatsPage-CFMVozoG.css +0 -1
- package/public/app/assets/HeartPage-C-2jvgzF.css +0 -1
- package/public/app/assets/LifePage-CG1OHbRK.css +0 -1
- package/public/app/assets/MemoryPage-C_Bu4rfb.css +0 -1
- package/public/app/assets/NaturePage-CPZlImT0.css +0 -1
- package/public/app/assets/PeoplePage-3RRUITDz.css +0 -1
- package/public/app/assets/TimePage-C-guwPk2.css +0 -1
package/server/mind/clock.js
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import { localClock } from "../core/conversation-cues.js";
|
|
2
|
-
|
|
3
|
-
export const JUST_NOW = 5 * 60000;
|
|
4
|
-
|
|
5
|
-
export function elapsedLabel(time, now, zone = "Asia/Shanghai") {
|
|
6
|
-
const age = Math.max(0, now - time);
|
|
7
|
-
if (age < JUST_NOW) return "刚才";
|
|
8
|
-
const day = localClock(time, zone).local.slice(0, 10);
|
|
9
|
-
const today = localClock(now, zone).local.slice(0, 10);
|
|
10
|
-
if (day === today) return "今天早些时候";
|
|
11
|
-
if (day === localClock(now - 86400000, zone).local.slice(0, 10))
|
|
12
|
-
return "昨天";
|
|
13
|
-
return age < 7 * 86400000 ? "好几天前" : "很久以前";
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Coarse distance in time, the way a person would say it.
|
|
17
|
-
export function agoLabel(ms) {
|
|
18
|
-
const days = Math.floor(Math.max(0, ms) / 86400000);
|
|
19
|
-
if (days < 1) return "今天";
|
|
20
|
-
if (days < 2) return "昨天";
|
|
21
|
-
if (days < 7) return `${days} 天前`;
|
|
22
|
-
if (days < 30) return `${Math.floor(days / 7)} 周前`;
|
|
23
|
-
if (days < 365) return `${Math.floor(days / 30)} 个月前`;
|
|
24
|
-
return `${Math.floor(days / 365)} 年前`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function topicWeight(
|
|
28
|
-
time,
|
|
29
|
-
now,
|
|
30
|
-
{ importance = 0, mentions = 1, open = false } = {},
|
|
31
|
-
) {
|
|
32
|
-
const halfLife = (open ? 48 : 6) * 3600000 * (1 + Math.min(1, importance));
|
|
33
|
-
return Math.min(
|
|
34
|
-
1,
|
|
35
|
-
Math.pow(0.5, Math.max(0, now - time) / halfLife) *
|
|
36
|
-
(1 + Math.min(3, mentions - 1) * 0.1),
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function timePhase(lastTime, now) {
|
|
41
|
-
if (!lastTime)
|
|
42
|
-
return {
|
|
43
|
-
key: "unfamiliar",
|
|
44
|
-
label: "还未相遇",
|
|
45
|
-
description: "还没有真实聊天,时间暂时没有可以延续的落点。",
|
|
46
|
-
};
|
|
47
|
-
const age = Math.max(0, now - lastTime);
|
|
48
|
-
if (age < 30 * 60000)
|
|
49
|
-
return {
|
|
50
|
-
key: "present",
|
|
51
|
-
label: "仍在对话里",
|
|
52
|
-
description: "刚才的语气和话题仍然清晰,适合自然接着聊。",
|
|
53
|
-
};
|
|
54
|
-
if (age < 3 * 3600000)
|
|
55
|
-
return {
|
|
56
|
-
key: "afterglow",
|
|
57
|
-
label: "留有余韵",
|
|
58
|
-
description: "聊天刚安静下来,刚才没说完的事还会留在注意里。",
|
|
59
|
-
};
|
|
60
|
-
if (age < 12 * 3600000)
|
|
61
|
-
return {
|
|
62
|
-
key: "settled",
|
|
63
|
-
label: "各自生活",
|
|
64
|
-
description: "注意力已经离开即时对话,但重要的事仍可能被想起。",
|
|
65
|
-
};
|
|
66
|
-
if (age < 2 * 86400000)
|
|
67
|
-
return {
|
|
68
|
-
key: "quiet",
|
|
69
|
-
label: "安静了一阵",
|
|
70
|
-
description: "旧话题正在降温,未完成的事情比普通闲聊更容易被想起。",
|
|
71
|
-
};
|
|
72
|
-
if (age < 7 * 86400000)
|
|
73
|
-
return {
|
|
74
|
-
key: "remembering",
|
|
75
|
-
label: "偶尔想起",
|
|
76
|
-
description: "相隔已有几天,熟悉感还在,但重新开口需要具体缘由。",
|
|
77
|
-
};
|
|
78
|
-
return {
|
|
79
|
-
key: "reunion",
|
|
80
|
-
label: "等待重逢",
|
|
81
|
-
description: "已经隔了很久,旧事只保留为背景,新的消息会成为新的相遇。",
|
|
82
|
-
};
|
|
83
|
-
}
|
|
1
|
+
import { localClock } from "../core/conversation-cues.js";
|
|
2
|
+
|
|
3
|
+
export const JUST_NOW = 5 * 60000;
|
|
4
|
+
|
|
5
|
+
export function elapsedLabel(time, now, zone = "Asia/Shanghai") {
|
|
6
|
+
const age = Math.max(0, now - time);
|
|
7
|
+
if (age < JUST_NOW) return "刚才";
|
|
8
|
+
const day = localClock(time, zone).local.slice(0, 10);
|
|
9
|
+
const today = localClock(now, zone).local.slice(0, 10);
|
|
10
|
+
if (day === today) return "今天早些时候";
|
|
11
|
+
if (day === localClock(now - 86400000, zone).local.slice(0, 10))
|
|
12
|
+
return "昨天";
|
|
13
|
+
return age < 7 * 86400000 ? "好几天前" : "很久以前";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Coarse distance in time, the way a person would say it.
|
|
17
|
+
export function agoLabel(ms) {
|
|
18
|
+
const days = Math.floor(Math.max(0, ms) / 86400000);
|
|
19
|
+
if (days < 1) return "今天";
|
|
20
|
+
if (days < 2) return "昨天";
|
|
21
|
+
if (days < 7) return `${days} 天前`;
|
|
22
|
+
if (days < 30) return `${Math.floor(days / 7)} 周前`;
|
|
23
|
+
if (days < 365) return `${Math.floor(days / 30)} 个月前`;
|
|
24
|
+
return `${Math.floor(days / 365)} 年前`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function topicWeight(
|
|
28
|
+
time,
|
|
29
|
+
now,
|
|
30
|
+
{ importance = 0, mentions = 1, open = false } = {},
|
|
31
|
+
) {
|
|
32
|
+
const halfLife = (open ? 48 : 6) * 3600000 * (1 + Math.min(1, importance));
|
|
33
|
+
return Math.min(
|
|
34
|
+
1,
|
|
35
|
+
Math.pow(0.5, Math.max(0, now - time) / halfLife) *
|
|
36
|
+
(1 + Math.min(3, mentions - 1) * 0.1),
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function timePhase(lastTime, now) {
|
|
41
|
+
if (!lastTime)
|
|
42
|
+
return {
|
|
43
|
+
key: "unfamiliar",
|
|
44
|
+
label: "还未相遇",
|
|
45
|
+
description: "还没有真实聊天,时间暂时没有可以延续的落点。",
|
|
46
|
+
};
|
|
47
|
+
const age = Math.max(0, now - lastTime);
|
|
48
|
+
if (age < 30 * 60000)
|
|
49
|
+
return {
|
|
50
|
+
key: "present",
|
|
51
|
+
label: "仍在对话里",
|
|
52
|
+
description: "刚才的语气和话题仍然清晰,适合自然接着聊。",
|
|
53
|
+
};
|
|
54
|
+
if (age < 3 * 3600000)
|
|
55
|
+
return {
|
|
56
|
+
key: "afterglow",
|
|
57
|
+
label: "留有余韵",
|
|
58
|
+
description: "聊天刚安静下来,刚才没说完的事还会留在注意里。",
|
|
59
|
+
};
|
|
60
|
+
if (age < 12 * 3600000)
|
|
61
|
+
return {
|
|
62
|
+
key: "settled",
|
|
63
|
+
label: "各自生活",
|
|
64
|
+
description: "注意力已经离开即时对话,但重要的事仍可能被想起。",
|
|
65
|
+
};
|
|
66
|
+
if (age < 2 * 86400000)
|
|
67
|
+
return {
|
|
68
|
+
key: "quiet",
|
|
69
|
+
label: "安静了一阵",
|
|
70
|
+
description: "旧话题正在降温,未完成的事情比普通闲聊更容易被想起。",
|
|
71
|
+
};
|
|
72
|
+
if (age < 7 * 86400000)
|
|
73
|
+
return {
|
|
74
|
+
key: "remembering",
|
|
75
|
+
label: "偶尔想起",
|
|
76
|
+
description: "相隔已有几天,熟悉感还在,但重新开口需要具体缘由。",
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
key: "reunion",
|
|
80
|
+
label: "等待重逢",
|
|
81
|
+
description: "已经隔了很久,旧事只保留为背景,新的消息会成为新的相遇。",
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -7,7 +7,7 @@ export const MIND_CONTEXT_TOKEN_CAP = 6000;
|
|
|
7
7
|
// speakers is not invented by concatenating the room's words.
|
|
8
8
|
export function relevantContext(
|
|
9
9
|
rows,
|
|
10
|
-
{ cues = [], limit, pinned = () => false } = {},
|
|
10
|
+
{ cues = [], limit, pinned = () => false, requireOverlap = false } = {},
|
|
11
11
|
) {
|
|
12
12
|
const score = (row) => {
|
|
13
13
|
const terms = interestTerms([row.content]);
|
|
@@ -15,9 +15,16 @@ export function relevantContext(
|
|
|
15
15
|
0,
|
|
16
16
|
...cues.map((cue) => [...terms].filter((term) => cue.has(term)).length),
|
|
17
17
|
);
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const named = cues.some((cue) =>
|
|
19
|
+
[...terms].some((term) => /^[a-z0-9]{3,}$/.test(term) && cue.has(term)),
|
|
20
20
|
);
|
|
21
|
+
return {
|
|
22
|
+
overlap,
|
|
23
|
+
named,
|
|
24
|
+
value:
|
|
25
|
+
overlap * 4 +
|
|
26
|
+
Number(row.salience ?? row.importance ?? row.strength ?? 0),
|
|
27
|
+
};
|
|
21
28
|
};
|
|
22
29
|
const fixed = rows.filter(pinned).slice(0, limit);
|
|
23
30
|
return [
|
|
@@ -25,7 +32,11 @@ export function relevantContext(
|
|
|
25
32
|
...rows
|
|
26
33
|
.filter((row) => !fixed.includes(row))
|
|
27
34
|
.map((row, order) => ({ row, order, score: score(row) }))
|
|
28
|
-
.
|
|
35
|
+
.filter(
|
|
36
|
+
(item) =>
|
|
37
|
+
!requireOverlap || item.score.overlap >= 2 || item.score.named,
|
|
38
|
+
)
|
|
39
|
+
.sort((a, b) => b.score.value - a.score.value || a.order - b.order)
|
|
29
40
|
.slice(0, limit - fixed.length)
|
|
30
41
|
.map((item) => item.row),
|
|
31
42
|
];
|
|
@@ -40,6 +51,7 @@ export function boundMindContext(view, cap = MIND_CONTEXT_TOKEN_CAP) {
|
|
|
40
51
|
[view.self, "lastDiary"],
|
|
41
52
|
[view.inner, "reminded"],
|
|
42
53
|
[view.inner, "onMind"],
|
|
54
|
+
[view.inner, "relatedSelf"],
|
|
43
55
|
[view.inner, "with"],
|
|
44
56
|
[view.inner, "stood"],
|
|
45
57
|
[view.inner, "heard"],
|