feat: add clear session messages functionality

- Implemented a new API endpoint to clear all messages in a session, enhancing session management capabilities.
- Updated the frontend to include a clear messages option in the session menu, allowing users to easily remove chat history.
- Added localization support for the new feature in English, Korean, Russian, and Chinese, improving accessibility for a broader audience.
- Enhanced the chat view to handle session message clearing events, ensuring a responsive user experience.

These changes significantly improve the user experience by providing a straightforward method to manage session messages effectively.
This commit is contained in:
wizardchen
2026-03-12 21:47:12 +08:00
parent e4bb97ff67
commit de0e93d9bb
12 changed files with 122 additions and 2 deletions
+11
View File
@@ -955,7 +955,15 @@ const updateAssistantSession = (payload) => {
}
scrollToBottom();
}
const handleSessionCleared = (e) => {
if (e.detail?.sessionId === session_id.value) {
messagesList.splice(0);
created_at.value = '';
}
};
onMounted(async () => {
window.addEventListener('session-messages-cleared', handleSessionCleared);
messagesList.splice(0);
// 若从智能体列表点击共享智能体进入,URL 带 agent_id 与 source_tenant_id,同步到 store
@@ -1001,6 +1009,9 @@ const clearData = () => {
userquery.value = '';
}
onUnmounted(() => {
window.removeEventListener('session-messages-cleared', handleSessionCleared);
});
onBeforeRouteLeave((to, from, next) => {
clearData()
next()