dsh-feini 0.1.2 → 0.1.3
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/bin/cli.mjs +2 -1
- package/package.json +1 -1
- package/src/proactive.mjs +24 -0
package/bin/cli.mjs
CHANGED
|
@@ -187,7 +187,8 @@ async function cmdInit(argv) {
|
|
|
187
187
|
},
|
|
188
188
|
modelVision: {
|
|
189
189
|
baseUrl: 'https://open.bigmodel.cn/api/paas/v4',
|
|
190
|
-
|
|
190
|
+
// 智谱现在的视觉模型;旧名 glm-4v-flash 已经不太稳,识图会 400
|
|
191
|
+
model: 'glm-5.3-flash',
|
|
191
192
|
apiKeyEnv: 'FEINI_VISION_KEY',
|
|
192
193
|
keyFile: path.join(home, 'vision-key.txt'),
|
|
193
194
|
},
|
package/package.json
CHANGED
package/src/proactive.mjs
CHANGED
|
@@ -159,6 +159,13 @@ export function startProactive({ config, getSystemPrompt, apiKey, bot, history,
|
|
|
159
159
|
if (sleptLate && now - state.lastUserAt < quietMs) return;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
// 他说了「晚安」:就当他睡了,7 小时内不主动、也不闹脾气。
|
|
163
|
+
// 2026-10-31 02:33 那次就是因为没有这条——他 01:5x 说晚安,之后还被追着喊了三回。
|
|
164
|
+
if (state.goodnightAt && now - state.goodnightAt < quietMs) return;
|
|
165
|
+
|
|
166
|
+
// 不在活跃时段(默认 07:00–02:00)就别开口
|
|
167
|
+
if (!inWindow(window.from, window.to)) return;
|
|
168
|
+
|
|
162
169
|
try {
|
|
163
170
|
// 他刚说过话:别插嘴,等安静够 5 分钟再说
|
|
164
171
|
if (state.lastUserAt && now - state.lastUserAt < afterReplyMin * 60000) return;
|
|
@@ -201,11 +208,28 @@ export function startProactive({ config, getSystemPrompt, apiKey, bot, history,
|
|
|
201
208
|
},
|
|
202
209
|
/** 他回话了:不是立刻消气——傲娇要哄到位 */
|
|
203
210
|
noteUserReply(text) {
|
|
211
|
+
const t = String(text || '');
|
|
204
212
|
state.lastUserAt = Date.now();
|
|
205
213
|
state.pendingSince = 0;
|
|
206
214
|
// 他刚回话,下一轮主动重新计时:不然对话一结束、安静满 5 分钟就立刻开口
|
|
207
215
|
state.nextAt = Date.now() + randBetween(gapMin, gapMax) * 60000;
|
|
208
216
|
|
|
217
|
+
// 他说「晚安 / 去睡了」:记下来,接下来 7 小时不主动也不闹。
|
|
218
|
+
// 醒来说第一句就清掉(下面 else 分支),不用他专门说「我醒了」。
|
|
219
|
+
if (/(晚安|我睡了|先去睡|去睡了|睡觉去了|睡啦|睡咯|晚安啦)/.test(t)) {
|
|
220
|
+
state.goodnightAt = Date.now();
|
|
221
|
+
state.sulking = false;
|
|
222
|
+
state.sulkCount = 0;
|
|
223
|
+
state.coaxNeed = 0;
|
|
224
|
+
state.coaxCount = 0;
|
|
225
|
+
writeSulk(sulkFile, null);
|
|
226
|
+
log('他道晚安了,接下来不主动找他');
|
|
227
|
+
} else if (state.goodnightAt && Date.now() - state.goodnightAt > 30 * 60000) {
|
|
228
|
+
// 隔了半小时以上又开口,说明醒了:解除静默
|
|
229
|
+
state.goodnightAt = 0;
|
|
230
|
+
log('他醒了,恢复主动');
|
|
231
|
+
}
|
|
232
|
+
|
|
209
233
|
if (state.sulking) {
|
|
210
234
|
const t = String(text || '');
|
|
211
235
|
const coax = /(对不起|我错|别生气|不要气|哄你|抱抱|亲亲|爱你|想你|乖|抱歉|么么|摸摸|宝宝|我别)/;
|