mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 11:30:22 +08:00
feat: 发布 1.1.3,提示词只注入一次并修复插件加载
This commit is contained in:
1 parent
8f860d4a53
commit
238b39b8ff
10 files changed
+434
-61
No files matched your search
@@ -202,6 +202,24 @@ export function getPending() {
|
||||
return lastPending;
|
||||
}
|
||||
|
||||
export function lastHumanUserText(events) {
|
||||
const list = Array.isArray(events) ? events : [];
|
||||
for (let i = list.length - 1; i >= 0; i -= 1) {
|
||||
if (isHumanUserEvent(list[i])) return userTextFromEvent(list[i]);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
export async function readLastUserText(ctx, sessionId) {
|
||||
if (!sessionId) return { ok: false, text: "", error: "没有当前会话" };
|
||||
try {
|
||||
const log = await readSessionLog(ctx, sessionId);
|
||||
return { ok: true, text: lastHumanUserText(log.events) };
|
||||
} catch (err) {
|
||||
return { ok: false, text: "", error: errorText(err) };
|
||||
}
|
||||
}
|
||||
|
||||
function disposeObservation(observed) {
|
||||
try {
|
||||
observed?.[Symbol.dispose]?.();
|
||||
|
||||
Reference in new issue
Block a user