File size: 931 Bytes
2eb85f7
8a5ae92
2eb85f7
4192ae2
5a03baf
4192ae2
2eb85f7
235ac5c
2eb85f7
235ac5c
2eb85f7
 
 
 
 
 
 
 
 
 
 
 
7d77877
2eb85f7
 
 
 
902ac08
 
 
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
import fetch from "node-fetch";
import * as config from './config.js';

/**
 * @param {string} args - The input string
 */
async function schellwithflux(args) {
    const EncodeBaseUrl = "aHR0cHM6Ly9hcGktaW5mZXJlbmNlLmh1Z2dpbmdmYWNlLmNvL21vZGVscy9ibGFjay1mb3Jlc3QtbGFicy9GTFVYLjEtc2NobmVsbA==";
    try {
        const response = await fetch(atob(EncodeBaseUrl), {
            method: "POST",
            headers: {
                "Authorization": `Bearer ${config.HUGGING_TOKEN}`,
                "Content-Type": "application/json",
            },
            body: JSON.stringify({ inputs: args }),
        });
        
        if (!response.ok) {
            console.error(`API Error: ${response.status}`);
            return null;
        }
        return await response.arrayBuffer();
    } catch (error) {
        console.error("Error fetching data:", error.message);
        return null;
    }
}

export { schellwithflux };