forked from weaigc/bingo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kblob.ts
44 lines (36 loc) · 1.25 KB
/
kblob.ts
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
import FormData from 'form-data'
import { fetch } from '@/lib/isomorphic'
const formData = new FormData()
const knowledgeRequest = {
"imageInfo": {
"url": "https://www.baidu.com/img/PCfb_5bf082d29588c07f842ccde3f97243ea.png"
},
"knowledgeRequest": {
"invokedSkills": ["ImageById"],
"subscriptionId": "Bing.Chat.Multimodal",
"invokedSkillsRequestData": { "enableFaceBlur": true },
"convoData": { "convoid": "51D|BingProdUnAuthenticatedUsers|E3DCA904FF236C67C3450163BCEC64CFF3F618CC8A4AFD75FD518F5ED0ADA080",
"convotone": "Creative" }
}
}
formData.append('knowledgeRequest', JSON.stringify(knowledgeRequest))
const jsonData = {
"imageInfo": { "url": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png?1=1" },
"knowledgeRequest": {
"invokedSkills": ["ImageById"],
"subscriptionId": "Bing.Chat.Multimodal",
"invokedSkillsRequestData": { "enableFaceBlur": true },
"convoData": { "convoid": "", "convotone": "Creative" }
}
}
fetch('https://www.bing.com/images/kblob',
{
method: 'POST',
body: formData.getBuffer(),
headers: {
'Referer': 'https://www.bing.com/search',
...formData.getHeaders()
}
}
).then(res => res.text())
.then(res => console.log('res', res))