提交 b2db3e24 编写于 作者: D DebugIsFalse

fix: remove

上级 9572d098
......@@ -37,7 +37,6 @@
<script setup>
const { $setRepo } = useReposStore()
const { $repos } = storeToRefs(useReposStore())
const { fetchRequest } = useFetchRequest()
const emits = defineEmits([ 'search' ])
const query = ref('')
const selectedRepo = ref('keycloak')
......@@ -55,7 +54,7 @@ const menuUI = {
const handleSearch = async () => {
if (loading.value || query.value === '') return
loading.value = true
const result = await fetchRequest('/v1/chat/completion/create', {
const result = await useRequest('/v1/chat/completion/create', {
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
......
const BASE_URL = 'https://gpu-pod656e861afe3d944d6b3ce77e-7862.node.inscode.run'
const useFetchRequest = (baseUrl) => {
baseUrl = baseUrl || BASE_URL
const config = {
headers: {}
}
const fetchRequest = (url, fetchConfig) => {
url = `${baseUrl}${url}`
fetchConfig = fetchConfig || {}
fetchConfig.headers = fetchConfig.headers || {}
if (window && window.localStorage) {
fetchConfig.headers.Authorization = localStorage.getItem('token')
}
fetchConfig.method = (fetchConfig.method || 'get').toLocaleUpperCase()
fetchConfig = Object.assign(config, fetchConfig)
return new Promise((resolve, reject) => {
$fetch(url, fetchConfig).then((result) => {
resolve(result)
}).catch(() => {
resolve(null)
})
})
}
return {
fetchRequest
}
}
export default useFetchRequest
\ No newline at end of file
......@@ -46,7 +46,6 @@
</template>
<script setup>
const route = useRoute()
const { fetchRequest } = useFetchRequest()
const { y } = useWindowScroll({ behavior: 'smooth' })
const { directions } = useScroll(window)
const state = reactive({
......@@ -206,7 +205,7 @@ const fetchLinkedQuestion = (query) => {
const { gitPath, id } = state
const messages = []
messages.push({ role: 'user', content: query })
fetchRequest('/v1/chat/recomend_question', {
useFetchRequest('/v1/chat/recomend_question', {
method: 'post',
headers: {
'Content-Type': 'application/json'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册