Fix session title generation

This commit is contained in:
wuyang6
2026-05-11 16:22:19 +08:00
parent 82a444bfb2
commit 64ad7aa97a
3 changed files with 208 additions and 33 deletions
@@ -129,6 +129,16 @@ type ContextBudget = {
token_counter_accurate?: boolean;
};
function scheduleSessionListRefresh() {
if (typeof window === "undefined") return;
window.dispatchEvent(new Event("claw-sessions-changed"));
for (const delay of [300, 1000, 2500]) {
window.setTimeout(() => {
window.dispatchEvent(new Event("claw-sessions-changed"));
}, delay);
}
}
export const Thread: FC = () => {
useRefreshReplayedRun();
return (
@@ -1145,7 +1155,9 @@ function SkillInsertDialog() {
setSkills(payload.skills);
const changedCount = payload.changed_files?.length ?? 0;
if (payload.updated) {
const shortHash = payload.after ? payload.after.slice(0, 7) : "最新提交";
const shortHash = payload.after
? payload.after.slice(0, 7)
: "最新提交";
setStatus(`Skill 已更新到 ${shortHash},变更 ${changedCount} 个文件。`);
} else {
setStatus("Skill 已是最新。");
@@ -1761,6 +1773,7 @@ const ImeComposerInput: FC<ComponentProps<typeof TextareaAutosize>> = ({
const clearAfterSubmit = () => {
justSubmittedRef.current = true;
setLocalText("");
scheduleSessionListRefresh();
};
const unsubscribeComposer = aui.on("composer.send", clearAfterSubmit);
const unsubscribeRun = aui.on("thread.runStart", clearAfterSubmit);