-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
78 lines (62 loc) · 2.02 KB
/
test.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const HOST = "localhost:3000"
const test = async () => {
const ask = await fetch(`http://${HOST}/ask`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
question: `What is the meaning of life?
Why people born?`,
}),
})
const answer = await ask.json()
console.log('answer', answer)
// const ask2 = await fetch(`http://${HOST}/ask`, {
// method: "POST",
// headers: {
// "Content-Type": "application/json",
// },
// body: JSON.stringify({
// question: "Who is the creator of puppeteer?",
// }),
// })
// const answer2 = await ask2.json()
// console.log('answer2', answer2)
// const createChat = await fetch(`http://${HOST}/create-chat`, {
// method: "POST",
// headers: {
// "Content-Type": "application/json",
// },
// body: JSON.stringify({
// message: "Create a story about dog, coder and nuclear bomb",
// }),
// })
// const chat = await createChat.json()
// console.log('chat', chat)
// const sendMessage = await fetch(`http://${HOST}/chat/send-message`, {
// method: "POST",
// headers: {
// "Content-Type": "application/json",
// },
// body: JSON.stringify({
// id: chat.id,
// message: "It must be in Philip Dick's style",
// }),
// })
// const message = await sendMessage.json()
// console.log('message', message)
// const nextMessage = await fetch(`http://${HOST}/chat/send-message`, {
// method: "POST",
// headers: {
// "Content-Type": "application/json",
// },
// body: JSON.stringify({
// id: chat.id,
// message: "Translate it to ukrainian",
// }),
// })
// const nextMessage2 = await nextMessage.json()
// console.log('nextMessage2', nextMessage2)
}
test()