0.2.0 • Published 29 days ago

@ecoding/helper.got v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
29 days ago

import R from "@ecoding/helper.got"; const r = R.getInstance(); const getHttp = (env) => { r.setReqHook(async (options) => { // /api/user/ 调用 user 服务 const url = options.url; if (url.indexOf("/api/user/") !== -1) { r.setDomain("http://api.sciecomm.cn"); } return Promise.resolve(options); });

// switch (env) {
//     case EnvEnum.local:
//     case EnvEnum.test: {
//         r.setDomain("");
//     }
//     default: {
//         r.setDomain("");
//     }
// }

return r;

} export default getHttp;

agent
import { HttpsProxyAgent } from "https-proxy-agent";
const agent = new HttpsProxyAgent("http://127.0.0.1:1087");
const completion = await r.post("https://api.openai.com/v1/chat/completions", {
        model: "gpt-3.5-turbo",
        messages: [{"role": "user", "content": "Say this is a test!"}],
        temperature: 0.7
    },
    {
        headers: {
            "Authorization": "Bearer {Key}"
        },
        agent: {
            http: agent,
            https: agent,
        }
    }
);
0.2.0

29 days ago

0.1.11

4 months ago

0.1.10

4 months ago

0.1.9

5 months ago

0.1.8

5 months ago

0.1.7

5 months ago

0.1.6

5 months ago

0.1.5

7 months ago

0.1.4

7 months ago

0.1.3

9 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.0

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago