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

merge pull

上级 a76cc9e3
......@@ -17,17 +17,32 @@
<UButton
trailing-icon="i-heroicons-chevron-right-20-solid"
@click="handleSearch"
:disabled="loading"
>搜索</UButton>
</div>
</div>
</template>
<script setup>
const { fetchRequest } = useFetchRequest()
const emits = defineEmits([ 'search' ])
const query = ref('')
const selectedRepo = ref('https://github.com/keycloak/keycloak.git')
const repos = ['keycloak', 'ViewUIPlus']
const handleSearch = () => {
navigateTo(`/search/1?query=${query.value}&repo=${selectedRepo.value}`)
emits('search')
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>
......@@ -4,25 +4,4 @@
</div>
</template>
<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>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册