Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
anc95 committed Nov 8, 2024
1 parent 289d6c4 commit 12a11df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 12 additions & 2 deletions action/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -150538,10 +150538,19 @@ exports.Chat = void 0;
const openai_1 = __importDefault(__nccwpck_require__(60047));
class Chat {
openai;
isAzure;
apiVersion;
deployment;
constructor(apikey) {
this.isAzure = Boolean(process.env.AZURE_API_VERSION && process.env.AZURE_DEPLOYMENT);
this.apiVersion = process.env.AZURE_API_VERSION || '';
this.deployment = process.env.AZURE_DEPLOYMENT || '';
const baseURL = this.isAzure
? `${process.env.OPENAI_API_ENDPOINT}/openai/deployments/${this.deployment}/chat/completions?api-version=${this.apiVersion}`
: process.env.OPENAI_API_ENDPOINT || 'https://api.openai.com/v1';
this.openai = new openai_1.default({
apiKey: apikey,
baseURL: process.env.OPENAI_API_ENDPOINT || 'https://api.openai.com/v1',
baseURL,
});
}
generatePrompt = (patch) => {
Expand All @@ -150567,7 +150576,8 @@ class Chat {
content: prompt,
}
],
model: process.env.MODEL || 'gpt-4o-mini',
// Use model or deployment name based on the environment
model: (this.isAzure ? this.deployment : process.env.MODEL || 'gpt-4o-mini'),
temperature: +(process.env.temperature || 0) || 1,
top_p: +(process.env.top_p || 0) || 1,
max_tokens: process.env.max_tokens
Expand Down
3 changes: 3 additions & 0 deletions action/src/chat.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export declare class Chat {
private openai;
private isAzure;
private apiVersion?;
private deployment?;
constructor(apikey: string);
private generatePrompt;
codeReview: (patch: string) => Promise<string | null>;
Expand Down

0 comments on commit 12a11df

Please sign in to comment.