From 147b6f705b55c1dc81544787564ee7bdc4a7ea95 Mon Sep 17 00:00:00 2001 From: Reza Rahemtola Date: Fri, 26 Jul 2024 13:44:40 +0200 Subject: [PATCH 1/9] feat: Dark mode moved in settings and new chat username --- src/components/ToggleTheme.vue | 32 --------------------------- src/components/UserSettingsDialog.vue | 13 ++++++++++- src/layouts/MainLayout.vue | 2 -- src/pages/NewChat.vue | 9 ++++++-- 4 files changed, 19 insertions(+), 37 deletions(-) delete mode 100644 src/components/ToggleTheme.vue diff --git a/src/components/ToggleTheme.vue b/src/components/ToggleTheme.vue deleted file mode 100644 index 8009fd5..0000000 --- a/src/components/ToggleTheme.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - diff --git a/src/components/UserSettingsDialog.vue b/src/components/UserSettingsDialog.vue index d0d0672..5bbdd42 100644 --- a/src/components/UserSettingsDialog.vue +++ b/src/components/UserSettingsDialog.vue @@ -23,6 +23,10 @@ + + + + @@ -57,12 +61,15 @@ import { useSettingsStore } from 'stores/settings'; import { ref, toRaw, toRef, watch } from 'vue'; import AlephAvatar from 'components/AlephAvatar.vue'; +import { useQuasar } from 'quasar'; const settingsStore = useSettingsStore(); +const $q = useQuasar(); // Form values const username = ref(settingsStore.username); const avatar = ref(settingsStore.avatar); +const darkmode = ref(settingsStore.darkmode); const isSignatureHashStored = ref(settingsStore.isSignatureHashStored); // Update the inputs when the store changes (might be updated by Aleph settings fetching) @@ -72,6 +79,10 @@ watch(toRef(settingsStore, 'username'), () => { watch(toRef(settingsStore, 'avatar'), () => { avatar.value = settingsStore.avatar; }); +watch(toRef(settingsStore, 'darkmode'), () => { + $q.dark.set(settingsStore.darkmode); + darkmode.value = settingsStore.darkmode; +}); watch(toRef(settingsStore, 'isSignatureHashStored'), () => { isSignatureHashStored.value = settingsStore.isSignatureHashStored; }); diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 51c1daf..0430e7f 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -11,7 +11,6 @@ -
@@ -183,7 +182,6 @@ import { useRoute, useRouter } from 'vue-router'; import AccountButton from 'src/components/AccountButton.vue'; import UserSettingsDialog from 'components/UserSettingsDialog.vue'; import { useAccount } from '@wagmi/vue'; -import ToggleTheme from 'components/ToggleTheme.vue'; import { useAccountStore } from 'stores/account'; const leftDrawerOpen = ref(false); diff --git a/src/pages/NewChat.vue b/src/pages/NewChat.vue index 273fbdb..9dd5f45 100644 --- a/src/pages/NewChat.vue +++ b/src/pages/NewChat.vue @@ -24,6 +24,10 @@ @select-model="(model: UIModel) => (selectedModel = model)" /> + + Your name + +
@@ -62,13 +66,14 @@ const router = useRouter(); const modelsStore = useModelsStore(); const chatsStore = useChatsStore(); const personasStore = usePersonasStore(); +const settingsStore = useSettingsStore(); -const username = useSettingsStore().username; const route = useRoute(); // Inputs const selectedModel = ref(modelsStore.models[0]); const selectedPersona = ref(personasStore.personas[0]); +const username = ref(settingsStore.username); watch( () => route.query.persona as string | undefined, @@ -92,7 +97,7 @@ async function sendMessage({ content, attachments }: SendMessageParams) { const persona = JSON.parse(JSON.stringify(selectedPersona.value)); // Creates the new chat - const chat = await chatsStore.createChat(title, username, selectedModel.value.id, persona); + const chat = await chatsStore.createChat(title, username.value, selectedModel.value.id, persona); // Append the first user message to the chat history await chatsStore.appendUserMessage(chat.id, content, attachments); From 01a90a368f6b663a4c4fdb4f050b886af0cece8f Mon Sep 17 00:00:00 2001 From: Reza Rahemtola Date: Fri, 26 Jul 2024 15:03:29 +0200 Subject: [PATCH 2/9] feat: Chat settings dropdown --- public/icons/delete.svg | 4 +- public/icons/delete_lighten.svg | 5 ++ src/components/ChatsList.vue | 102 +++++++++++++++++++++++++ src/components/UserSettingsDialog.vue | 1 - src/layouts/MainLayout.vue | 105 +------------------------- src/stores/chats.ts | 28 +++---- src/stores/settings.ts | 2 + src/types/chats.ts | 3 +- 8 files changed, 125 insertions(+), 125 deletions(-) create mode 100644 public/icons/delete_lighten.svg create mode 100644 src/components/ChatsList.vue diff --git a/public/icons/delete.svg b/public/icons/delete.svg index afc58d0..f4d1773 100644 --- a/public/icons/delete.svg +++ b/public/icons/delete.svg @@ -1,3 +1,5 @@ - + diff --git a/public/icons/delete_lighten.svg b/public/icons/delete_lighten.svg new file mode 100644 index 0000000..0339700 --- /dev/null +++ b/public/icons/delete_lighten.svg @@ -0,0 +1,5 @@ + + + diff --git a/src/components/ChatsList.vue b/src/components/ChatsList.vue new file mode 100644 index 0000000..77ee9f9 --- /dev/null +++ b/src/components/ChatsList.vue @@ -0,0 +1,102 @@ + + + diff --git a/src/components/UserSettingsDialog.vue b/src/components/UserSettingsDialog.vue index 5bbdd42..d876786 100644 --- a/src/components/UserSettingsDialog.vue +++ b/src/components/UserSettingsDialog.vue @@ -80,7 +80,6 @@ watch(toRef(settingsStore, 'avatar'), () => { avatar.value = settingsStore.avatar; }); watch(toRef(settingsStore, 'darkmode'), () => { - $q.dark.set(settingsStore.darkmode); darkmode.value = settingsStore.darkmode; }); watch(toRef(settingsStore, 'isSignatureHashStored'), () => { diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 0430e7f..1a29454 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -60,77 +60,8 @@ New Chat
- - - - - - - - - - - - - - {{ chat.title }} - - - - - - Delete chat - - - - - - - - - - Are you sure you want to delete the current chat conversation? - - - - - - - - - + persona @@ -171,51 +102,21 @@ diff --git a/src/components/PersonaDialog.vue b/src/components/dialog/PersonaDialog.vue similarity index 100% rename from src/components/PersonaDialog.vue rename to src/components/dialog/PersonaDialog.vue diff --git a/src/components/UserSettingsDialog.vue b/src/components/dialog/UserSettingsDialog.vue similarity index 100% rename from src/components/UserSettingsDialog.vue rename to src/components/dialog/UserSettingsDialog.vue diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 1a29454..0a53c69 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -104,7 +104,7 @@ diff --git a/src/components/dialog/UserSettingsDialog.vue b/src/components/dialog/UserSettingsDialog.vue index d876786..9e4df03 100644 --- a/src/components/dialog/UserSettingsDialog.vue +++ b/src/components/dialog/UserSettingsDialog.vue @@ -1,7 +1,7 @@