Skip to content

Commit 32258ff

Browse files
committed
chore: clean up comments
1 parent 3b3a29e commit 32258ff

File tree

3 files changed

+1
-13
lines changed

3 files changed

+1
-13
lines changed

src/app.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export function createApp() {
7171

7272
const app = express();
7373

74-
// Add CORS middleware
7574
app.use(
7675
cors({
7776
origin: '*',
@@ -170,22 +169,19 @@ if (require.main === module) {
170169
const port = 3000;
171170
const server = http.createServer(app);
172171

173-
// Create a function to handle graceful shutdown
174172
const gracefulShutdown = () => {
175173
console.log('Received kill signal, shutting down gracefully');
176174
server.close(() => {
177175
console.log('Closed out remaining connections');
178176
process.exit(0);
179177
});
180178

181-
// If connections don't close within 10 seconds, forcefully shut down
182179
setTimeout(() => {
183180
console.error('Could not close connections in time, forcefully shutting down');
184181
process.exit(1);
185182
}, 10000);
186183
};
187184

188-
// Listen for termination signals
189185
process.on('SIGTERM', gracefulShutdown);
190186
process.on('SIGINT', gracefulShutdown);
191187

src/interfaces.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export interface OpenAIApiRequest {
55
content: string;
66
}>;
77
stream?: boolean;
8-
// Add other fields as needed
98
}
109

1110
export interface OpenAIApiResponse {

src/service.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import axios from 'axios';
22
import { OpenAIApiRequest, OpenAIApiResponse, DifyApiRequest, DifyApiResponse } from './interfaces';
33

4-
// Note that this implementation makes some assumptions and simplifications:
5-
// It only uses the last message from the OpenAI request as the query for Dify.
6-
// It doesn't handle all possible fields from the OpenAI request (like temperature, max_tokens, etc.).
7-
// It uses a placeholder 'dify-model' as the model name in the OpenAI response.
8-
// It doesn't handle function calls, which are present in the OpenAI interface but not in the Dify interface.
9-
104
export class TranslationService {
115
private difyApiKey: string;
126
private difyApiEndpoint: string;
@@ -36,7 +30,6 @@ export class TranslationService {
3630
inputs: {},
3731
user: applicationName,
3832
response_mode: 'blocking',
39-
// You can add more fields here if needed
4033
};
4134
}
4235

@@ -63,7 +56,7 @@ export class TranslationService {
6356
return {
6457
id: difyResponse.id,
6558
object: 'chat.completion',
66-
created: Math.floor(difyResponse.created_at / 1000), // Convert to seconds TODO: Check if this is correct
59+
created: Math.floor(difyResponse.created_at / 1000),
6760
model: model,
6861
choices: [
6962
{

0 commit comments

Comments
 (0)