diff --git a/archive/SearchHistory.vue b/archive/SearchHistory.vue
new file mode 100644
index 0000000000000000000000000000000000000000..f2a1bfcdd1e9a18cab25d3d328175643a60889f7
--- /dev/null
+++ b/archive/SearchHistory.vue
@@ -0,0 +1,145 @@
+
+
+
+
+
+
+
+
+
+ {{ item.title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.title }}
+
+
+
+
+
+
+
diff --git a/components/i/Create.vue b/components/i/Create.vue
index f86d062ce3608ca3c5759875c67f1ead92a7531a..f94cb33599114878a13272b93cd386caa2163d3e 100644
--- a/components/i/Create.vue
+++ b/components/i/Create.vue
@@ -51,7 +51,7 @@
diff --git a/pages/md.vue b/pages/md.vue
deleted file mode 100644
index 551fa0d73dabb5adfbfb07ff43c1997d6ac9fe14..0000000000000000000000000000000000000000
--- a/pages/md.vue
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/md2.vue b/pages/md2.vue
deleted file mode 100644
index 589e4ccf139b0aff25a686db6c8339643721d59a..0000000000000000000000000000000000000000
--- a/pages/md2.vue
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/test.vue b/pages/test.vue
deleted file mode 100644
index 23d1e60525b795b010a9af8edbeb3ae7125785e8..0000000000000000000000000000000000000000
--- a/pages/test.vue
+++ /dev/null
@@ -1,7 +0,0 @@
-
- Test
- {{ data }}
-
-
diff --git a/stores/search.js b/stores/search.js
index 3467f37f2aa3980caf6cc70fdc9be7c2840764e6..6ded9e0033430d6cd8d45e7404d6b401c72af20c 100644
--- a/stores/search.js
+++ b/stores/search.js
@@ -1,19 +1,28 @@
import { defineStore } from 'pinia'
+import { useStorage } from '@vueuse/core'
+
+const searchHistory = useStorage('search-history', '')
export const useSearchStore = defineStore('search', () => {
- const { $isSignIn } = useUserStore()
- const $searchHistory = ref([])
- const $firstRecordTitle = ref('')
- async function $getSearchHistory () {
- if (!$isSignIn) return
- const { data } = await useRequest('/v1/chat/completion/list')
- $searchHistory.value = data.value.data
+ const $searchHistory = computed(() => searchHistory.value ? JSON.parse(searchHistory.value) : [])
+ function $setSearchHistory (item) {
+ const history = searchHistory.value ? JSON.parse(searchHistory.value) : []
+ history.push(item)
+ searchHistory.value = JSON.stringify(history)
+ }
+ function $clearSearchHistory () {
+ searchHistory.value = ''
}
+
+ const $firstRecordTitle = ref('')
function $setFirstRecordTitle (article) {
$firstRecordTitle.value = article
}
return {
- $searchHistory, $getSearchHistory,
- $firstRecordTitle, $setFirstRecordTitle
+ $searchHistory,
+ $setSearchHistory,
+ $clearSearchHistory,
+ $firstRecordTitle,
+ $setFirstRecordTitle
}
})