提交 48b9c8a3 编写于 作者: D DebugIsFalse

merge pull

上级 a76cc9e3
...@@ -17,17 +17,32 @@ ...@@ -17,17 +17,32 @@
<UButton <UButton
trailing-icon="i-heroicons-chevron-right-20-solid" trailing-icon="i-heroicons-chevron-right-20-solid"
@click="handleSearch" @click="handleSearch"
:disabled="loading"
>搜索</UButton> >搜索</UButton>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
const { fetchRequest } = useFetchRequest()
const emits = defineEmits([ 'search' ]) const emits = defineEmits([ 'search' ])
const query = ref('') const query = ref('')
const selectedRepo = ref('https://github.com/keycloak/keycloak.git') const selectedRepo = ref('https://github.com/keycloak/keycloak.git')
const repos = ['keycloak', 'ViewUIPlus'] const repos = ['keycloak', 'ViewUIPlus']
const handleSearch = () => { const loading = ref(false);
navigateTo(`/search/1?query=${query.value}&repo=${selectedRepo.value}`) const handleSearch = async () => {
emits('search') if (loading.value) return;
loading.value = true;
const result = await fetchRequest('/v1/chat/completion/create', {
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
if (result && result.data) {
navigateTo(`/search/${result.data.c_id}?query=${query.value}&repo=${selectedRepo.value}`);
nextTick(() => {
loading.value = false;
})
}
} }
</script> </script>
...@@ -4,25 +4,4 @@ ...@@ -4,25 +4,4 @@
</div> </div>
</template> </template>
<script setup> <script setup>
const { fetchRequest } = useFetchRequest()
const query = ref('')
const selectedRepo = ref('https://github.com/keycloak/keycloak.git')
const repos = ['keycloak', 'ViewUIPlus']
const loading = ref(false);
const handleSearch = async () => {
if (loading.value) return;
loading.value = true;
const result = await fetchRequest('/v1/chat/completion/create', {
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
if (result && result.data) {
navigateTo(`/search/${result.data.c_id}?query=${query.value}&repo=${selectedRepo.value}`);
nextTick(() => {
loading.value = false;
})
}
}
</script> </script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册