提交 53746db3 编写于 作者: D DebugIsFalse

Merge branch 'main' of gitcode.com:git_bot/ai-fe

...@@ -55,19 +55,21 @@ const handleSearch = async () => { ...@@ -55,19 +55,21 @@ const handleSearch = async () => {
} }
} }
let repoData = await fetchRequest('/v1/chat/repository', { if (!$repos.length) {
let repoData = await fetchRequest('/v1/chat/repository', {
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
} }
}) })
repoData = repoData.data.map(item => { repoData = repoData.data.map(item => {
return { return {
label: item.name, label: item.name,
url: item.path, url: item.path,
branch: item.branch branch: item.branch
} }
}) })
$setRepo(repoData) $setRepo(repoData)
}
defineShortcuts({ defineShortcuts({
meta_enter: { meta_enter: {
......
...@@ -42,19 +42,22 @@ const { fetchRequest } = useFetchRequest() ...@@ -42,19 +42,22 @@ const { fetchRequest } = useFetchRequest()
const editIndex = ref(0) const editIndex = ref(0)
const { y } = useWindowScroll({ behavior: 'smooth' }) const { y } = useWindowScroll({ behavior: 'smooth' })
const { directions } = useScroll(window) const { directions } = useScroll(window)
let repoData = await fetchRequest('/v1/chat/repository', {
if (!$repos.length) {
let repoData = await fetchRequest('/v1/chat/repository', {
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
} }
}).catch(()=> {}) }).catch(()=> {})
repoData = repoData && repoData.data.map(item => { repoData = repoData && repoData.data.map(item => {
return { return {
label: item.name, label: item.name,
url: item.path, url: item.path,
branch: item.branch branch: item.branch
} }
}) })
$setRepo(repoData) $setRepo(repoData)
}
// todo mock // todo mock
const repoItem = $repos.find(item => route.query.repo === item.label) || {} const repoItem = $repos.find(item => route.query.repo === item.label) || {}
const state = reactive({ const state = reactive({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册