Skip to content

Commit c8931ff

Browse files
committed
Fix all lint issues
1 parent 672ef26 commit c8931ff

File tree

4 files changed

+16
-33
lines changed

4 files changed

+16
-33
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Building layer
2-
FROM node:16-alpine as development
2+
FROM node:18-alpine as development
33
# Optional NPM automation (auth) token build argument
44
# ARG NPM_TOKEN
55
# Optionally authenticate NPM registry
@@ -15,7 +15,7 @@ COPY src/ src/
1515
# Build application (produces dist/ folder)
1616
RUN npm run build
1717
# Runtime (production) layer
18-
FROM node:16-alpine as production
18+
FROM node:18-alpine as production
1919
# Optional NPM automation (auth) token build argument
2020
# ARG NPM_TOKEN
2121
# Optionally authenticate NPM registry

src/app.controller.spec.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/app.controller.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AppService } from './app.service';
55

66
@Controller()
77
export class AppController {
8-
constructor(private readonly appService: AppService) { }
8+
constructor(private readonly appService: AppService) {}
99

1010
@Get('models')
1111
models() {
@@ -15,7 +15,7 @@ export class AppController {
1515

1616
@Controller('chat')
1717
export class ChatController {
18-
constructor(private readonly appService: AppService) { }
18+
constructor(private readonly appService: AppService) {}
1919

2020
@Get()
2121
getHello(): string {
@@ -29,16 +29,22 @@ export class ChatController {
2929
const [resource_id, deployment_id, azureApiKey] = apiKey.split(':');
3030
const endpoint = `https://${resource_id}.openai.azure.com`;
3131
const stream = request.body['stream'];
32-
const response = await this.appService.getCompletions(endpoint, deployment_id, azureApiKey, request.body, stream);
32+
const response = await this.appService.getCompletions(
33+
endpoint,
34+
deployment_id,
35+
azureApiKey,
36+
request.body,
37+
stream,
38+
);
3339

3440
// set response headers
3541
for (const [key, value] of response.headers as AxiosHeaders) {
3642
res.header[key] = value;
3743
}
3844
res.status(response.status);
39-
if(stream) {
45+
if (stream) {
4046
const streamData = response.data;
41-
streamData.on('data', data => {
47+
streamData.on('data', (data) => {
4248
res.write(data);
4349
});
4450
streamData.on('end', () => {
@@ -49,4 +55,3 @@ export class ChatController {
4955
}
5056
}
5157
}
52-

src/app.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ export class AppService {
2323
body: any,
2424
stream: boolean,
2525
) {
26-
let url = `${endpoint}/openai/deployments/${deployment_id}/chat/completions?api-version=2023-03-15-preview`;
27-
let headers = {
26+
const url = `${endpoint}/openai/deployments/${deployment_id}/chat/completions?api-version=2023-03-15-preview`;
27+
const headers = {
2828
'api-key': azureApiKey,
2929
'Content-Type': 'application/json',
3030
};
3131
const config = { headers: headers };
3232
if (stream) {
3333
config['responseType'] = 'stream';
3434
}
35-
let ret = this.httpService.post(url, body, config);
35+
const ret = this.httpService.post(url, body, config);
3636
return await firstValueFrom(ret);
3737
}
3838
}

0 commit comments

Comments
 (0)