Skip to content

Commit

Permalink
more logs and fix indexer (#17)
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Linville <[email protected]>
  • Loading branch information
g-linville authored Aug 20, 2024
1 parent 4bc0fbb commit f2833a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func reindexRemoteTools(db *sql.DB, apiURL *url.URL) {
index string
reference string
content string
description string
description *string
lastIndexedAt string
createdAt string
systemTool bool
Expand Down
3 changes: 3 additions & 0 deletions src/server/api/[...slug].post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export default defineEventHandler(async (event) => {
const [owner, repo, ...subdirs] = url.replace(/^(https?:\/\/)?(www\.)?github\.com\//, '').split('/')

// find the default branch name
console.log(`Checking GitHub API for repo ${owner}/${repo}`)
const branchResponse = await octokit.request(`GET https://api.github.com/repos/${ owner }/${ repo }`)
console.log(`Got response code ${branchResponse.status} from GitHub API`)
const branch = branchResponse.data.default_branch

// construct the path to the tool.gpt file
Expand All @@ -62,6 +64,7 @@ export default defineEventHandler(async (event) => {

if (!toolResponse.ok) {
// clean-up any existing tools if the tool.gpt file is no longer found or is private
console.log(`Got response code ${toolResponse.status} from raw.githubusercontent.com/${owner}/${repo}/${branch}/${path}/tool.gpt`)
if (toolResponse.status === 404 || toolResponse.status === 403) {
await db.removeToolForUrlIfExists(url)
}
Expand Down

0 comments on commit f2833a7

Please sign in to comment.