-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconver.js
35 lines (27 loc) · 880 Bytes
/
conver.js
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
const openai = require('openai');
openai.api_key = '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';
async function sendMessage() {
// Create a new session
const session = await openai.createSession();
// Send a prompt to that session
await openai.continueSession({
session: session.id,
prompt: "ChatGPT:",
temperature: 0.7
});
// Continue the conversation from the previous response
await openai.continueSession({
session: session.id,
prompt: "Hi!",
temperature: 0.7
});
// Create a new session for a fresh conversation
const newSession = await openai.createSession();
// Send a new prompt to the new session
await openai.continueSession({
session: newSession.id,
prompt: "ChatGPT, how are you today?",
temperature: 0.7
});
}
sendMessage();