This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e431c79
commit 950b8a2
Showing
3 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,29 @@ | ||
import { getAdapters, getBotConfig, getBotContext, getLogger } from "../../bindings"; | ||
Check failure on line 1 in src/handlers/issue/embeddings.ts GitHub Actions / build
Check failure on line 1 in src/handlers/issue/embeddings.ts GitHub Actions / build
Check failure on line 1 in src/handlers/issue/embeddings.ts GitHub Actions / build
|
||
import { Payload } from "../../types"; | ||
import { generateEmbeddings } from "../../helpers"; | ||
import { upsertEmbeddings } from "../../adapters/supabase"; | ||
|
||
/** | ||
* Generates an embedding vector for the current issue | ||
*/ | ||
export const embeddings = async () => { | ||
const { payload: _payload } = getBotContext(); | ||
const logger = getLogger(); | ||
const payload = _payload as Payload; | ||
const issue = payload.issue; | ||
|
||
if (!issue) { | ||
logger.info(`Skip to generate embeddings because of no issue instance`); | ||
return; | ||
} | ||
|
||
if (!issue.body) { | ||
logger.info("Skip to generate embeddings because of empty body"); | ||
return; | ||
} | ||
|
||
export const generateEmbeddings = async () => { | ||
return; | ||
const embeddings = await generateEmbeddings(issue.body); | ||
if (embeddings.length > 0) { | ||
await upsertEmbeddings(payload.repository.owner.login, payload.repository.name, issue.number, embeddings); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters