koishi-plugin-chatluna-affinity 0.3.0-alpha.3 → 0.3.0-beta.2
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/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/lib/index.d.ts +40 -20
- package/lib/index.js +62 -70
- package/package.json +6 -6
- package/readme.md +26 -95
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { openBlock as p, createElementBlock as f, createElementVNode as _, defineComponent as k, Fragment as C, renderList as D, normalizeClass as m, toDisplayString as X, reactive as N, computed as $, onUnmounted as x, ref as L, onMounted as Y, normalizeStyle as z, unref as y, createVNode as w, withModifiers as S, inject as I, createBlock as R, createCommentVNode as A } from "vue";
|
|
2
2
|
const v = (c, e) => {
|
|
3
3
|
const t = c.__vccOpts || c;
|
|
4
4
|
for (const [n, l] of e)
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";._item_1m2kp_1{padding:8px 16px;font-size:13px;color:var(--k-text-normal);cursor:pointer;transition:all .2s ease;white-space:nowrap;border-radius:9999px;margin:4px 0;background:transparent}._item_1m2kp_1:hover{background:#0000000f;color:var(--k-text-active)}._item_1m2kp_1._active_1m2kp_16{color:#fff;background:var(--k-color-primary);font-weight:500}._container_pbgsl_2{position:absolute;z-index:1000;width:140px;max-width:90vw;max-height:70vh;background:transparent;display:flex;flex-direction:column;font-family:Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,微软雅黑,Arial,sans-serif;-webkit-user-select:none;user-select:none;overflow:visible}@media
|
|
1
|
+
@charset "UTF-8";._item_1m2kp_1{padding:8px 16px;font-size:13px;color:var(--k-text-normal);cursor:pointer;transition:all .2s ease;white-space:nowrap;border-radius:9999px;margin:4px 0;background:transparent}._item_1m2kp_1:hover{background:#0000000f;color:var(--k-text-active)}._item_1m2kp_1._active_1m2kp_16{color:#fff;background:var(--k-color-primary);font-weight:500}._container_pbgsl_2{position:absolute;z-index:1000;width:140px;max-width:90vw;max-height:70vh;background:transparent;display:flex;flex-direction:column;font-family:Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,微软雅黑,Arial,sans-serif;-webkit-user-select:none;user-select:none;overflow:visible}@media(max-width:768px){._container_pbgsl_2{width:120px;max-height:50vh}}._container_pbgsl_2 ._header_pbgsl_21{padding:6px 10px;display:flex;justify-content:space-between;align-items:center;cursor:move;background:#ffffffd9;border-radius:20px;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);margin-bottom:8px;box-shadow:0 2px 8px #00000014}._container_pbgsl_2 ._header_pbgsl_21:hover{background:#fffffff2}._container_pbgsl_2 ._header_pbgsl_21 ._move_pbgsl_36{color:var(--k-text-light);cursor:grab;transition:color .2s}._container_pbgsl_2 ._header_pbgsl_21 ._move_pbgsl_36:active{cursor:grabbing;color:var(--k-color-primary)}._container_pbgsl_2 ._header_pbgsl_21 ._toggle_pbgsl_45{cursor:pointer;color:var(--k-text-light);transition:transform .3s ease,color .2s;display:flex;align-items:center;padding:2px}._container_pbgsl_2 ._header_pbgsl_21 ._toggle_pbgsl_45:hover{color:var(--k-color-primary)}._container_pbgsl_2 ._body_pbgsl_56{overflow-y:auto;padding:4px 0;transition:max-height .3s ease,opacity .3s ease;opacity:1;scrollbar-width:none;-ms-overflow-style:none}._container_pbgsl_2 ._body_pbgsl_56::-webkit-scrollbar{display:none}._container_pbgsl_2._collapsed_pbgsl_67{max-height:40px!important}._container_pbgsl_2._collapsed_pbgsl_67 ._body_pbgsl_56{max-height:0;padding:0;opacity:0;overflow:hidden}._container_pbgsl_2._collapsed_pbgsl_67 ._toggle_pbgsl_45{transform:rotate(180deg)}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as koishi from 'koishi';
|
|
2
2
|
import { Schema, Session, Context } from 'koishi';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -8,7 +8,6 @@ import { Schema, Session, Context } from 'koishi';
|
|
|
8
8
|
|
|
9
9
|
declare const AffinitySchema: Schema<Schemastery.ObjectS<{
|
|
10
10
|
affinityEnabled: Schema<boolean, boolean>;
|
|
11
|
-
affinityDisplayRange: Schema<number, number>;
|
|
12
11
|
initialAffinity: Schema<number, number>;
|
|
13
12
|
affinityDynamics: Schema<Schemastery.ObjectS<{
|
|
14
13
|
shortTerm: Schema<Schemastery.ObjectS<{
|
|
@@ -90,7 +89,6 @@ declare const AffinitySchema: Schema<Schemastery.ObjectS<{
|
|
|
90
89
|
rankDefaultLimit: Schema<number, number>;
|
|
91
90
|
}>, Schemastery.ObjectT<{
|
|
92
91
|
affinityEnabled: Schema<boolean, boolean>;
|
|
93
|
-
affinityDisplayRange: Schema<number, number>;
|
|
94
92
|
initialAffinity: Schema<number, number>;
|
|
95
93
|
affinityDynamics: Schema<Schemastery.ObjectS<{
|
|
96
94
|
shortTerm: Schema<Schemastery.ObjectS<{
|
|
@@ -194,7 +192,7 @@ declare const RelationshipSchema: Schema<Schemastery.ObjectS<{
|
|
|
194
192
|
userId?: string | null | undefined;
|
|
195
193
|
relation?: string | null | undefined;
|
|
196
194
|
note?: string | null | undefined;
|
|
197
|
-
} &
|
|
195
|
+
} & koishi.Dict)[], Schemastery.ObjectT<{
|
|
198
196
|
userId: Schema<string, string>;
|
|
199
197
|
relation: Schema<string, string>;
|
|
200
198
|
note: Schema<string, string>;
|
|
@@ -204,7 +202,7 @@ declare const RelationshipSchema: Schema<Schemastery.ObjectS<{
|
|
|
204
202
|
max?: number | null | undefined;
|
|
205
203
|
relation?: string | null | undefined;
|
|
206
204
|
note?: string | null | undefined;
|
|
207
|
-
} &
|
|
205
|
+
} & koishi.Dict)[], Schemastery.ObjectT<{
|
|
208
206
|
min: Schema<number, number>;
|
|
209
207
|
max: Schema<number, number>;
|
|
210
208
|
relation: Schema<string, string>;
|
|
@@ -215,7 +213,7 @@ declare const RelationshipSchema: Schema<Schemastery.ObjectS<{
|
|
|
215
213
|
userId?: string | null | undefined;
|
|
216
214
|
relation?: string | null | undefined;
|
|
217
215
|
note?: string | null | undefined;
|
|
218
|
-
} &
|
|
216
|
+
} & koishi.Dict)[], Schemastery.ObjectT<{
|
|
219
217
|
userId: Schema<string, string>;
|
|
220
218
|
relation: Schema<string, string>;
|
|
221
219
|
note: Schema<string, string>;
|
|
@@ -225,7 +223,7 @@ declare const RelationshipSchema: Schema<Schemastery.ObjectS<{
|
|
|
225
223
|
max?: number | null | undefined;
|
|
226
224
|
relation?: string | null | undefined;
|
|
227
225
|
note?: string | null | undefined;
|
|
228
|
-
} &
|
|
226
|
+
} & koishi.Dict)[], Schemastery.ObjectT<{
|
|
229
227
|
min: Schema<number, number>;
|
|
230
228
|
max: Schema<number, number>;
|
|
231
229
|
relation: Schema<string, string>;
|
|
@@ -261,7 +259,6 @@ declare const inject: {
|
|
|
261
259
|
};
|
|
262
260
|
declare const ConfigSchema: Schema<{
|
|
263
261
|
affinityEnabled?: boolean | null | undefined;
|
|
264
|
-
affinityDisplayRange?: number | null | undefined;
|
|
265
262
|
initialAffinity?: number | null | undefined;
|
|
266
263
|
affinityDynamics?: ({
|
|
267
264
|
shortTerm?: ({
|
|
@@ -269,24 +266,24 @@ declare const ConfigSchema: Schema<{
|
|
|
269
266
|
demoteThreshold?: number | null | undefined;
|
|
270
267
|
longTermPromoteStep?: number | null | undefined;
|
|
271
268
|
longTermDemoteStep?: number | null | undefined;
|
|
272
|
-
} &
|
|
269
|
+
} & koishi.Dict) | null | undefined;
|
|
273
270
|
actionWindow?: ({
|
|
274
271
|
windowHours?: number | null | undefined;
|
|
275
272
|
increaseBonus?: number | null | undefined;
|
|
276
273
|
decreaseBonus?: number | null | undefined;
|
|
277
274
|
bonusChatThreshold?: number | null | undefined;
|
|
278
275
|
maxEntries?: number | null | undefined;
|
|
279
|
-
} &
|
|
276
|
+
} & koishi.Dict) | null | undefined;
|
|
280
277
|
coefficient?: ({
|
|
281
278
|
base?: number | null | undefined;
|
|
282
279
|
maxDrop?: number | null | undefined;
|
|
283
280
|
maxBoost?: number | null | undefined;
|
|
284
281
|
decayPerDay?: number | null | undefined;
|
|
285
282
|
boostPerDay?: number | null | undefined;
|
|
286
|
-
} &
|
|
287
|
-
} &
|
|
283
|
+
} & koishi.Dict) | null | undefined;
|
|
284
|
+
} & koishi.Dict) | null | undefined;
|
|
288
285
|
rankDefaultLimit?: number | null | undefined;
|
|
289
|
-
} &
|
|
286
|
+
} & koishi.Dict & {
|
|
290
287
|
blacklistLogInterception?: boolean | null | undefined;
|
|
291
288
|
shortTermBlacklistPenalty?: number | null | undefined;
|
|
292
289
|
unblockPermanentInitialAffinity?: number | null | undefined;
|
|
@@ -296,13 +293,13 @@ declare const ConfigSchema: Schema<{
|
|
|
296
293
|
userId?: string | null | undefined;
|
|
297
294
|
relation?: string | null | undefined;
|
|
298
295
|
note?: string | null | undefined;
|
|
299
|
-
} &
|
|
296
|
+
} & koishi.Dict)[] | null | undefined;
|
|
300
297
|
relationshipAffinityLevels?: ({
|
|
301
298
|
min?: number | null | undefined;
|
|
302
299
|
max?: number | null | undefined;
|
|
303
300
|
relation?: string | null | undefined;
|
|
304
301
|
note?: string | null | undefined;
|
|
305
|
-
} &
|
|
302
|
+
} & koishi.Dict)[] | null | undefined;
|
|
306
303
|
} & {
|
|
307
304
|
scopeId?: string | null | undefined;
|
|
308
305
|
botSelfIds?: string[] | null | undefined;
|
|
@@ -314,6 +311,7 @@ declare const ConfigSchema: Schema<{
|
|
|
314
311
|
characterPromptTemplate?: string | null | undefined;
|
|
315
312
|
} & {
|
|
316
313
|
affinityVariableName?: string | null | undefined;
|
|
314
|
+
affinityDisplayRange?: number | null | undefined;
|
|
317
315
|
relationshipLevelVariableName?: string | null | undefined;
|
|
318
316
|
blacklistListVariableName?: string | null | undefined;
|
|
319
317
|
} & {
|
|
@@ -325,7 +323,6 @@ declare const ConfigSchema: Schema<{
|
|
|
325
323
|
debugLogging?: boolean | null | undefined;
|
|
326
324
|
}, {
|
|
327
325
|
affinityEnabled: boolean;
|
|
328
|
-
affinityDisplayRange: number;
|
|
329
326
|
initialAffinity: number;
|
|
330
327
|
affinityDynamics: Schemastery.ObjectT<{
|
|
331
328
|
shortTerm: Schema<Schemastery.ObjectS<{
|
|
@@ -367,7 +364,7 @@ declare const ConfigSchema: Schema<{
|
|
|
367
364
|
}>>;
|
|
368
365
|
}>;
|
|
369
366
|
rankDefaultLimit: number;
|
|
370
|
-
} &
|
|
367
|
+
} & koishi.Dict & {
|
|
371
368
|
blacklistLogInterception: boolean;
|
|
372
369
|
shortTermBlacklistPenalty: number;
|
|
373
370
|
unblockPermanentInitialAffinity: number;
|
|
@@ -395,6 +392,7 @@ declare const ConfigSchema: Schema<{
|
|
|
395
392
|
characterPromptTemplate: string;
|
|
396
393
|
} & {
|
|
397
394
|
affinityVariableName: string;
|
|
395
|
+
affinityDisplayRange: number;
|
|
398
396
|
relationshipLevelVariableName: string;
|
|
399
397
|
blacklistListVariableName: string;
|
|
400
398
|
} & {
|
|
@@ -729,7 +727,7 @@ interface Config {
|
|
|
729
727
|
affinityEnabled: boolean;
|
|
730
728
|
affinityDisplayRange: number;
|
|
731
729
|
initialAffinity: number;
|
|
732
|
-
affinityDynamics
|
|
730
|
+
affinityDynamics?: AffinityDynamicsConfig;
|
|
733
731
|
blacklistLogInterception: boolean;
|
|
734
732
|
shortTermBlacklistPenalty: number;
|
|
735
733
|
unblockPermanentInitialAffinity: number;
|
|
@@ -819,6 +817,28 @@ declare const FETCH_CONSTANTS: {
|
|
|
819
817
|
declare const BASE_AFFINITY_DEFAULTS: {
|
|
820
818
|
readonly initialAffinity: 30;
|
|
821
819
|
};
|
|
820
|
+
declare const AFFINITY_DYNAMICS_DEFAULTS: {
|
|
821
|
+
readonly shortTerm: {
|
|
822
|
+
readonly promoteThreshold: 15;
|
|
823
|
+
readonly demoteThreshold: -10;
|
|
824
|
+
readonly longTermPromoteStep: 3;
|
|
825
|
+
readonly longTermDemoteStep: 5;
|
|
826
|
+
};
|
|
827
|
+
readonly actionWindow: {
|
|
828
|
+
readonly windowHours: 24;
|
|
829
|
+
readonly increaseBonus: 2;
|
|
830
|
+
readonly decreaseBonus: 2;
|
|
831
|
+
readonly bonusChatThreshold: 10;
|
|
832
|
+
readonly maxEntries: 80;
|
|
833
|
+
};
|
|
834
|
+
readonly coefficient: {
|
|
835
|
+
readonly base: 1;
|
|
836
|
+
readonly maxDrop: 0.3;
|
|
837
|
+
readonly maxBoost: 0.3;
|
|
838
|
+
readonly decayPerDay: 0.05;
|
|
839
|
+
readonly boostPerDay: 0.05;
|
|
840
|
+
};
|
|
841
|
+
};
|
|
822
842
|
|
|
823
843
|
/**
|
|
824
844
|
* 提示词模板常量
|
|
@@ -1764,6 +1784,6 @@ declare function callOneBotAPI(internal: OneBotInternal, action: string, params:
|
|
|
1764
1784
|
* 导出插件元信息和 apply 函数
|
|
1765
1785
|
*/
|
|
1766
1786
|
|
|
1767
|
-
declare const usage = "\n## \u66F4\u65B0\u65E5\u5FD7\n\n0.3.0-
|
|
1787
|
+
declare const usage = "\n## \u66F4\u65B0\u65E5\u5FD7\n\n0.3.0-beta\n\n### \u91CD\u6784\n- \u5F15\u5165 `scopeId` \u4F5C\u4E3A\u65B0\u7684\u6838\u5FC3\u4F5C\u7528\u57DF\u8BED\u4E49\uFF1B\u6570\u636E\u9694\u79BB\u4ECE\u65E7\u7248\u6309 bot / \u65E7\u4E3B\u952E\u5207\u6362\u4E3A\u6309 `scopeId` \u9694\u79BB\u3002\n- \u5355\u4E2A\u5B9E\u4F8B\u5185\u7684\u591A\u4E2A bot \u73B0\u5728\u5171\u4EAB\u540C\u4E00\u4EFD `scopeId` \u6570\u636E\uFF1B\u5171\u4EAB\u8303\u56F4\u8986\u76D6\u597D\u611F\u5EA6\u3001\u9ED1\u540D\u5355\u3001\u7279\u6B8A\u5173\u7CFB\u4E0E\u6635\u79F0\u3002\n- \u6570\u636E\u5E93\u6A21\u578B\u5347\u7EA7\u4E3A v2\uFF1A\n - `chatluna_affinity` -> `chatluna_affinity_v2`\n - `chatluna_blacklist` -> `chatluna_blacklist_v2`\n - `chatluna_user_alias` -> `chatluna_user_alias_v2`\n- \u65B0\u589E\u6570\u636E\u5E93\u8FC1\u79FB\u670D\u52A1\u4E0E\u8FC1\u79FB\u8BB0\u5F55\u8868\uFF0C\u542F\u52A8\u65F6\u4F1A\u81EA\u52A8\u5C06\u65E7\u8868\u8FC1\u79FB\u5230 v2 \u7ED3\u6784\u3002\n- \u597D\u611F\u5EA6\u3001\u9ED1\u540D\u5355\u4E0E\u6A21\u578B\u54CD\u5E94\u5904\u7406\u94FE\u8DEF\u91CD\u6784\u4E3A\u66F4\u6E05\u6670\u7684\u670D\u52A1\u5316\u7ED3\u6784\u3002\n\n### \u65B0\u589E\n- \u65B0\u589E `scopeId` \u914D\u7F6E\uFF1B\u5F53\u524D\u7248\u672C\u6309 `scopeId` \u533A\u5206\u6570\u636E\uFF0C\u4E0D\u540C\u5B9E\u4F8B\u4E4B\u95F4\u5B8C\u5168\u9694\u79BB\u3002\n- \u65B0\u589E `botSelfIds` \u914D\u7F6E\uFF0C\u7528\u4E8E\u58F0\u660E\u54EA\u4E9B bot \u5F52\u5C5E\u5F53\u524D `scopeId`\uFF1B\u540C\u4E00 `scopeId` \u4E0B\u591A\u4E2A bot \u5171\u4EAB\u6570\u636E\uFF0C\u7528\u4E8E\u9996\u6B21\u4E92\u52A8\u521D\u59CB\u5316\u597D\u611F\u5EA6\u3002\n- \u65B0\u589E\u4F5C\u7528\u57DF\u5316\u547D\u4EE4\u524D\u7F00\uFF0C\u547D\u4EE4\u7531\u56FA\u5B9A `affinity.*` \u6539\u4E3A `${scopeId}.*`\u3002\n- \u65B0\u589E\u6C38\u4E45\u9ED1\u540D\u5355\u89E3\u9664\u540E\u7684\u597D\u611F\u5EA6\u91CD\u7F6E\u903B\u8F91\uFF1B\u89E3\u9664\u540E\u4F1A\u540C\u65F6\u91CD\u7F6E\u597D\u611F\u5EA6\u76F8\u5173\u72B6\u6001\u3002\n- \u65B0\u589E\u4F5C\u7528\u57DF\u5316\u53D8\u91CF\u8C03\u7528\u8981\u6C42\uFF0C\u53D8\u91CF\u73B0\u5728\u9700\u8981\u663E\u5F0F\u4F20\u5165 `scopeId`\u3002\n\n### \u4FEE\u6539\n- \u597D\u611F\u5EA6\u3001\u9ED1\u540D\u5355\u3001\u6635\u79F0\u6570\u636E\u7684\u5199\u5165\u4E0E\u8BFB\u53D6\u4E3B\u952E\u8BED\u4E49\u6539\u4E3A\u4EE5 `scopeId` \u4E3A\u6838\u5FC3\uFF1A\n - \u597D\u611F\u5EA6\uFF1A`scopeId + userId`\n - \u9ED1\u540D\u5355\uFF1A`scopeId + userId + mode`\n - \u7528\u6237\u6635\u79F0\uFF1A`scopeId + userId`\n- \u591A bot \u5171\u4EAB\u65B9\u6848\u4ECE\u65E7\u7248\u5206\u7EC4\u914D\u7F6E\u6539\u4E3A\u7EDF\u4E00\u7684 `scopeId` \u8BED\u4E49\u3002\n- \u597D\u611F\u5EA6\u521D\u59CB\u5316\u65F6\u673A\u6539\u4E3A\u201C\u4E0E bot \u9996\u6B21\u6709\u6548\u4EA4\u4E92\u65F6\u5165\u5E93\u201D\uFF0C\u4E0D\u518D\u5728\u6536\u5230\u6D88\u606F\u65F6\u63D0\u524D\u521D\u59CB\u5316\u3002\n- \u968F\u673A\u521D\u59CB\u597D\u611F\u5EA6\u6539\u4E3A\u56FA\u5B9A\u521D\u59CB\u597D\u611F\u5EA6\uFF0C\u9ED8\u8BA4\u503C\u4E3A `30`\u3002\n- `userAlias` \u7684\u6635\u79F0\u4FE1\u606F\u5DF2\u878D\u5165 `affinity` \u53D8\u91CF\u8F93\u51FA\uFF1B\u5F53\u524D\u8F93\u51FA\u5F62\u6001\u4E3A `id name nickname affinity relationship`\u3002\n- \u5BF9\u4E8E\u5C1A\u672A\u4E0E bot \u4EA7\u751F\u6709\u6548\u4E92\u52A8\u7684\u7528\u6237\uFF0C`affinity` \u53D8\u91CF\u73B0\u5728\u4F1A\u76F4\u63A5\u663E\u793A\u9ED8\u8BA4\u597D\u611F\u5EA6\uFF0C\u4EE5\u53CA\u8BE5\u9ED8\u8BA4\u503C\u5BF9\u5E94\u7684\u5173\u7CFB\u3002\n- \u5173\u7CFB\u533A\u95F4\u53D8\u91CF\u540D\u7531 `relationshipAffinityLevel` \u7B80\u5316\u4E3A `relationshipLevel`\u3002\n- \u6240\u6709\u53D8\u91CF\u73B0\u5728\u90FD\u9700\u8981\u663E\u5F0F\u4F20\u5165 `scopeId`\uFF0C\u4F8B\u5982\uFF1A\n - `relationshipLevel(scopeId)`\n - `affinity(scopeId)`\n - `blacklistList(scopeId)`\n- XML \u5DE5\u5177\u8C03\u7528\u53C2\u6570\u6539\u4E3A\u663E\u5F0F\u4F5C\u7528\u57DF\u98CE\u683C\uFF0C\u6838\u5FC3\u5B57\u6BB5\u7EDF\u4E00\u4E3A `scopeId + userId`\u3002\n- `scopeId` \u4F1A\u76F4\u63A5\u4F5C\u4E3A\u6307\u4EE4\u524D\u7F00\uFF1B\u4E0D\u8981\u4F7F\u7528\u4E0E bot \u540D\u79F0\u76F8\u540C\u7684 `scopeId`\uFF0C\u5EFA\u8BAE\u4F18\u5148\u4F7F\u7528\u82F1\u6587\u3002\n- \u65E5\u7A0B\u3001\u5929\u6C14\u80FD\u529B\u62C6\u5206\u81F3 `koishi-plugin-chatluna-schedule`\u3002\n- \u66F4\u591A\u53D8\u91CF\u4E0E XML \u5DE5\u5177\u80FD\u529B\u62C6\u5206\u81F3 `koishi-plugin-chatluna-toolbox`\u3002\n\n### \u5220\u9664\n- \u5220\u9664 ChatLuna \u539F\u751F\u5DE5\u5177\u6CE8\u518C\u80FD\u529B\uFF0C\u5F53\u524D\u7248\u672C\u4E0D\u518D\u63D0\u4F9B\u539F\u751F\u5DE5\u5177\u3002\n- \u5220\u9664\u65E7\u7248 `affinityGroups` \u5171\u4EAB\u5206\u7EC4\u914D\u7F6E\u3002\n- \u5220\u9664\u56FA\u5B9A\u547D\u4EE4\u524D\u7F00 `affinity.*` \u7684\u547D\u540D\u65B9\u5F0F\u3002\n- \u5220\u9664 `relationshipAffinityLevel` \u65E7\u547D\u540D\u3002\n- \u5220\u9664\u4EE5\u4E0B\u52A8\u6001\u914D\u7F6E\u9879\uFF1A\n - \u5355\u6B21\u589E\u52A0\u7684\u77ED\u671F\u597D\u611F\u6700\u5927\u5E45\u5EA6\n - \u5355\u6B21\u51CF\u5C11\u7684\u77ED\u671F\u597D\u611F\u6700\u5927\u5E45\u5EA6\n - \u5141\u8BB8\u989D\u5916\u589E\u51CF\u7A81\u7834\u5355\u6B21\u4E0A\u9650\n- `userAlias` \u4E0D\u518D\u4F5C\u4E3A\u72EC\u7ACB\u53D8\u91CF\u66B4\u9732\uFF1B\u6635\u79F0\u80FD\u529B\u4FDD\u7559\u5728 XML \u4E0E `affinity` \u53D8\u91CF\u8F93\u51FA\u4E2D\u3002\n\n### \u517C\u5BB9\u6027\u63D0\u9192\n- \u8FD9\u662F\u4E00\u6B21\u5E26\u6709\u7834\u574F\u6027\u517C\u5BB9\u53D8\u66F4\u7684\u91CD\u6784\u5347\u7EA7\uFF1B\u65E7\u547D\u4EE4\u3001\u65E7 XML \u53C2\u6570\u548C\u65E7\u53D8\u91CF\u8C03\u7528\u65B9\u5F0F\u90FD\u9700\u8981\u540C\u6B65\u8C03\u6574\u3002\n- \u8FC1\u79FB\u4F1A\u628A\u65E7\u6570\u636E\u6574\u4F53\u5F52\u5165\u5F53\u524D\u5B9E\u4F8B\u7684 `scopeId`\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u62C6\u5206\u4E3A\u591A\u4E2A\u4F5C\u7528\u57DF\u3002\n";
|
|
1768
1788
|
|
|
1769
|
-
export { ACTION_WINDOW_DEFAULTS, AFFINITY_DEFAULTS, ALL_MEMBER_INFO_ITEMS, type ActionCounts, type ActionEntry, type ActionStats, type ActionType, type ActionWindowConfig, type AffinityCache, type AffinityDynamicsConfig, type AffinityProvider, type AffinityProviderDeps, type AffinityRecord, AffinitySchema, type AffinityState, type AffinityStore, type AffinityStoreOptions, type ApplyAffinityDeltaParams, type ApplyAffinityDeltaResult, BASE_AFFINITY_DEFAULTS, BLACKLIST_MODEL_NAME, BLACKLIST_MODEL_NAME_V2, BLACKLIST_REPLY_TEMPLATE, type BlacklistCommandDeps, type BlacklistDetail, type BlacklistEnrichedItem, type BlacklistEntry, type BlacklistGuard, type BlacklistGuardOptions, type BlacklistItem, type BlacklistListProvider, type BlacklistListProviderDeps, type BlacklistMode, type BlacklistRecord, type BlacklistRenderer, BlacklistSchema, type BlacklistService, type BlacklistServiceOptions, type BlockCommandDeps, CLOUD_TYPES, COEFFICIENT_DEFAULTS, COMMON_STYLE, type CharacterTempModelResponseRuntime, type CharacterTempModelResponseRuntimeParams, type ClampFn, type CoefficientConfig, type CoefficientResult, type CoefficientState, type CombinedState, type CommandDependencies, ConfigSchema as Config, ConfigSchema, DEFAULT_MEMBER_INFO_ITEMS, type Element, FETCH_CONSTANTS, type HistoryEntry, type InMemoryTemporaryEntry, type InitialRange, type InspectData, type InspectRenderer, type LegacyAffinityRecord, type LegacyBlacklistRecord, type LegacyUserAliasRecord, type LevelResolver, type LogFn, type LogLevel, MIGRATION_MODEL_NAME, MODEL_NAME, MODEL_NAME_V2, type ManualConfigOptions, type ManualRelationship, type ManualRelationshipManager, type MemberInfo, type MemberInfoField, type MessageHistory, type MessageHistoryOptions, type MessageStore, type MessageStoreOptions, type MigrationOptions, type MigrationRecord, type ModelResponseContext, type ModelResponseProcessorParams, type OneBotInternal, type OneBotProtocol, OtherSettingsSchema, type Page, type Puppeteer, RENDER_CONSTANTS, ROLE_MAPPING, type RankItem, type RankLineItem, type RankListRenderer, type RelationshipLevel, type RelationshipLevelProvider, type RelationshipLevelProviderDeps, RelationshipSchema, type RenderMemberInfoOptions, type RenderOptions, type RenderService, type RenderServiceOptions, type ResolvedActionWindowConfig, type ResolvedCoefficientConfig, type ResolvedShortTermConfig, type RoleMapping, type RoleTranslation, SHORT_TERM_DEFAULTS, type SaveExtra, type SessionSeed, type ShortTermConfig, type StoredMessage, type SummarizedActions, THRESHOLDS, TIME_CONSTANTS, TIMING_CONSTANTS, type TableRenderOptions, type TableRenderer, type TempBlockCommandDeps, type TemporaryBlacklistEntry, USER_ALIAS_MODEL_NAME, USER_ALIAS_MODEL_NAME_V2, type UnblockPermanentDeps, type UnblockPermanentInput, type UnblockPermanentResult, type UserAliasRecord, type UserAliasService, type UserAliasServiceOptions, type VariableSettings, type XmlToolSettings, appendActionEntry, apply, applyAffinityDelta, assertScopeId, buildScopedCommandName, callOneBotAPI, clamp, clampFloat, collectNicknameCandidates, collectRoleCandidates, composeState, computeCoefficientValue, computeDailyStreak, computeShortTermReset, createAffinityCache, createAffinityProvider, createAffinityStore, createBlacklistGuard, createBlacklistListProvider, createBlacklistRenderer, createBlacklistService, createCharacterTempModelResponseRuntime, createInspectRenderer, createLevelResolver, createLogger, createManualRelationshipManager, createMessageHistory, createMessageStore, createMigrationService, createModelResponseProcessor, createPermanentUnblockHandler, createRankListRenderer, createRelationshipLevelProvider, createRenderService, createTableRenderer, createUserAliasService, dayNumber, ensureOneBotSession, escapeHtml, escapeHtmlForRender, extendAffinityModel, extendBlacklistModel, extendMigrationModel, extendUserAliasModel, fetchGroupMemberIds, fetchMember, findMemberByName, formatActionCounts, formatBeijingTimestamp, formatDateOnly, formatDateTime, formatTimestamp, getChannelId, getDateString, getGuildId, getPlatform, getPuppeteer, getRoleDisplay, getSelfId, getTimeString, getUserId, inject, isFiniteNumber, isValidScopeId, makeUserKey, name, normalizeScopeId, normalizeTimestamp, parseSelfClosingXmlTags, pickFirst, registerAdjustCommand, registerBlacklistCommand, registerBlockCommand, registerClearAllCommand, registerInspectCommand, registerModels, registerRankCommand, registerTempBlockCommand, renderHtml, renderInfoField, renderMemberInfo, renderTemplate, resolveActionWindowConfig, resolveBotInfo, resolveCoefficientConfig, resolveGroupId, resolveRoleLabel, resolveScopedVariableArgs, resolveShortTermConfig, resolveUserIdentity, resolveUserInfo, resolveXmlScopeId, roundTo, sanitizeChannel, stripAtPrefix, summarizeActionEntries, toDate, translateGender, translateRole, truncate, usage };
|
|
1789
|
+
export { ACTION_WINDOW_DEFAULTS, AFFINITY_DEFAULTS, AFFINITY_DYNAMICS_DEFAULTS, ALL_MEMBER_INFO_ITEMS, type ActionCounts, type ActionEntry, type ActionStats, type ActionType, type ActionWindowConfig, type AffinityCache, type AffinityDynamicsConfig, type AffinityProvider, type AffinityProviderDeps, type AffinityRecord, AffinitySchema, type AffinityState, type AffinityStore, type AffinityStoreOptions, type ApplyAffinityDeltaParams, type ApplyAffinityDeltaResult, BASE_AFFINITY_DEFAULTS, BLACKLIST_MODEL_NAME, BLACKLIST_MODEL_NAME_V2, BLACKLIST_REPLY_TEMPLATE, type BlacklistCommandDeps, type BlacklistDetail, type BlacklistEnrichedItem, type BlacklistEntry, type BlacklistGuard, type BlacklistGuardOptions, type BlacklistItem, type BlacklistListProvider, type BlacklistListProviderDeps, type BlacklistMode, type BlacklistRecord, type BlacklistRenderer, BlacklistSchema, type BlacklistService, type BlacklistServiceOptions, type BlockCommandDeps, CLOUD_TYPES, COEFFICIENT_DEFAULTS, COMMON_STYLE, type CharacterTempModelResponseRuntime, type CharacterTempModelResponseRuntimeParams, type ClampFn, type CoefficientConfig, type CoefficientResult, type CoefficientState, type CombinedState, type CommandDependencies, ConfigSchema as Config, ConfigSchema, DEFAULT_MEMBER_INFO_ITEMS, type Element, FETCH_CONSTANTS, type HistoryEntry, type InMemoryTemporaryEntry, type InitialRange, type InspectData, type InspectRenderer, type LegacyAffinityRecord, type LegacyBlacklistRecord, type LegacyUserAliasRecord, type LevelResolver, type LogFn, type LogLevel, MIGRATION_MODEL_NAME, MODEL_NAME, MODEL_NAME_V2, type ManualConfigOptions, type ManualRelationship, type ManualRelationshipManager, type MemberInfo, type MemberInfoField, type MessageHistory, type MessageHistoryOptions, type MessageStore, type MessageStoreOptions, type MigrationOptions, type MigrationRecord, type ModelResponseContext, type ModelResponseProcessorParams, type OneBotInternal, type OneBotProtocol, OtherSettingsSchema, type Page, type Puppeteer, RENDER_CONSTANTS, ROLE_MAPPING, type RankItem, type RankLineItem, type RankListRenderer, type RelationshipLevel, type RelationshipLevelProvider, type RelationshipLevelProviderDeps, RelationshipSchema, type RenderMemberInfoOptions, type RenderOptions, type RenderService, type RenderServiceOptions, type ResolvedActionWindowConfig, type ResolvedCoefficientConfig, type ResolvedShortTermConfig, type RoleMapping, type RoleTranslation, SHORT_TERM_DEFAULTS, type SaveExtra, type SessionSeed, type ShortTermConfig, type StoredMessage, type SummarizedActions, THRESHOLDS, TIME_CONSTANTS, TIMING_CONSTANTS, type TableRenderOptions, type TableRenderer, type TempBlockCommandDeps, type TemporaryBlacklistEntry, USER_ALIAS_MODEL_NAME, USER_ALIAS_MODEL_NAME_V2, type UnblockPermanentDeps, type UnblockPermanentInput, type UnblockPermanentResult, type UserAliasRecord, type UserAliasService, type UserAliasServiceOptions, type VariableSettings, type XmlToolSettings, appendActionEntry, apply, applyAffinityDelta, assertScopeId, buildScopedCommandName, callOneBotAPI, clamp, clampFloat, collectNicknameCandidates, collectRoleCandidates, composeState, computeCoefficientValue, computeDailyStreak, computeShortTermReset, createAffinityCache, createAffinityProvider, createAffinityStore, createBlacklistGuard, createBlacklistListProvider, createBlacklistRenderer, createBlacklistService, createCharacterTempModelResponseRuntime, createInspectRenderer, createLevelResolver, createLogger, createManualRelationshipManager, createMessageHistory, createMessageStore, createMigrationService, createModelResponseProcessor, createPermanentUnblockHandler, createRankListRenderer, createRelationshipLevelProvider, createRenderService, createTableRenderer, createUserAliasService, dayNumber, ensureOneBotSession, escapeHtml, escapeHtmlForRender, extendAffinityModel, extendBlacklistModel, extendMigrationModel, extendUserAliasModel, fetchGroupMemberIds, fetchMember, findMemberByName, formatActionCounts, formatBeijingTimestamp, formatDateOnly, formatDateTime, formatTimestamp, getChannelId, getDateString, getGuildId, getPlatform, getPuppeteer, getRoleDisplay, getSelfId, getTimeString, getUserId, inject, isFiniteNumber, isValidScopeId, makeUserKey, name, normalizeScopeId, normalizeTimestamp, parseSelfClosingXmlTags, pickFirst, registerAdjustCommand, registerBlacklistCommand, registerBlockCommand, registerClearAllCommand, registerInspectCommand, registerModels, registerRankCommand, registerTempBlockCommand, renderHtml, renderInfoField, renderMemberInfo, renderTemplate, resolveActionWindowConfig, resolveBotInfo, resolveCoefficientConfig, resolveGroupId, resolveRoleLabel, resolveScopedVariableArgs, resolveShortTermConfig, resolveUserIdentity, resolveUserInfo, resolveXmlScopeId, roundTo, sanitizeChannel, stripAtPrefix, summarizeActionEntries, toDate, translateGender, translateRole, truncate, usage };
|
package/lib/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
ACTION_WINDOW_DEFAULTS: () => ACTION_WINDOW_DEFAULTS,
|
|
34
34
|
AFFINITY_DEFAULTS: () => AFFINITY_DEFAULTS,
|
|
35
|
+
AFFINITY_DYNAMICS_DEFAULTS: () => AFFINITY_DYNAMICS_DEFAULTS,
|
|
35
36
|
ALL_MEMBER_INFO_ITEMS: () => ALL_MEMBER_INFO_ITEMS,
|
|
36
37
|
AffinitySchema: () => AffinitySchema,
|
|
37
38
|
BASE_AFFINITY_DEFAULTS: () => BASE_AFFINITY_DEFAULTS,
|
|
@@ -231,6 +232,28 @@ var FETCH_CONSTANTS = {
|
|
|
231
232
|
var BASE_AFFINITY_DEFAULTS = {
|
|
232
233
|
initialAffinity: 30
|
|
233
234
|
};
|
|
235
|
+
var AFFINITY_DYNAMICS_DEFAULTS = {
|
|
236
|
+
shortTerm: {
|
|
237
|
+
promoteThreshold: 15,
|
|
238
|
+
demoteThreshold: -10,
|
|
239
|
+
longTermPromoteStep: 3,
|
|
240
|
+
longTermDemoteStep: 5
|
|
241
|
+
},
|
|
242
|
+
actionWindow: {
|
|
243
|
+
windowHours: 24,
|
|
244
|
+
increaseBonus: 2,
|
|
245
|
+
decreaseBonus: 2,
|
|
246
|
+
bonusChatThreshold: 10,
|
|
247
|
+
maxEntries: 80
|
|
248
|
+
},
|
|
249
|
+
coefficient: {
|
|
250
|
+
base: 1,
|
|
251
|
+
maxDrop: 0.3,
|
|
252
|
+
maxBoost: 0.3,
|
|
253
|
+
decayPerDay: 0.05,
|
|
254
|
+
boostPerDay: 0.05
|
|
255
|
+
}
|
|
256
|
+
};
|
|
234
257
|
|
|
235
258
|
// src/constants/prompts.ts
|
|
236
259
|
var BLACKLIST_REPLY_TEMPLATE = "";
|
|
@@ -308,71 +331,32 @@ var ALL_MEMBER_INFO_ITEMS = [
|
|
|
308
331
|
// src/schema/affinity.ts
|
|
309
332
|
var AffinityDynamicsSchema = import_koishi.Schema.object({
|
|
310
333
|
shortTerm: import_koishi.Schema.object({
|
|
311
|
-
promoteThreshold: import_koishi.Schema.number().default(
|
|
312
|
-
demoteThreshold: import_koishi.Schema.number().default(
|
|
313
|
-
longTermPromoteStep: import_koishi.Schema.number().default(
|
|
314
|
-
longTermDemoteStep: import_koishi.Schema.number().default(
|
|
315
|
-
}).default({
|
|
316
|
-
promoteThreshold: 15,
|
|
317
|
-
demoteThreshold: -10,
|
|
318
|
-
longTermPromoteStep: 3,
|
|
319
|
-
longTermDemoteStep: 5
|
|
334
|
+
promoteThreshold: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.shortTerm.promoteThreshold).description("\u77ED\u671F\u597D\u611F\u8FBE\u5230\u8BE5\u503C\u540E\uFF0C\u589E\u52A0\u957F\u671F\u597D\u611F"),
|
|
335
|
+
demoteThreshold: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.shortTerm.demoteThreshold).description("\u77ED\u671F\u597D\u611F\u4F4E\u4E8E\u8BE5\u503C\u540E\uFF0C\u51CF\u5C11\u957F\u671F\u597D\u611F"),
|
|
336
|
+
longTermPromoteStep: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.shortTerm.longTermPromoteStep).min(1).description("\u6BCF\u6B21\u589E\u52A0\u7684\u957F\u671F\u597D\u611F\u503C"),
|
|
337
|
+
longTermDemoteStep: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.shortTerm.longTermDemoteStep).min(1).description("\u6BCF\u6B21\u51CF\u5C11\u7684\u957F\u671F\u597D\u611F\u503C")
|
|
320
338
|
}).description("\u77ED\u671F\u4E0E\u957F\u671F\u597D\u611F\u8BBE\u7F6E").collapse(),
|
|
321
339
|
actionWindow: import_koishi.Schema.object({
|
|
322
|
-
windowHours: import_koishi.Schema.number().default(
|
|
323
|
-
increaseBonus: import_koishi.Schema.number().default(
|
|
324
|
-
decreaseBonus: import_koishi.Schema.number().default(
|
|
325
|
-
bonusChatThreshold: import_koishi.Schema.number().default(
|
|
326
|
-
maxEntries: import_koishi.Schema.number().default(
|
|
327
|
-
}).default({
|
|
328
|
-
windowHours: 24,
|
|
329
|
-
increaseBonus: 2,
|
|
330
|
-
decreaseBonus: 2,
|
|
331
|
-
bonusChatThreshold: 10,
|
|
332
|
-
maxEntries: 80
|
|
340
|
+
windowHours: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.actionWindow.windowHours).min(1).description("\u7EDF\u8BA1\u8FD1\u671F\u4E92\u52A8\u7684\u65F6\u95F4\u7A97\u53E3\uFF0C\u5355\u4F4D\u4E3A\u5C0F\u65F6"),
|
|
341
|
+
increaseBonus: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.actionWindow.increaseBonus).description("\u5F53\u8FD1\u671F\u6B63\u5411\u4E92\u52A8\u5360\u4F18\u65F6\uFF0C\u989D\u5916\u589E\u52A0\u7684\u597D\u611F\u5EA6"),
|
|
342
|
+
decreaseBonus: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.actionWindow.decreaseBonus).description("\u5F53\u8FD1\u671F\u8D1F\u5411\u4E92\u52A8\u5360\u4F18\u65F6\uFF0C\u989D\u5916\u51CF\u5C11\u7684\u597D\u611F\u5EA6"),
|
|
343
|
+
bonusChatThreshold: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.actionWindow.bonusChatThreshold).min(0).description("\u4E92\u52A8\u6B21\u6570\u8FBE\u5230\u8BE5\u503C\u540E\uFF0C\u624D\u542F\u7528\u989D\u5916\u589E\u51CF\u6548\u679C"),
|
|
344
|
+
maxEntries: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.actionWindow.maxEntries).min(10).description("\u65F6\u95F4\u7A97\u53E3\u5185\u6700\u591A\u4FDD\u7559\u7684\u4E92\u52A8\u8BB0\u5F55\u6570")
|
|
333
345
|
}).description("\u8FD1\u671F\u4E92\u52A8\u6743\u91CD\u8BBE\u7F6E").collapse(),
|
|
334
346
|
coefficient: import_koishi.Schema.object({
|
|
335
|
-
base: import_koishi.Schema.number().default(
|
|
336
|
-
maxDrop: import_koishi.Schema.number().default(
|
|
337
|
-
maxBoost: import_koishi.Schema.number().default(
|
|
338
|
-
decayPerDay: import_koishi.Schema.number().default(
|
|
339
|
-
boostPerDay: import_koishi.Schema.number().default(
|
|
340
|
-
}).default({
|
|
341
|
-
base: 1,
|
|
342
|
-
maxDrop: 0.3,
|
|
343
|
-
maxBoost: 0.3,
|
|
344
|
-
decayPerDay: 0.05,
|
|
345
|
-
boostPerDay: 0.05
|
|
347
|
+
base: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.coefficient.base).description("\u597D\u611F\u5EA6\u53D8\u5316\u7684\u57FA\u7840\u7CFB\u6570"),
|
|
348
|
+
maxDrop: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.coefficient.maxDrop).min(0).step(0.1).description("\u5728\u957F\u671F\u51B7\u6DE1\u6216\u8D1F\u5411\u4E92\u52A8\u5360\u4F18\u65F6\uFF0C\u7CFB\u6570\u6700\u591A\u53EF\u4E0B\u8C03\u7684\u5E45\u5EA6"),
|
|
349
|
+
maxBoost: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.coefficient.maxBoost).min(0).step(0.1).description("\u5728\u6301\u7EED\u4E92\u52A8\u4E14\u6B63\u5411\u4E92\u52A8\u5360\u4F18\u65F6\uFF0C\u7CFB\u6570\u6700\u591A\u53EF\u4E0A\u8C03\u7684\u5E45\u5EA6"),
|
|
350
|
+
decayPerDay: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.coefficient.decayPerDay).min(0).step(0.05).description("\u6BCF\u7ECF\u8FC7\u4E00\u5929\u51B7\u6DE1\u671F\u6216\u8D1F\u5411\u5360\u4F18\u671F\u65F6\uFF0C\u7CFB\u6570\u7684\u4E0B\u8C03\u5E45\u5EA6"),
|
|
351
|
+
boostPerDay: import_koishi.Schema.number().default(AFFINITY_DYNAMICS_DEFAULTS.coefficient.boostPerDay).min(0).step(0.05).description("\u6BCF\u7ECF\u8FC7\u4E00\u5929\u7A33\u5B9A\u4E92\u52A8\u4E14\u6B63\u5411\u5360\u4F18\u65F6\uFF0C\u7CFB\u6570\u7684\u4E0A\u8C03\u5E45\u5EA6")
|
|
346
352
|
}).description("\u597D\u611F\u5EA6\u53D8\u5316\u7CFB\u6570").collapse()
|
|
347
353
|
}).description(
|
|
348
354
|
"\u597D\u611F\u5EA6\u52A8\u6001\u8C03\u8282\uFF1ABot \u6BCF\u6B21\u589E\u52A0\u6216\u51CF\u5C11\u7684\u503C\u4F1A\u5148\u8BA1\u5165\u77ED\u671F\u597D\u611F\uFF1B\u5F53\u77ED\u671F\u597D\u611F\u8D85\u8FC7\u9608\u503C\u65F6\uFF0C\u4F1A\u6309\u8BBE\u5B9A\u6B65\u957F\u6362\u7B97\u5230\u957F\u671F\u597D\u611F\uFF1B\u957F\u671F\u597D\u611F\u518D\u4E58\u4EE5\u5F53\u524D\u7CFB\u6570\uFF0C\u5F97\u5230\u6700\u7EC8\u7684\u7EFC\u5408\u597D\u611F\u3002"
|
|
349
355
|
);
|
|
350
356
|
var AffinitySchema = import_koishi.Schema.object({
|
|
351
357
|
affinityEnabled: import_koishi.Schema.boolean().default(true).description("\u542F\u7528\u597D\u611F\u5EA6\u7CFB\u7EDF"),
|
|
352
|
-
affinityDisplayRange: import_koishi.Schema.number().default(1).min(1).step(1).description("\u663E\u793A\u5F53\u524D\u4E0A\u4E0B\u6587\u4E2D\u591A\u5C11\u4F4D\u7528\u6237\u7684\u597D\u611F\u5EA6\u4FE1\u606F"),
|
|
353
358
|
initialAffinity: import_koishi.Schema.number().default(BASE_AFFINITY_DEFAULTS.initialAffinity).description("\u521D\u59CB\u957F\u671F\u597D\u611F\u5EA6\u9ED8\u8BA4\u503C"),
|
|
354
|
-
affinityDynamics: AffinityDynamicsSchema.
|
|
355
|
-
shortTerm: {
|
|
356
|
-
promoteThreshold: 15,
|
|
357
|
-
demoteThreshold: -10,
|
|
358
|
-
longTermPromoteStep: 3,
|
|
359
|
-
longTermDemoteStep: 5
|
|
360
|
-
},
|
|
361
|
-
actionWindow: {
|
|
362
|
-
windowHours: 24,
|
|
363
|
-
increaseBonus: 2,
|
|
364
|
-
decreaseBonus: 2,
|
|
365
|
-
bonusChatThreshold: 10,
|
|
366
|
-
maxEntries: 80
|
|
367
|
-
},
|
|
368
|
-
coefficient: {
|
|
369
|
-
base: 1,
|
|
370
|
-
maxDrop: 0.3,
|
|
371
|
-
maxBoost: 0.3,
|
|
372
|
-
decayPerDay: 0.05,
|
|
373
|
-
boostPerDay: 0.05
|
|
374
|
-
}
|
|
375
|
-
}).collapse(),
|
|
359
|
+
affinityDynamics: AffinityDynamicsSchema.collapse(),
|
|
376
360
|
rankDefaultLimit: import_koishi.Schema.number().default(10).min(1).max(50).description("\u597D\u611F\u5EA6\u6392\u884C\u9ED8\u8BA4\u5C55\u793A\u4EBA\u6570")
|
|
377
361
|
}).description("\u597D\u611F\u5EA6\u8BBE\u7F6E");
|
|
378
362
|
|
|
@@ -492,6 +476,7 @@ var VariableSettingsSchema = import_koishi4.Schema.object({
|
|
|
492
476
|
affinityVariableName: import_koishi4.Schema.string().default("affinity").description(
|
|
493
477
|
'\u597D\u611F\u5EA6\u53D8\u91CF\u540D\u79F0\uFF0C\u8C03\u7528\u793A\u4F8B\uFF1A{affinity("scopeId")}\uFF0C\u8BF7\u5C06 scopeId \u66FF\u6362\u4E3A\u4F60\u8BBE\u5B9A\u7684\u5B9E\u9645 scopeId\u3002\u8FD4\u56DE\u683C\u5F0F\u4E3A\u6587\u672C\u884C\uFF0C\u5305\u542B id\u3001name\u3001nickname\u3001affinity\u3001relationship\uFF1B\u5F53\u5C55\u793A\u8303\u56F4\u5927\u4E8E 1 \u65F6\u4F1A\u8FD4\u56DE\u591A\u884C\u3002'
|
|
494
478
|
),
|
|
479
|
+
affinityDisplayRange: import_koishi4.Schema.number().default(1).min(1).step(1).description("\u663E\u793A\u5F53\u524D\u4E0A\u4E0B\u6587\u4E2D\u591A\u5C11\u4F4D\u7528\u6237\u7684\u597D\u611F\u5EA6\u4FE1\u606F"),
|
|
495
480
|
relationshipLevelVariableName: import_koishi4.Schema.string().default("relationshipLevel").description(
|
|
496
481
|
'\u597D\u611F\u5EA6\u533A\u95F4\u53D8\u91CF\u540D\u79F0\uFF0C\u8C03\u7528\u793A\u4F8B\uFF1A{relationshipLevel("scopeId")}\uFF0C\u8BF7\u5C06 scopeId \u66FF\u6362\u4E3A\u4F60\u8BBE\u5B9A\u7684\u5B9E\u9645 scopeId\u3002\u8FD4\u56DE\u683C\u5F0F\u4E3A\u6587\u672C\u884C\uFF0C\u5217\u51FA\u5F53\u524D\u914D\u7F6E\u4E2D\u7684\u6240\u6709\u533A\u95F4\uFF0C\u5305\u542B min\u3001max\u3001relationship\u3001note\u3002'
|
|
497
482
|
),
|
|
@@ -1585,28 +1570,32 @@ function normalizeAction(action) {
|
|
|
1585
1570
|
}
|
|
1586
1571
|
function resolveShortTermConfig(config) {
|
|
1587
1572
|
const cfg = config?.affinityDynamics?.shortTerm || {};
|
|
1573
|
+
const defaults = AFFINITY_DYNAMICS_DEFAULTS.shortTerm;
|
|
1588
1574
|
const promoteRaw = Number(cfg.promoteThreshold);
|
|
1589
1575
|
const demoteRaw = Number(cfg.demoteThreshold);
|
|
1590
|
-
let promoteThreshold = Number.isFinite(promoteRaw) ? Math.round(promoteRaw) :
|
|
1591
|
-
let demoteThreshold = Number.isFinite(demoteRaw) ? Math.round(demoteRaw) :
|
|
1576
|
+
let promoteThreshold = Number.isFinite(promoteRaw) ? Math.round(promoteRaw) : defaults.promoteThreshold;
|
|
1577
|
+
let demoteThreshold = Number.isFinite(demoteRaw) ? Math.round(demoteRaw) : defaults.demoteThreshold;
|
|
1592
1578
|
if (promoteThreshold <= demoteThreshold) {
|
|
1593
1579
|
const midpoint = Math.round((promoteThreshold + demoteThreshold) / 2) || 0;
|
|
1594
1580
|
promoteThreshold = midpoint + 15;
|
|
1595
1581
|
demoteThreshold = midpoint - 15;
|
|
1596
1582
|
}
|
|
1597
|
-
const fallbackStep = Number.isFinite(cfg.longTermStep) ? cfg.longTermStep : 3;
|
|
1598
1583
|
const promoteStepRaw = Number(cfg.longTermPromoteStep);
|
|
1599
1584
|
const demoteStepRaw = Number(cfg.longTermDemoteStep);
|
|
1600
1585
|
const longTermPromoteStep = Math.max(
|
|
1601
1586
|
1,
|
|
1602
1587
|
Math.round(
|
|
1603
|
-
Math.abs(
|
|
1588
|
+
Math.abs(
|
|
1589
|
+
Number.isFinite(promoteStepRaw) ? promoteStepRaw : Number.isFinite(cfg.longTermStep) ? cfg.longTermStep : defaults.longTermPromoteStep
|
|
1590
|
+
)
|
|
1604
1591
|
)
|
|
1605
1592
|
);
|
|
1606
1593
|
const longTermDemoteStep = Math.max(
|
|
1607
1594
|
1,
|
|
1608
1595
|
Math.round(
|
|
1609
|
-
Math.abs(
|
|
1596
|
+
Math.abs(
|
|
1597
|
+
Number.isFinite(demoteStepRaw) ? demoteStepRaw : Number.isFinite(cfg.longTermStep) ? cfg.longTermStep : defaults.longTermDemoteStep
|
|
1598
|
+
)
|
|
1610
1599
|
)
|
|
1611
1600
|
);
|
|
1612
1601
|
return {
|
|
@@ -1618,22 +1607,23 @@ function resolveShortTermConfig(config) {
|
|
|
1618
1607
|
}
|
|
1619
1608
|
function resolveActionWindowConfig(config) {
|
|
1620
1609
|
const cfg = config?.affinityDynamics?.actionWindow || {};
|
|
1610
|
+
const defaults = AFFINITY_DYNAMICS_DEFAULTS.actionWindow;
|
|
1621
1611
|
const windowHoursRaw = Number(cfg.windowHours);
|
|
1622
1612
|
const windowHours = Math.max(
|
|
1623
1613
|
1,
|
|
1624
|
-
Number.isFinite(windowHoursRaw) ? windowHoursRaw :
|
|
1614
|
+
Number.isFinite(windowHoursRaw) ? windowHoursRaw : defaults.windowHours
|
|
1625
1615
|
);
|
|
1626
|
-
const increaseBonus = Number.isFinite(cfg.increaseBonus) ? cfg.increaseBonus :
|
|
1627
|
-
const decreaseBonus = Number.isFinite(cfg.decreaseBonus) ? cfg.decreaseBonus :
|
|
1616
|
+
const increaseBonus = Number.isFinite(cfg.increaseBonus) ? cfg.increaseBonus : defaults.increaseBonus;
|
|
1617
|
+
const decreaseBonus = Number.isFinite(cfg.decreaseBonus) ? cfg.decreaseBonus : defaults.decreaseBonus;
|
|
1628
1618
|
const bonusChatThresholdRaw = Number(cfg.bonusChatThreshold);
|
|
1629
1619
|
const bonusChatThreshold = Math.max(
|
|
1630
1620
|
0,
|
|
1631
|
-
Number.isFinite(bonusChatThresholdRaw) ? Math.round(bonusChatThresholdRaw) :
|
|
1621
|
+
Number.isFinite(bonusChatThresholdRaw) ? Math.round(bonusChatThresholdRaw) : defaults.bonusChatThreshold
|
|
1632
1622
|
);
|
|
1633
1623
|
const maxEntriesRaw = Number(cfg.maxEntries);
|
|
1634
1624
|
const maxEntries = Math.max(
|
|
1635
1625
|
10,
|
|
1636
|
-
Number.isFinite(maxEntriesRaw) ? Math.round(maxEntriesRaw) :
|
|
1626
|
+
Number.isFinite(maxEntriesRaw) ? Math.round(maxEntriesRaw) : defaults.maxEntries
|
|
1637
1627
|
);
|
|
1638
1628
|
return {
|
|
1639
1629
|
windowHours,
|
|
@@ -1646,22 +1636,23 @@ function resolveActionWindowConfig(config) {
|
|
|
1646
1636
|
}
|
|
1647
1637
|
function resolveCoefficientConfig(config) {
|
|
1648
1638
|
const cfg = config?.affinityDynamics?.coefficient || {};
|
|
1649
|
-
const
|
|
1639
|
+
const defaults = AFFINITY_DYNAMICS_DEFAULTS.coefficient;
|
|
1640
|
+
const base = Number.isFinite(cfg.base) ? cfg.base : defaults.base;
|
|
1650
1641
|
const maxDrop = Math.max(
|
|
1651
1642
|
0,
|
|
1652
|
-
Number.isFinite(cfg.maxDrop) ? cfg.maxDrop :
|
|
1643
|
+
Number.isFinite(cfg.maxDrop) ? cfg.maxDrop : defaults.maxDrop
|
|
1653
1644
|
);
|
|
1654
1645
|
const maxBoost = Math.max(
|
|
1655
1646
|
0,
|
|
1656
|
-
Number.isFinite(cfg.maxBoost) ? cfg.maxBoost :
|
|
1647
|
+
Number.isFinite(cfg.maxBoost) ? cfg.maxBoost : defaults.maxBoost
|
|
1657
1648
|
);
|
|
1658
1649
|
const decayPerDay = Math.max(
|
|
1659
1650
|
0,
|
|
1660
|
-
Number.isFinite(cfg.decayPerDay) ? cfg.decayPerDay :
|
|
1651
|
+
Number.isFinite(cfg.decayPerDay) ? cfg.decayPerDay : defaults.decayPerDay
|
|
1661
1652
|
);
|
|
1662
1653
|
const boostPerDay = Math.max(
|
|
1663
1654
|
0,
|
|
1664
|
-
Number.isFinite(cfg.boostPerDay) ? cfg.boostPerDay :
|
|
1655
|
+
Number.isFinite(cfg.boostPerDay) ? cfg.boostPerDay : defaults.boostPerDay
|
|
1665
1656
|
);
|
|
1666
1657
|
const min = base - maxDrop;
|
|
1667
1658
|
const max = base + maxBoost;
|
|
@@ -5054,7 +5045,7 @@ async function callOneBotAPI(internal, action, params, fallbacks = []) {
|
|
|
5054
5045
|
var usage = `
|
|
5055
5046
|
## \u66F4\u65B0\u65E5\u5FD7
|
|
5056
5047
|
|
|
5057
|
-
0.3.0-
|
|
5048
|
+
0.3.0-beta
|
|
5058
5049
|
|
|
5059
5050
|
### \u91CD\u6784
|
|
5060
5051
|
- \u5F15\u5165 \`scopeId\` \u4F5C\u4E3A\u65B0\u7684\u6838\u5FC3\u4F5C\u7528\u57DF\u8BED\u4E49\uFF1B\u6570\u636E\u9694\u79BB\u4ECE\u65E7\u7248\u6309 bot / \u65E7\u4E3B\u952E\u5207\u6362\u4E3A\u6309 \`scopeId\` \u9694\u79BB\u3002
|
|
@@ -5112,6 +5103,7 @@ var usage = `
|
|
|
5112
5103
|
0 && (module.exports = {
|
|
5113
5104
|
ACTION_WINDOW_DEFAULTS,
|
|
5114
5105
|
AFFINITY_DEFAULTS,
|
|
5106
|
+
AFFINITY_DYNAMICS_DEFAULTS,
|
|
5115
5107
|
ALL_MEMBER_INFO_ITEMS,
|
|
5116
5108
|
AffinitySchema,
|
|
5117
5109
|
BASE_AFFINITY_DEFAULTS,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-chatluna-affinity",
|
|
3
3
|
"description": "ChatLuna Character 好感度系统,提供 {好感度}、{关系}、{黑名单} 变量与工具,并支持 XML 工具调用,仅支持 onebot 平台。",
|
|
4
|
-
"version": "0.3.0-
|
|
4
|
+
"version": "0.3.0-beta.2",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"koishi",
|
|
16
16
|
"plugin"
|
|
17
17
|
],
|
|
18
|
-
"homepage": "https://github.com/Sor85/koishi-
|
|
18
|
+
"homepage": "https://github.com/Sor85/koishi-plugins",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "
|
|
21
|
+
"url": "https://github.com/Sor85/koishi-plugins.git"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"koishi": "^4.18.7",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"rimraf": "^5.0.5",
|
|
49
49
|
"sass": "^1.77.0",
|
|
50
50
|
"tsup": "^8.0.0",
|
|
51
|
-
"typescript": "^5.3.3"
|
|
51
|
+
"typescript": "^5.3.3",
|
|
52
|
+
"vite": "^6.0.0"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
55
|
"koishi-plugin-chatluna": "*"
|
|
@@ -56,7 +57,6 @@
|
|
|
56
57
|
"scripts": {
|
|
57
58
|
"build": "tsup && vite build",
|
|
58
59
|
"watch": "tsup --watch",
|
|
59
|
-
"clean": "rimraf lib dist"
|
|
60
|
-
"test": "npm run build && node --test test/**/*.test.js"
|
|
60
|
+
"clean": "rimraf lib dist"
|
|
61
61
|
}
|
|
62
62
|
}
|
package/readme.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 项目简介
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
这个插件提供一个好感度管理工具。
|
|
8
8
|
|
|
9
9
|
它把互动状态落到数据库里,并按 `scopeId` 做实例隔离。你可以把 `scopeId` 理解为当前角色的人设作用域:同一个 `scopeId` 下的数据共享,不同 `scopeId` 之间完全隔离。
|
|
10
10
|
|
|
@@ -48,12 +48,9 @@ npm install koishi-plugin-chatluna-affinity
|
|
|
48
48
|
- `scopeId` 必填
|
|
49
49
|
- 只允许中文、英文、数字、`_`、`-`
|
|
50
50
|
- 长度 1 到 32
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
- 同一个 `scopeId` 下,所有 bot 共享一份互动数据
|
|
56
|
-
- 不同 `scopeId` 下,数据完全隔离
|
|
51
|
+
- 不建议直接使用角色名或角色代号
|
|
52
|
+
- 同一个 `scopeId` 下,所有 bot 共享一份互动数据
|
|
53
|
+
- 不同 `scopeId` 下,数据完全隔离
|
|
57
54
|
|
|
58
55
|
### 2. 保持默认配置先跑通
|
|
59
56
|
|
|
@@ -71,8 +68,6 @@ npm install koishi-plugin-chatluna-affinity
|
|
|
71
68
|
|
|
72
69
|
它为空时,表示当前实例内任意 bot 的有效回复都可以触发首次初始化。
|
|
73
70
|
|
|
74
|
-
如果你没特殊需求,不要一上来就乱改动态参数,先把链路跑通再说。
|
|
75
|
-
|
|
76
71
|
### 3. 在角色提示词里接入变量与 XML
|
|
77
72
|
|
|
78
73
|
如果你在 ChatLuna Character 模板里使用本插件:
|
|
@@ -96,15 +91,14 @@ npm install koishi-plugin-chatluna-affinity
|
|
|
96
91
|
调用格式必须写成:
|
|
97
92
|
|
|
98
93
|
```text
|
|
99
|
-
{变量名("scopeId"
|
|
94
|
+
{变量名("scopeId")}
|
|
100
95
|
```
|
|
101
96
|
|
|
102
97
|
示例:
|
|
103
98
|
|
|
104
|
-
- `{affinity("
|
|
105
|
-
- `{
|
|
106
|
-
- `{
|
|
107
|
-
- `{blacklistList("宁宁")}`
|
|
99
|
+
- `{affinity("nene")}`
|
|
100
|
+
- `{relationshipLevel("nene")}`
|
|
101
|
+
- `{blacklistList("nene")}`
|
|
108
102
|
|
|
109
103
|
### `affinity`
|
|
110
104
|
|
|
@@ -113,7 +107,7 @@ npm install koishi-plugin-chatluna-affinity
|
|
|
113
107
|
输出示例:
|
|
114
108
|
|
|
115
109
|
```text
|
|
116
|
-
id:
|
|
110
|
+
id:123456 name:xxx nickname:xxx姐姐 affinity:20 relationship:熟悉
|
|
117
111
|
```
|
|
118
112
|
|
|
119
113
|
说明:
|
|
@@ -153,8 +147,6 @@ id:1511991473 name:蒸汽机 nickname:蒸汽机姐姐 affinity:20 relationship:
|
|
|
153
147
|
{affinity(nene)}
|
|
154
148
|
```
|
|
155
149
|
|
|
156
|
-
后者会先把 `nene` 当成模板变量求值,不是你想要的效果。
|
|
157
|
-
|
|
158
150
|
## XML 动作调用
|
|
159
151
|
|
|
160
152
|
插件会从模型原始输出中解析以下自闭合标签:
|
|
@@ -181,73 +173,45 @@ id:1511991473 name:蒸汽机 nickname:蒸汽机姐姐 affinity:20 relationship:
|
|
|
181
173
|
增加好感:
|
|
182
174
|
|
|
183
175
|
```xml
|
|
184
|
-
<affinity scopeId="
|
|
176
|
+
<affinity scopeId="nene" userId="123456" action="increase" delta="5"/>
|
|
185
177
|
```
|
|
186
178
|
|
|
187
179
|
减少好感:
|
|
188
180
|
|
|
189
181
|
```xml
|
|
190
|
-
<affinity scopeId="
|
|
182
|
+
<affinity scopeId="nene" userId="123456" action="decrease" delta="3"/>
|
|
191
183
|
```
|
|
192
184
|
|
|
193
185
|
设置特殊关系:
|
|
194
186
|
|
|
195
187
|
```xml
|
|
196
|
-
<relationship scopeId="
|
|
188
|
+
<relationship scopeId="nene" userId="123456" action="set" relation="姐姐"/>
|
|
197
189
|
```
|
|
198
190
|
|
|
199
191
|
移除特殊关系:
|
|
200
192
|
|
|
201
193
|
```xml
|
|
202
|
-
<relationship scopeId="
|
|
194
|
+
<relationship scopeId="nene" userId="123456" action="clear"/>
|
|
203
195
|
```
|
|
204
196
|
|
|
205
197
|
永久拉黑:
|
|
206
198
|
|
|
207
199
|
```xml
|
|
208
|
-
<blacklist scopeId="
|
|
200
|
+
<blacklist scopeId="nene" userId="123456" action="add" mode="permanent" note="violation"/>
|
|
209
201
|
```
|
|
210
202
|
|
|
211
203
|
临时拉黑:
|
|
212
204
|
|
|
213
205
|
```xml
|
|
214
|
-
<blacklist scopeId="
|
|
206
|
+
<blacklist scopeId="nene" userId="123456" action="add" mode="temporary" durationHours="12" note="spam"/>
|
|
215
207
|
```
|
|
216
208
|
|
|
217
209
|
设置昵称:
|
|
218
210
|
|
|
219
211
|
```xml
|
|
220
|
-
<userAlias scopeId="
|
|
212
|
+
<userAlias scopeId="nene" userId="123456" name="小祥"/>
|
|
221
213
|
```
|
|
222
214
|
|
|
223
|
-
### 关于初始化
|
|
224
|
-
|
|
225
|
-
首次好感度记录不再依赖 `<affinity .../>` 这类 XML 写路径。
|
|
226
|
-
|
|
227
|
-
当前语义是:
|
|
228
|
-
|
|
229
|
-
- 当 `chatluna-character` 的 `getTemp(session, ...)` 命中当前会话
|
|
230
|
-
- 且后续 `completionMessages.push(...)` 确实写入了一条有效 AI 回复
|
|
231
|
-
- 且该回复对应的 `session.selfId` 命中当前实例允许的 `botSelfIds`(或该列表为空)
|
|
232
|
-
- 且当前 `scopeId + userId` 还没有现存记录
|
|
233
|
-
|
|
234
|
-
插件才会为该用户执行一次首次初始化。
|
|
235
|
-
|
|
236
|
-
这意味着:
|
|
237
|
-
|
|
238
|
-
- 第一次真实互动就可以建档
|
|
239
|
-
- 已有记录时不会重复初始化,也不会重置旧值
|
|
240
|
-
- `botSelfIds` 只影响“谁能触发首次初始化”
|
|
241
|
-
- 存储隔离仍然只看 `scopeId`,不会因为 `selfId` 不同而拆成多份数据
|
|
242
|
-
|
|
243
|
-
显式写路径仍然会继续修改记录,例如:
|
|
244
|
-
|
|
245
|
-
- XML 的 `<affinity .../>`
|
|
246
|
-
- 手动命令 `adjust`
|
|
247
|
-
- 其他明确调用存储写入的逻辑
|
|
248
|
-
|
|
249
|
-
无记录时,初始化默认值来自 `initialAffinity`。
|
|
250
|
-
|
|
251
215
|
## 指令
|
|
252
216
|
|
|
253
217
|
指令统一为:
|
|
@@ -256,17 +220,17 @@ id:1511991473 name:蒸汽机 nickname:蒸汽机姐姐 affinity:20 relationship:
|
|
|
256
220
|
scopeId.指令名
|
|
257
221
|
```
|
|
258
222
|
|
|
259
|
-
例如 `scopeId =
|
|
223
|
+
例如 `scopeId = nene` 时:
|
|
260
224
|
|
|
261
|
-
-
|
|
262
|
-
-
|
|
263
|
-
-
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
267
|
-
-
|
|
268
|
-
-
|
|
269
|
-
-
|
|
225
|
+
- `nene.inspect [userId] [platform] [image]`:查看指定用户好感度详情
|
|
226
|
+
- `nene.rank [limit] [image]`:查看当前作用域好感度排行
|
|
227
|
+
- `nene.adjust <userId> <delta>`:手动增减好感度
|
|
228
|
+
- `nene.blacklist [limit] [platform] [image]`:查看黑名单列表
|
|
229
|
+
- `nene.block <userId> [platform]`:加入永久黑名单
|
|
230
|
+
- `nene.unblock <userId> [platform]`:解除永久黑名单,并尝试重置好感度
|
|
231
|
+
- `nene.tempBlock <userId> [durationHours] [platform]`:加入临时黑名单
|
|
232
|
+
- `nene.tempUnblock <userId> [platform]`:解除临时黑名单
|
|
233
|
+
- `nene.clearAll -y`:清空当前作用域下的好感度、黑名单、昵称数据
|
|
270
234
|
|
|
271
235
|
其中 `clearAll` 是危险操作,需要二次确认。
|
|
272
236
|
|
|
@@ -295,39 +259,6 @@ scopeId.指令名
|
|
|
295
259
|
|
|
296
260
|
`characterPromptTemplate` 里出现的 `{scopeId}` 不会自动替换。那只是参考占位符,你要自己手动替换成真实值。
|
|
297
261
|
|
|
298
|
-
## 数据与迁移
|
|
299
|
-
|
|
300
|
-
插件使用 Koishi `database` 持久化数据,主要涉及好感度、黑名单、昵称和迁移状态记录。
|
|
301
|
-
|
|
302
|
-
### 当前数据语义
|
|
303
|
-
|
|
304
|
-
当前版本核心定位键是:
|
|
305
|
-
|
|
306
|
-
- `scopeId + userId`
|
|
307
|
-
|
|
308
|
-
这意味着:
|
|
309
|
-
|
|
310
|
-
- 同一角色实例内的数据按 `scopeId` 共享
|
|
311
|
-
- 不再依赖旧版本里的 `selfId` 语义做隔离
|
|
312
|
-
|
|
313
|
-
### 迁移行为
|
|
314
|
-
|
|
315
|
-
当前代码包含旧表到 `v2` 结构的迁移逻辑。
|
|
316
|
-
|
|
317
|
-
但你别自欺欺人,以为它会帮你完美保留旧语义。事实不是。
|
|
318
|
-
|
|
319
|
-
迁移时:
|
|
320
|
-
|
|
321
|
-
- 旧表记录会被映射到当前配置的 `scopeId`
|
|
322
|
-
- `selfId` 不会被迁移到新表中
|
|
323
|
-
- 如果你旧版本依赖 `selfId` 区分不同 bot,那这层语义会丢失
|
|
324
|
-
|
|
325
|
-
所以升级前你必须自己判断:
|
|
326
|
-
|
|
327
|
-
- 你要的是“把旧数据并到当前角色作用域里”
|
|
328
|
-
- 还是“保留旧版多 bot 隔离语义”
|
|
329
|
-
|
|
330
|
-
如果是后者,别指望自动迁移替你做对,你得自己处理数据库。
|
|
331
262
|
|
|
332
263
|
## 调试建议
|
|
333
264
|
|