Update index.js
Browse files
index.js
CHANGED
|
@@ -57,12 +57,18 @@ const post = async (url, form, headers = {}) => {
|
|
| 57 |
}
|
| 58 |
//BIMG
|
| 59 |
async function bimg(query) {
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
// Filter out links that end with '.svg'
|
| 64 |
let filteredData = data.filter(i => !i.includes('.svg'));
|
| 65 |
-
return filteredData
|
| 66 |
}
|
| 67 |
async function bingChat(text) {
|
| 68 |
const api = new BingChat({
|
|
|
|
| 57 |
}
|
| 58 |
//BIMG
|
| 59 |
async function bimg(query) {
|
| 60 |
+
const { BingApi } = await import("bing-nodejs");
|
| 61 |
+
const bing = new BingApi({
|
| 62 |
+
cookie: process.env.BING_IMAGE_COOKIE || "1hPKd66tX-wvyQtYG5F-UIzIYgcsNB1rgZ5jAGGDCu30pMnoh-X8tHkZ92BNUmQ_MlPKKMrERVXwPqf4XhUZRTjrfOrrAxH4CCqoJfdfDptUXPJXJOQ7duuJEy-2C4uSabwUjuvkRIlifbB-3WEa4Y4dTpcNm9dVnkT14Lawhf4ceGJax0IXF5gbgnlhtLZdUJ08WyGQSnllQVNc-IzsVbQ"
|
| 63 |
+
});
|
| 64 |
+
let credit = await bing.getDalleCredits()
|
| 65 |
+
let data = await bing.createImage("cute cat").then((res) => {
|
| 66 |
+
return res.urls; // string[]
|
| 67 |
+
});
|
| 68 |
|
| 69 |
// Filter out links that end with '.svg'
|
| 70 |
let filteredData = data.filter(i => !i.includes('.svg'));
|
| 71 |
+
return {credit:credit, filteredData}
|
| 72 |
}
|
| 73 |
async function bingChat(text) {
|
| 74 |
const api = new BingChat({
|