fix session links profile filtering (#979)
This commit is contained in:
@@ -61,11 +61,9 @@ let mobileQuery: MediaQueryList | null = null;
|
|||||||
const isMobile = ref(false);
|
const isMobile = ref(false);
|
||||||
|
|
||||||
function sessionHref(sessionId: string) {
|
function sessionHref(sessionId: string) {
|
||||||
const profile = sessionProfile(sessionId);
|
|
||||||
return router.resolve({
|
return router.resolve({
|
||||||
name: "hermes.session",
|
name: "hermes.session",
|
||||||
params: { sessionId },
|
params: { sessionId },
|
||||||
query: profile ? { profile } : undefined,
|
|
||||||
}).href;
|
}).href;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,11 +73,9 @@ function openSessionInNewTab(sessionId: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleSessionClick(sessionId: string) {
|
async function handleSessionClick(sessionId: string) {
|
||||||
const session = chatStore.sessions.find((item) => item.id === sessionId);
|
|
||||||
await router.push({
|
await router.push({
|
||||||
name: "hermes.session",
|
name: "hermes.session",
|
||||||
params: { sessionId },
|
params: { sessionId },
|
||||||
query: session?.profile ? { profile: session.profile } : undefined,
|
|
||||||
});
|
});
|
||||||
if (mobileQuery?.matches) showSessions.value = false;
|
if (mobileQuery?.matches) showSessions.value = false;
|
||||||
}
|
}
|
||||||
@@ -283,7 +279,6 @@ async function confirmNewChat() {
|
|||||||
await router.push({
|
await router.push({
|
||||||
name: "hermes.session",
|
name: "hermes.session",
|
||||||
params: { sessionId: session.id },
|
params: { sessionId: session.id },
|
||||||
query: session.profile ? { profile: session.profile } : undefined,
|
|
||||||
});
|
});
|
||||||
showNewChatModal.value = false;
|
showNewChatModal.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export default {
|
|||||||
monitorRoleUser: 'Benutzer',
|
monitorRoleUser: 'Benutzer',
|
||||||
monitorRoleAssistant: 'Assistent',
|
monitorRoleAssistant: 'Assistent',
|
||||||
copySessionLink: 'Sitzungslink kopieren',
|
copySessionLink: 'Sitzungslink kopieren',
|
||||||
openSessionInNewTab: 'Open in new tab',
|
openSessionInNewTab: 'In neuem Tab öffnen',
|
||||||
sessionLinkCopied: 'Session link copied',
|
sessionLinkCopied: 'Session link copied',
|
||||||
copySessionId: 'Sitzungs-ID kopieren',
|
copySessionId: 'Sitzungs-ID kopieren',
|
||||||
export: 'Exportieren',
|
export: 'Exportieren',
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export default {
|
|||||||
monitorRoleUser: 'Usuario',
|
monitorRoleUser: 'Usuario',
|
||||||
monitorRoleAssistant: 'Asistente',
|
monitorRoleAssistant: 'Asistente',
|
||||||
copySessionLink: 'Copiar enlace de sesión',
|
copySessionLink: 'Copiar enlace de sesión',
|
||||||
openSessionInNewTab: 'Open in new tab',
|
openSessionInNewTab: 'Abrir en una nueva pestaña',
|
||||||
sessionLinkCopied: 'Session link copied',
|
sessionLinkCopied: 'Session link copied',
|
||||||
copySessionId: 'Copiar ID de sesión',
|
copySessionId: 'Copiar ID de sesión',
|
||||||
export: 'Exportar',
|
export: 'Exportar',
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export default {
|
|||||||
monitorRoleUser: 'Utilisateur',
|
monitorRoleUser: 'Utilisateur',
|
||||||
monitorRoleAssistant: 'Assistant',
|
monitorRoleAssistant: 'Assistant',
|
||||||
copySessionLink: 'Copier le lien de session',
|
copySessionLink: 'Copier le lien de session',
|
||||||
openSessionInNewTab: 'Open in new tab',
|
openSessionInNewTab: 'Ouvrir dans un nouvel onglet',
|
||||||
sessionLinkCopied: 'Session link copied',
|
sessionLinkCopied: 'Session link copied',
|
||||||
copySessionId: "Copier l'ID de session",
|
copySessionId: "Copier l'ID de session",
|
||||||
export: 'Exporter',
|
export: 'Exporter',
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export default {
|
|||||||
monitorRoleUser: 'ユーザー',
|
monitorRoleUser: 'ユーザー',
|
||||||
monitorRoleAssistant: 'アシスタント',
|
monitorRoleAssistant: 'アシスタント',
|
||||||
copySessionLink: 'セッションリンクをコピー',
|
copySessionLink: 'セッションリンクをコピー',
|
||||||
openSessionInNewTab: 'Open in new tab',
|
openSessionInNewTab: '新しいタブで開く',
|
||||||
sessionLinkCopied: 'Session link copied',
|
sessionLinkCopied: 'Session link copied',
|
||||||
copySessionId: 'セッション ID をコピー',
|
copySessionId: 'セッション ID をコピー',
|
||||||
export: 'エクスポート',
|
export: 'エクスポート',
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export default {
|
|||||||
monitorRoleUser: '사용자',
|
monitorRoleUser: '사용자',
|
||||||
monitorRoleAssistant: '어시스턴트',
|
monitorRoleAssistant: '어시스턴트',
|
||||||
copySessionLink: '세션 링크 복사',
|
copySessionLink: '세션 링크 복사',
|
||||||
openSessionInNewTab: 'Open in new tab',
|
openSessionInNewTab: '새 탭에서 열기',
|
||||||
sessionLinkCopied: 'Session link copied',
|
sessionLinkCopied: 'Session link copied',
|
||||||
copySessionId: '세션 ID 복사',
|
copySessionId: '세션 ID 복사',
|
||||||
export: '내보내기',
|
export: '내보내기',
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export default {
|
|||||||
monitorRoleUser: 'Usuário',
|
monitorRoleUser: 'Usuário',
|
||||||
monitorRoleAssistant: 'Assistente',
|
monitorRoleAssistant: 'Assistente',
|
||||||
copySessionLink: 'Copiar link da sessão',
|
copySessionLink: 'Copiar link da sessão',
|
||||||
openSessionInNewTab: 'Open in new tab',
|
openSessionInNewTab: 'Abrir em nova aba',
|
||||||
sessionLinkCopied: 'Session link copied',
|
sessionLinkCopied: 'Session link copied',
|
||||||
copySessionId: 'Copiar ID da sessão',
|
copySessionId: 'Copiar ID da sessão',
|
||||||
export: 'Exportar',
|
export: 'Exportar',
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ export default {
|
|||||||
monitorRoleUser: '使用者',
|
monitorRoleUser: '使用者',
|
||||||
monitorRoleAssistant: '助手',
|
monitorRoleAssistant: '助手',
|
||||||
copySessionLink: '複製工作階段連結',
|
copySessionLink: '複製工作階段連結',
|
||||||
openSessionInNewTab: 'Open in new tab',
|
openSessionInNewTab: '在新分頁開啟',
|
||||||
sessionLinkCopied: 'Session link copied',
|
sessionLinkCopied: 'Session link copied',
|
||||||
copySessionId: '複製工作階段 ID',
|
copySessionId: '複製工作階段 ID',
|
||||||
export: '匯出',
|
export: '匯出',
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ export default {
|
|||||||
monitorRoleUser: '用户',
|
monitorRoleUser: '用户',
|
||||||
monitorRoleAssistant: '助手',
|
monitorRoleAssistant: '助手',
|
||||||
copySessionLink: '复制会话链接',
|
copySessionLink: '复制会话链接',
|
||||||
openSessionInNewTab: 'Open in new tab',
|
openSessionInNewTab: '在新标签页打开',
|
||||||
sessionLinkCopied: 'Session link copied',
|
sessionLinkCopied: 'Session link copied',
|
||||||
copySessionId: '复制会话 ID',
|
copySessionId: '复制会话 ID',
|
||||||
export: '导出',
|
export: '导出',
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const routeProfile = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
async function loadRouteSession() {
|
async function loadRouteSession() {
|
||||||
await chatStore.loadSessions(routeProfile.value, routeSessionId.value)
|
await chatStore.loadSessions(chatStore.sessionProfileFilter, routeSessionId.value)
|
||||||
if (routeSessionId.value && chatStore.activeSessionId !== routeSessionId.value) {
|
if (routeSessionId.value && chatStore.activeSessionId !== routeSessionId.value) {
|
||||||
await router.replace({ name: 'hermes.chat' })
|
await router.replace({ name: 'hermes.chat' })
|
||||||
}
|
}
|
||||||
@@ -45,19 +45,14 @@ onMounted(async () => {
|
|||||||
watch([routeSessionId, routeProfile], async ([sessionId]) => {
|
watch([routeSessionId, routeProfile], async ([sessionId]) => {
|
||||||
if (!chatStore.sessionsLoaded) return
|
if (!chatStore.sessionsLoaded) return
|
||||||
if (!sessionId) {
|
if (!sessionId) {
|
||||||
await chatStore.loadSessions(routeProfile.value)
|
await chatStore.loadSessions(chatStore.sessionProfileFilter)
|
||||||
return
|
|
||||||
}
|
|
||||||
if (chatStore.activeSessionId === sessionId && (!routeProfile.value || chatStore.activeSession?.profile === routeProfile.value)) return
|
|
||||||
|
|
||||||
if (routeProfile.value) {
|
|
||||||
await loadRouteSession()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (chatStore.activeSessionId === sessionId) return
|
||||||
|
|
||||||
const exists = chatStore.sessions.some(session => session.id === sessionId)
|
const exists = chatStore.sessions.some(session => session.id === sessionId)
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
await router.replace({ name: 'hermes.chat' })
|
await loadRouteSession()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ test('session rows expose native session links', async ({ page }) => {
|
|||||||
await page.goto('/#/hermes/chat')
|
await page.goto('/#/hermes/chat')
|
||||||
|
|
||||||
const sessionLink = page.locator('.session-items a.session-item').first()
|
const sessionLink = page.locator('.session-items a.session-item').first()
|
||||||
await expect(sessionLink).toHaveAttribute('href', '#/hermes/session/session-native-1?profile=research')
|
await expect(sessionLink).toHaveAttribute('href', '#/hermes/session/session-native-1')
|
||||||
await expect(sessionLink).toContainText('Native Link Session')
|
await expect(sessionLink).toContainText('Native Link Session')
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user