diff --git a/components/i/Create.vue b/components/i/Create.vue index fd6ee85c8d5a833dcdf50fcb59f54bb16cb198bb..e11755776d34e86a89b3e19417d92cdfe6faec2e 100644 --- a/components/i/Create.vue +++ b/components/i/Create.vue @@ -54,7 +54,14 @@ const menuUI = { const handleSearch = async () => { if (loading.value || query.value === '') return loading.value = true - const { data } = await useRequest('/v1/chat/completion/create', { method: 'post' }) + const currentRepo = $repos.value.find(item => item.label === selectedRepo.value) + const { data } = await useRequest('/v1/chat/completion/create', { + method: 'post', + body: { + repo_path: currentRepo.url, + title: query.value + } + }) navigateTo(`/search/${data.value.data.c_id}`) emits('search') nextTick(() => { diff --git a/components/i/SearchHistory.vue b/components/i/SearchHistory.vue index 734c0f1da4d995c0a0fc0ed66cd458263811eba0..efc8ad1a536e3bf588c46788f3413ade2cd9b148 100644 --- a/components/i/SearchHistory.vue +++ b/components/i/SearchHistory.vue @@ -87,10 +87,9 @@ function handleRemoveRecords (ids) { } useRequest('/v1/chat/completion/remove', { method: 'post', - body: ids, - headers: { - 'Content-Type': 'application/json' - } + body: ids + }).finally(() => { + navigateTo('/') }) } function handleOpen () { diff --git a/composables/useRequest.js b/composables/useRequest.js index ad6c5a9c97737f2d4957b2abc726c4bdebd4cf46..6012c63dd3dbe237924d286b74757fe7f1d88386 100644 --- a/composables/useRequest.js +++ b/composables/useRequest.js @@ -6,7 +6,7 @@ const request = async (url, options = {}) => { const config = { method: options.method || 'get', headers: { - 'Content-Type': 'application/x-www-form-urlencoded', + 'Content-Type': 'application/json', 'Authorization': token }, onRequest({ request, options }) { diff --git a/pages/search/[id].vue b/pages/search/[id].vue index ac3f94d73e4b4122ca984b39a24b8f948b976f2b..4d7a54c787bddd2bbd8e72394a5d6f9e6332788e 100644 --- a/pages/search/[id].vue +++ b/pages/search/[id].vue @@ -2,13 +2,15 @@