0.2.0 • Published 1 year ago
@ecoding/helper.got v0.2.0
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
1 year ago
0.1.11
1 year ago
0.1.10
1 year ago
0.1.9
2 years ago
0.1.8
2 years ago
0.1.7
2 years ago
0.1.6
2 years ago
0.1.5
2 years ago
0.1.4
2 years ago
0.1.3
2 years ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago
0.0.10
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago