63 lines
2.4 KiB
TypeScript
63 lines
2.4 KiB
TypeScript
// @ts-nocheck
|
|
import { debugLog, traceLog } from './methods/common';
|
|
|
|
export const watchers = {
|
|
inputMessage() {
|
|
this.autoResizeInput();
|
|
},
|
|
messages: {
|
|
deep: true,
|
|
handler() {
|
|
this.refreshBlankHeroState();
|
|
}
|
|
},
|
|
currentConversationTitle(newVal, oldVal) {
|
|
const target = (newVal && newVal.trim()) || '';
|
|
if (this.suppressTitleTyping) {
|
|
this.titleTypingText = target;
|
|
this.titleTypingTarget = target;
|
|
return;
|
|
}
|
|
const previous = (oldVal && oldVal.trim()) || (this.titleTypingText && this.titleTypingText.trim()) || '';
|
|
const placeholderPrev = !previous || previous === '新对话';
|
|
const placeholderTarget = !target || target === '新对话';
|
|
const animate = placeholderPrev && !placeholderTarget; // 仅从空/占位切换到真实标题时动画
|
|
this.startTitleTyping(target, { animate });
|
|
},
|
|
currentConversationId: {
|
|
immediate: false,
|
|
handler(newValue, oldValue) {
|
|
debugLog('currentConversationId 变化', { oldValue, newValue, skipConversationHistoryReload: this.skipConversationHistoryReload });
|
|
traceLog('watch:currentConversationId', {
|
|
oldValue,
|
|
newValue,
|
|
skipConversationHistoryReload: this.skipConversationHistoryReload,
|
|
historyLoading: this.historyLoading,
|
|
historyLoadingFor: this.historyLoadingFor,
|
|
historyLoadSeq: this.historyLoadSeq
|
|
});
|
|
this.refreshBlankHeroState();
|
|
this.logMessageState('watch:currentConversationId', { oldValue, newValue, skipConversationHistoryReload: this.skipConversationHistoryReload });
|
|
if (!newValue || typeof newValue !== 'string' || newValue.startsWith('temp_')) {
|
|
return;
|
|
}
|
|
if (this.skipConversationHistoryReload) {
|
|
this.skipConversationHistoryReload = false;
|
|
return;
|
|
}
|
|
if (oldValue && newValue === oldValue) {
|
|
return;
|
|
}
|
|
this.fetchAndDisplayHistory();
|
|
this.fetchConversationTokenStatistics();
|
|
this.updateCurrentContextTokens();
|
|
}
|
|
},
|
|
fileTree: {
|
|
immediate: true,
|
|
handler(newValue) {
|
|
this.monitorSyncDesktop(newValue);
|
|
}
|
|
}
|
|
};
|