diff --git a/components/i/Create.vue b/components/i/Create.vue index ae0e20c5eabad370b4295889a003e93f7d072b5d..338416d6c59c6d4c2510b0b59c79cc007a0d3cd0 100644 --- a/components/i/Create.vue +++ b/components/i/Create.vue @@ -40,7 +40,7 @@ const { $setRepo } = useReposStore() const { $getSearchHistory } = useSearchStore() const emits = defineEmits([ 'search' ]) const query = ref('') -const selectedRepo = ref('keycloak') +const selectedRepo = ref('') const loading = ref(false) const cardUI = { body: { @@ -56,10 +56,11 @@ const handleSearch = async () => { if (loading.value || query.value === '') return loading.value = true const currentRepo = $repos.value.find(item => item.label === selectedRepo.value) + const repo_path = currentRepo ? currentRepo.url : '' const { data } = await useRequest('/v1/chat/completion/create', { method: 'post', body: { - repo_path: currentRepo.url, + repo_path, title: query.value } }) diff --git a/pages/search/[id].vue b/pages/search/[id].vue index bb49fd0c5aea1a58ccfddaa6c267bda09764a664..15ddef94f9168f7badd52156f8685991c9bc6187 100644 --- a/pages/search/[id].vue +++ b/pages/search/[id].vue @@ -7,7 +7,7 @@

{{ state.query }}

-
+
{{ state.repo }}
@@ -272,14 +272,12 @@ const generateFetchData = (query) => { messages.push({ role: 'user', content: query }) aiChatController = new AbortController() asking.value = true + const params = { c_id: id, stream: true, messages } + if (gitPath) { + params.repo_path = gitPath + } fetchEventSource('/v1/chat/completions', { - params: { - repo_path: gitPath, - c_id: id, - stream: true, - messages, - // rephrase_question: true - }, + params , onmessage: handleMessage, onerror: handleError, controller: aiChatController