File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -150538,10 +150538,19 @@ exports.Chat = void 0;
150538150538const openai_1 = __importDefault(__nccwpck_require__(60047));
150539150539class Chat {
150540150540 openai;
150541+ isAzure;
150542+ apiVersion;
150543+ deployment;
150541150544 constructor(apikey) {
150545+ this.isAzure = Boolean(process.env.AZURE_API_VERSION && process.env.AZURE_DEPLOYMENT);
150546+ this.apiVersion = process.env.AZURE_API_VERSION || '';
150547+ this.deployment = process.env.AZURE_DEPLOYMENT || '';
150548+ const baseURL = this.isAzure
150549+ ? `${process.env.OPENAI_API_ENDPOINT}/openai/deployments/${this.deployment}/chat/completions?api-version=${this.apiVersion}`
150550+ : process.env.OPENAI_API_ENDPOINT || 'https://api.openai.com/v1';
150542150551 this.openai = new openai_1.default({
150543150552 apiKey: apikey,
150544- baseURL: process.env.OPENAI_API_ENDPOINT || 'https://api.openai.com/v1' ,
150553+ baseURL,
150545150554 });
150546150555 }
150547150556 generatePrompt = (patch) => {
@@ -150567,7 +150576,8 @@ class Chat {
150567150576 content: prompt,
150568150577 }
150569150578 ],
150570- model: process.env.MODEL || 'gpt-4o-mini',
150579+ // Use model or deployment name based on the environment
150580+ model: (this.isAzure ? this.deployment : process.env.MODEL || 'gpt-4o-mini'),
150571150581 temperature: +(process.env.temperature || 0) || 1,
150572150582 top_p: +(process.env.top_p || 0) || 1,
150573150583 max_tokens: process.env.max_tokens
Original file line number Diff line number Diff line change 11export declare class Chat {
22 private openai ;
3+ private isAzure ;
4+ private apiVersion ?;
5+ private deployment ?;
36 constructor ( apikey : string ) ;
47 private generatePrompt ;
58 codeReview : ( patch : string ) => Promise < string | null > ;
You can’t perform that action at this time.
0 commit comments