mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-07-09 20:12:02 +08:00
blob file read for gitlab (#544)
This commit is contained in:
@@ -18,14 +18,24 @@ const getPatchData = async (patchUrl) => {
|
||||
export default {
|
||||
inputQuery: async () => {
|
||||
try {
|
||||
const patchUrl = await getPatchUrl()
|
||||
const patchData = await getPatchData(patchUrl)
|
||||
if (!patchData) return
|
||||
if (location.pathname.includes('/blob')) {
|
||||
const fileData = await limitedFetch(location.href.replace('/blob/', '/raw/'), 1024 * 40)
|
||||
if (!fileData) return
|
||||
|
||||
return await cropText(
|
||||
`Analyze the contents of a git commit,provide a suitable commit message,and summarize the contents of the commit.` +
|
||||
`The patch contents of this commit are as follows:\n${patchData}`,
|
||||
)
|
||||
return await cropText(
|
||||
`Analyze the following file content and explain it. Use markdown syntax to make your answer more readable, such as code blocks, bold, list:` +
|
||||
`\n\`\`\`\n${fileData}\n\`\`\``,
|
||||
)
|
||||
} else {
|
||||
const patchUrl = await getPatchUrl()
|
||||
const patchData = await getPatchData(patchUrl)
|
||||
if (!patchData) return
|
||||
|
||||
return await cropText(
|
||||
`Analyze the contents of a git commit,provide a suitable commit message,and summarize the contents of the commit.` +
|
||||
`The patch contents of this commit are as follows:\n${patchData}`,
|
||||
)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user