Skip to content

Commit

Permalink
revert continue to chat logic (#429)
Browse files Browse the repository at this point in the history
* fix test and add link to chat home
  • Loading branch information
swuecho authored May 3, 2024
1 parent 37c636d commit dc62260
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
23 changes: 11 additions & 12 deletions web/src/views/admin/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ const menuOptions: MenuOption[] = reactive([
function handleUpdateCollapsed() {
collapsed.value = !collapsed.value
}
function handleChatHome() {
window.open('static/#/chat/', '_blank')
}
</script>

<template>
Expand All @@ -94,18 +98,13 @@ function handleUpdateCollapsed() {
<h1 v-if="!isMobile" class="flex-1 px-4 pr-6 overflow-hidden cursor-pointer select-none text-ellipsis whitespace-nowrap">
Admin
</h1>
<!-- <div class="flex items-center space-x-2">
<HoverButton>
<span class="text-xl">
<SvgIcon icon="ri:chat-history-line" />
</span>
</HoverButton>
<HoverButton>
<span class="text-xl text-[#4f555e] dark:text-white">
<SvgIcon icon="ri:download-2-line" />
</span>
</HoverButton>
</div> -->
<div class="flex items-center space-x-2">
<HoverButton @click="handleChatHome">
<span class="text-xl text-[#4f555e] dark:text-white">
<SvgIcon icon="ic:baseline-home" />
</span>
</HoverButton>
</div>
</div>
</header>
<NLayout has-sider>
Expand Down
8 changes: 8 additions & 0 deletions web/src/views/snapshot/components/Header/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ function handleHome() {
window.open('#/snapshot_all', '_blank')
}
function handleChatHome() {
window.open('static/#/chat/', '_blank')
}
async function handleEdit(e: Event) {
const title_value = (e.target as HTMLInputElement).innerText
isEditing.value = false
Expand Down Expand Up @@ -57,6 +60,11 @@ async function handleEditTitle() {

<div class="flex mr-5 items-center space-x-2">
<HoverButton @click="handleHome">
<span class="text-xl text-[#4f555e] dark:text-white">
<SvgIcon icon="carbon:table-of-contents" />
</span>
</HoverButton>
<HoverButton @click="handleChatHome">
<span class="text-xl text-[#4f555e] dark:text-white">
<SvgIcon icon="ic:baseline-home" />
</span>
Expand Down
20 changes: 7 additions & 13 deletions web/src/views/snapshot/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import html2canvas from 'html2canvas'
import Message from './components/Message/index.vue'
import { useCopyCode } from './hooks/useCopyCode'
import Header from './components/Header/index.vue'
import { fetchChatSnapshot } from '@/api'
import { CreateSessionFromSnapshot, fetchChatSnapshot } from '@/api'
import { HoverButton, SvgIcon } from '@/components/common'
import { useBasicLayout } from '@/hooks/useBasicLayout'
import { t } from '@/locales'
Expand Down Expand Up @@ -146,10 +146,9 @@ function handleMarkdown() {
async function handleChat() {
if (!authStore.getToken())
nui_msg.error(t('common.ask_user_register'))
// const { SessionUuid }: { SessionUuid: string } = await CreateSessionFromSnapshot(uuid)
// console.log(SessionUuid)
const { SessionUuid }: { SessionUuid: string } = await CreateSessionFromSnapshot(uuid)
// open link at static/#/chat/{SessionUuid}
window.open('static/#/chat/', '_blank')
window.open(`static/#/chat/${SessionUuid}`, '_blank')
}
const footerClass = computed(() => {
Expand All @@ -171,15 +170,10 @@ function onScrollToTop() {
<Header :title="title" />
<main class="flex-1 overflow-hidden">
<div id="scrollRef" ref="scrollRef" class="h-full overflow-hidden overflow-y-auto">
<div
id="image-wrapper" class="w-full max-w-screen-xl m-auto dark:bg-[#101014]"
:class="[isMobile ? 'p-2' : 'p-4']"
>
<Message
v-for="(item, index) of dataSources" :key="index" :date-time="item.dateTime"
:model="model" :text="item.text" :inversion="item.inversion" :error="item.error" :loading="item.loading"
:index="index"
/>
<div id="image-wrapper" class="w-full max-w-screen-xl m-auto dark:bg-[#101014]"
:class="[isMobile ? 'p-2' : 'p-4']">
<Message v-for="(item, index) of dataSources" :key="index" :date-time="item.dateTime" :model="model"
:text="item.text" :inversion="item.inversion" :error="item.error" :loading="item.loading" :index="index" />
</div>
<!-- <div class="flex justify-center items-center">
<HoverButton :tooltip="$t('chat_snapshot.continueChat')" @click="handleChat">
Expand Down

0 comments on commit dc62260

Please sign in to comment.