提交 ae3bc2c4 编写于 作者: D DebugIsFalse

fix: 搜索历史

上级 b6c40a51
......@@ -68,24 +68,7 @@
const emits = defineEmits(['sign', 'clear'])
const Layout = inject('Layout')
const { $isSignIn } = useUserStore()
const searchHistory = ref([
{
title: 'Vue 的 v-model 怎么用',
url: 'c_20240521161631_C8miVoieSKGfgNGP?query=Vue%20的%20v-model%20怎么用&repo=keycloak'
},
{
title: '帮我写一个爬虫,爬取豆瓣热门电影top250',
url: 'c_20240521161649_0LbyaJFKX6fyJYyA?query=帮我写一个爬虫,爬取豆瓣热门电影top250&repo=keycloak'
},
{
title: 'grid 的 grid-template-columns 除了 minmax 和 repeat,还有哪些值',
url: 'c_20240521161709_LtiJL8thi5XuYLd6?query=grid%20的%20grid-template-columns%20除了%20minmax%20和%20repeat,还有哪些值&repo=keycloak'
},
{
title: 'flex 各种布局的区别',
url: 'c_20240521161933_wxgXGKYhmfJe6QE0?query=flex%20各种布局的区别&repo=keycloak'
}
])
const searchHistory = ref([])
function handleClear () {
emits('clear')
}
......@@ -103,4 +86,11 @@ function handleClose () {
function handleClickItem () {
Layout.handleCloseAside()
}
async function getUserHistory () {
const { data, error } = await useRequest('/v1/chat/completion/list', { server: false })
if (!error.value) {
searchHistory.value = data.value && data.value.data || []
}
}
getUserHistory()
</script>
import { useStorage } from '@vueuse/core'
const BASE_URL = 'https://gpu-pod656e861afe3d944d6b3ce77e-7862.node.inscode.run'
const request = async (url, options = {}) => {
const token = useStorage('token')
const fullUrl = BASE_URL + url
const config = {
method: options.method || 'get',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': token
},
onRequest({ request, options }) {
// 设置请求头
......
......@@ -211,6 +211,7 @@ const handleStopGenerate = () => {
})
}
const handleError = (event) => {
console.log(222)
handleStopGenerate()
}
const fetchLinkedQuestion = (query) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册