<template>
    <div class="flex items-center justify-center w-full h-full">
        <ICreate />
    </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>
