From f7c6e4a180717f14699b14d972eb340933ad13b9 Mon Sep 17 00:00:00 2001 From: Aresn Date: Mon, 27 May 2024 17:23:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=AE=B0=E5=BD=95=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=94=BE=F0=9F=8D=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/i/Create.vue | 2 ++ components/i/SearchHistory.vue | 24 ++++++++++++------------ stores/search.js | 12 ++++++++++++ 3 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 stores/search.js diff --git a/components/i/Create.vue b/components/i/Create.vue index e117557..8a27a07 100644 --- a/components/i/Create.vue +++ b/components/i/Create.vue @@ -37,6 +37,7 @@ diff --git a/stores/search.js b/stores/search.js new file mode 100644 index 0000000..c7acc12 --- /dev/null +++ b/stores/search.js @@ -0,0 +1,12 @@ +import { defineStore } from 'pinia' + +export const useSearchStore = defineStore('search', () => { + const { $isSignIn } = useUserStore() + const $searchHistory = ref([]) + async function $getSearchHistory () { + if (!$isSignIn) return + const { data } = await useRequest('/v1/chat/completion/list') + $searchHistory.value = data.value.data + } + return { $searchHistory, $getSearchHistory } +}) -- GitLab