-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwhatsNew.js
More file actions
40 lines (36 loc) · 1.11 KB
/
whatsNew.js
File metadata and controls
40 lines (36 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const OpenAI = require('openai');
const input = require('input');
const client = new OpenAI();
const template = `
<pl-PL>
Tutaj wpisz lub wklej informacje o wersji w tym języku: pl-PL
</pl-PL>
<de-DE>
Tutaj wpisz lub wklej informacje o wersji w tym języku: de-DE
</de-DE>
<en-US>
Tutaj wpisz lub wklej informacje o wersji w tym języku: en-US
</en-US>
<es-ES>
Tutaj wpisz lub wklej informacje o wersji w tym języku: es-ES
</es-ES>
<fr-FR>
Tutaj wpisz lub wklej informacje o wersji w tym języku: fr-FR
</fr-FR>
<it-IT>
Tutaj wpisz lub wklej informacje o wersji w tym języku: it-IT
</it-IT>
`;
async function main() {
const whatsNew = await input.text('What\'s new in this version?');
const prompt = `Fill following template with translations of text: "${whatsNew}".Output ONLY filled template\n\n Template:\n\n${template}.`;
const stream = await client.chat.completions.create({
model: 'gpt-4o-mini',
messages: [{ role: 'user', content: prompt }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
}
main();