-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(temp): multiple chat instances without persistance * Update layout to allow navigation-drawer function * Rename to ChatDrawer * Add multi chat logic * Format whitespace diff * Use v-if to check hide instead of filter * Update current translation for more clarity * Add time when creating new chat * Edit chat title style, icon size * Skip selectChat when same index as current * Add shortcut for toggle chat drawer * Add shortcut for create new chat * Open chat drawer to show new chat shortcut * Remove comment * Fix style * Update drawer shortcut to ctrl + d * Fix warn * Remove unuse code * Set cursor to wait after selecting chat * Save isChatDrawerOpen * Re-render chat thread when chat index changed * Fix v-textarea scrollbar missing in v-bottom-navigation --------- Co-authored-by: Lucas Robin <[email protected]>
- Loading branch information
1 parent
c94dd06
commit a82456d
Showing
11 changed files
with
534 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<template> | ||
<v-navigation-drawer permanent :model-value="props.open"> | ||
<v-list nav> | ||
<v-list-item | ||
:id="SHORTCUT_NEW_CHAT.elementId" | ||
density="comfortable" | ||
class="mb-1 border" | ||
:title="$t('chat.newChat')" | ||
@click="onAddNewChat" | ||
@shortkey="onAddNewChat" | ||
v-shortkey.once="SHORTCUT_NEW_CHAT.key" | ||
> | ||
<template v-slot:prepend> | ||
<v-icon color="primary"> mdi-plus </v-icon> | ||
</template> | ||
</v-list-item> | ||
</v-list> | ||
|
||
<template v-for="chat in store.state.chats.slice().reverse()"> | ||
<ChatDrawerItem | ||
v-if="!chat.hide" | ||
:chat="chat" | ||
@confirm-hide-chat="confirmHideChat" | ||
:key="chat.index" | ||
></ChatDrawerItem> | ||
</template> | ||
</v-navigation-drawer> | ||
<ConfirmModal ref="confirmModal" /> | ||
</template> | ||
|
||
<script setup> | ||
import { ref, onUpdated } from "vue"; | ||
import { useStore } from "vuex"; | ||
import i18n from "@/i18n"; | ||
import ConfirmModal from "@/components/ConfirmModal.vue"; | ||
import ChatDrawerItem from "@/components/ChatDrawer/ChatDrawerItem.vue"; | ||
import { SHORTCUT_NEW_CHAT } from "@/components/ShortcutGuide/shortcut.const"; | ||
const store = useStore(); | ||
const props = defineProps(["open"]); | ||
const emit = defineEmits(["update:open", "createChat"]); | ||
onUpdated(setIsChatDrawerOpen); | ||
const confirmModal = ref(null); | ||
function setIsChatDrawerOpen() { | ||
store.commit("setIsChatDrawerOpen", props.open); | ||
} | ||
function onAddNewChat() { | ||
store.commit("createChat"); | ||
store.commit("selectChat", store.state.chats.length - 1); | ||
emit("createChat"); | ||
} | ||
async function confirmHideChat() { | ||
const result = await confirmModal.value.showModal( | ||
i18n.global.t("modal.confirmHideChat"), | ||
); | ||
if (result) { | ||
store.commit("hideChat"); | ||
} | ||
} | ||
</script> | ||
<style scoped> | ||
:deep() .v-list-item-title { | ||
font-size: 1rem!important; | ||
} | ||
</style> |
Oops, something went wrong.
a82456d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
chatall – ./
chatall-git-main-sunner.vercel.app
chatall-llm.vercel.app
chatall-sunner.vercel.app