fix: 优化对话压缩和复制功能
- 隐藏前端系统消息块显示 - 修复压缩对话后自动跳转到新对话 - 压缩对话标题改为"原标题 压缩后" - 复制对话标题改为"原标题 的副本" Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bc9a0ed2d7
commit
e395c82a9f
@ -238,8 +238,12 @@ export const messageMethods = {
|
|||||||
if (response.ok && result.success) {
|
if (response.ok && result.success) {
|
||||||
const newId = result.compressed_conversation_id;
|
const newId = result.compressed_conversation_id;
|
||||||
if (newId) {
|
if (newId) {
|
||||||
this.currentConversationId = newId;
|
await this.loadConversation(newId, { force: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.conversationsOffset = 0;
|
||||||
|
await this.loadConversationsList();
|
||||||
|
|
||||||
debugLog('对话压缩完成:', result);
|
debugLog('对话压缩完成:', result);
|
||||||
} else {
|
} else {
|
||||||
const message = result.message || result.error || '压缩失败';
|
const message = result.message || result.error || '压缩失败';
|
||||||
|
|||||||
@ -387,7 +387,7 @@ const stackedBlocksEnabled = computed(() => {
|
|||||||
return enabled !== false;
|
return enabled !== false;
|
||||||
});
|
});
|
||||||
const filteredMessages = computed(() =>
|
const filteredMessages = computed(() =>
|
||||||
(props.messages || []).filter(m => !(m && m.metadata && m.metadata.system_injected_image))
|
(props.messages || []).filter(m => !(m && m.metadata && m.metadata.system_injected_image) && m.role !== 'system')
|
||||||
);
|
);
|
||||||
|
|
||||||
const DEFAULT_GENERATING_TEXT = '生成中…';
|
const DEFAULT_GENERATING_TEXT = '生成中…';
|
||||||
|
|||||||
@ -946,10 +946,11 @@ class ContextManager:
|
|||||||
has_images=has_images
|
has_images=has_images
|
||||||
)
|
)
|
||||||
|
|
||||||
# 复制原对话标题(若存在)
|
# 设置压缩后的对话标题
|
||||||
if original_title:
|
if original_title:
|
||||||
try:
|
try:
|
||||||
self.conversation_manager.update_conversation_title(compressed_conversation_id, original_title)
|
new_title = f"{original_title} 压缩后"
|
||||||
|
self.conversation_manager.update_conversation_title(compressed_conversation_id, new_title)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -970,6 +971,7 @@ class ContextManager:
|
|||||||
}
|
}
|
||||||
|
|
||||||
original_messages = deepcopy(conversation_data.get("messages", []) or [])
|
original_messages = deepcopy(conversation_data.get("messages", []) or [])
|
||||||
|
original_title = conversation_data.get("title")
|
||||||
|
|
||||||
metadata = conversation_data.get("metadata", {})
|
metadata = conversation_data.get("metadata", {})
|
||||||
resolved_project_path = self._resolve_project_path_from_metadata(metadata)
|
resolved_project_path = self._resolve_project_path_from_metadata(metadata)
|
||||||
@ -1002,6 +1004,14 @@ class ContextManager:
|
|||||||
self.conversation_manager._save_conversation_file(duplicate_conversation_id, new_data)
|
self.conversation_manager._save_conversation_file(duplicate_conversation_id, new_data)
|
||||||
self.conversation_manager._update_index(duplicate_conversation_id, new_data)
|
self.conversation_manager._update_index(duplicate_conversation_id, new_data)
|
||||||
|
|
||||||
|
# 设置复制后的对话标题
|
||||||
|
if original_title:
|
||||||
|
try:
|
||||||
|
new_title = f"{original_title} 的副本"
|
||||||
|
self.conversation_manager.update_conversation_title(duplicate_conversation_id, new_title)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"success": True,
|
"success": True,
|
||||||
"duplicate_conversation_id": duplicate_conversation_id
|
"duplicate_conversation_id": duplicate_conversation_id
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user