chore(ai): 增加调试日志输出
This commit is contained in:
@@ -1146,11 +1146,8 @@ async loadChatHistoryIfExist() {
|
||||
|
||||
// 格式化时间
|
||||
formatTime(timestamp) {
|
||||
console.log('【调试】formatTime 接收到的时间戳:', timestamp, typeof timestamp);
|
||||
|
||||
// 如果没有时间戳,就不显示时间
|
||||
if (!timestamp) {
|
||||
console.warn('【调试】没有时间戳');
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -1183,21 +1180,15 @@ async loadChatHistoryIfExist() {
|
||||
date = new Date(timeValue);
|
||||
}
|
||||
|
||||
console.log('【调试】最终 Date 对象:', date);
|
||||
console.log('【调试】本地时间:', date.toLocaleString());
|
||||
console.log('【调试】小时:', date.getHours());
|
||||
console.log('【调试】分钟:', date.getMinutes());
|
||||
|
||||
// 如果时间无效,就不显示时间
|
||||
if (isNaN(date.getTime())) {
|
||||
console.warn('【调试】时间无效:', timestamp);
|
||||
return '';
|
||||
}
|
||||
|
||||
const hours = date.getHours().toString().padStart(2, '0');
|
||||
const minutes = date.getMinutes().toString().padStart(2, '0');
|
||||
const result = hours + ':' + minutes;
|
||||
console.log('【调试】最终显示时间:', result);
|
||||
return result;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user