1.返回聊天时,改为跳转至上次的聊天Agent

2.排程记录界面增加横纵向滚动
This commit is contained in:
hugo committed 2026-05-26 20:00:18 +08:00
1 parent 71dcfd8ca4
commit 3642ed8529
4 files changed
+95 -58

No files matched your search

+21 -3
View File
@@ -25,6 +25,7 @@ import { useIsMobile } from '../composables/useIsMobile';
import { useTheme } from '../composables/useTheme';
import { getAuthHeaders, getStoredAuthUser, clearAuthUser } from '../utils/auth';
import { copyTextToClipboard } from '../utils/clipboard';
import { setLastChatAgentId } from '../utils/lastChatAgent';
const { t, locale } = useI18n();
const { appliedTheme, toggleLightDark } = useTheme();
@@ -1876,10 +1877,18 @@ const loadUserAgents = async () => {
const switchToAgent = (agent: { id: number; name: string }) => {
if (agent.id === agentId) return;
setLastChatAgentId(agent.id);
const url = router.resolve(`/chat/${agent.id}`).href;
window.open(url, '_blank');
};
const goToWorkspace = (view?: string) => {
setLastChatAgentId(Number(route.params.agentId));
const query: Record<string, string> = { no_redirect: '1' };
if (view) query.view = view;
router.push({ path: '/workspace', query });
};
// 组件挂载时,如果存在预设问题,则自动触发一次发送
onMounted(async () => {
document.addEventListener('mousedown', handleDocumentPointerDown);
@@ -1888,6 +1897,7 @@ onMounted(async () => {
document.addEventListener('touchstart', handleMobileAgentPopoverClickOutside, { passive: true });
window.addEventListener('resize', syncViewportWidth);
await syncCurrentUserProfile();
setLastChatAgentId(Number(route.params.agentId));
await loadAgent();
await loadUserAgents();
@@ -1907,6 +1917,14 @@ onMounted(async () => {
scheduleScrollChatToBottom();
});
watch(
() => route.params.agentId,
(id) => {
const nextId = Number(id);
if (Number.isFinite(nextId) && nextId > 0) setLastChatAgentId(nextId);
}
);
onBeforeUnmount(() => {
document.removeEventListener('mousedown', handleDocumentPointerDown);
document.removeEventListener('touchstart', handleDocumentPointerDown);
@@ -1983,7 +2001,7 @@ const showChatRating = ref(false);
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
</div>
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('chat.generalFeedback')"><MessageSquareText class="h-5 w-5" /></button>
<button @click="router.push('/workspace?no_redirect=1')" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('workspace.title')"><Briefcase class="h-5 w-5" /></button>
<button @click="goToWorkspace()" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('workspace.title')"><Briefcase class="h-5 w-5" /></button>
</div>
</div>
</template>
@@ -2104,7 +2122,7 @@ const showChatRating = ref(false);
<Moon v-else class="h-4 w-4" />
</button>
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('chat.generalFeedback')"><MessageSquareText class="h-4 w-4" /></button>
<button @click="router.push('/workspace?no_redirect=1')" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('workspace.title')"><Briefcase class="h-4 w-4" /></button>
<button @click="goToWorkspace()" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('workspace.title')"><Briefcase class="h-4 w-4" /></button>
</div>
</div>
</div>
@@ -2122,7 +2140,7 @@ const showChatRating = ref(false);
<button @click="toggleMobileAgentPopover" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" :title="$t('chat.agents')">
<LayoutGrid class="h-5 w-5" />
</button>
<button @click="router.push('/workspace?view=history')" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" :title="$t('chat.history')">
<button @click="goToWorkspace('history')" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" :title="$t('chat.history')">
<History class="h-5 w-5" />
</button>
</div>