Still using other AI? It's not that it's not popular, but it's basically hard for you to access. Here is a cheap and free AI chat plugin that can be great too. Permanent free and unlimited number of times, is there such a good thing? And listen to the breakdown below.
foreword
Although GPT is not usable, I recommend some large models in China, and they are quite good, at least they can catch up to GPT-3.5. If you want to experience artificial intelligence AI, you can try big models such as Baidu and HKUST Xunfei. However, this is not the case here.
Introduction to BITO
Bito is Copilot
another god-level IDEA
code assistant plug-in after that. It feels that it can surpass Copilot . Its strength is that it can GPT
write code, analyze code, etc. in a way similar to dialogue. The generated code can be copied and directly inserted. , permanently free and unlimited times, it is also possible to use it for session search. You can directly search for this plugin in vscode and use it. Best of all, the registration process is simple and free.
Plug-in Introduction
Although the BITO plug-in is very useful, I want to use it in other places. So it is more flexible and convenient. Share with partners in need, welcome to like, comment and collect. The complete project code has been uploaded to csdn, and you can access the official account.
Download address: https://download.csdn.net/download/qq8864/87921258
Message example
Message request:
POST https://bitoai.bito.ai/ai/v2/chat/?processSilently=true HTTP/1.1
content-type: application/json
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="102"
authorization: 10086
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.75.1 Chrome/102.0.5005.194 Electron/19.1.9 Safari/537.36
sec-ch-ua-platform: "Windows"
accept: */*
origin: vscode-webview://00ufp6vep7ebihor39h3aap2cnc6j0ptg8638daeifr55n0kqpom
{
"bitoUserId": 10086,
"email": "[email protected]",
"ideName": "VSCODE",
"prompt": "今天的天气",
"uId": "bbbb-97ad-4885-897b-3df900fa82ce",
"wsId": 10086,
"stream": false,
"requestId": "aaaa-5e55-8959-fddc-aa9f0cf12b64"
}
answer:
HTTP/1.1 200 OK
Date: Sat, 17 Jun 2023 22:56:44 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 262
Connection: close
Access-Control-Allow-Origin: *
Vary: Origin
{
"response": "抱歉,作为AI语言模型,我没有实时获取天气信息的能力。请您打开天气预报应用或者网站查询当地天气情况。",
"status": 0,
"created": "2023-06-17T22:56:44.054650024Z",
"id": "chatcmpl-7SM1ZH0yQ2Q4H9liMwCt0yOa9DTlD"
}
golang package
https request
func HttpsPostNotVerify(url string, headers map[string]string, data []byte) ([]byte, error) {
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: tr}
log.Println("begin post...")
req, err := http.NewRequest("POST", url, bytes.NewReader(data))
if err != nil {
// handle error
log.Println("error..")
log.Println(err)
return nil, err
}
for key := range headers {
fmt.Println(key, ":", headers[key])
req.Header.Set(key, headers[key])
}
resp, err := client.Do(req)
if err != nil {
// handle error
log.Println("error1..")
log.Println(err)
return nil, err
}
defer resp.Body.Close()
var body []byte
body, err = ioutil.ReadAll(resp.Body)
if err != nil {
// handle error
log.Println(err)
return nil, err
}
//fmt.Println(string(body))
//log.Printf(string(body))
return body, nil
//jsonStr := string(body)
//fmt.Println("jsonStr", jsonStr)
}
func ChatHttpsPost(url string, body []byte) ([]byte, error) {
headers := make(map[string]string)
headers["user-agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.75.1 Chrome/102.0.5005.194 Electron/19.1.9 Safari/537.36"
headers["content-type"] = "application/json"
headers["authorization"] = "xxxxxx"
headers["accept"] = "*/*"
headers["origin"] = "vscode-webview://00uxxxxxxxxqpom*"
out, err := HttpsPostNotVerify(url, headers, body)
if err != nil {
//log.Info(sn + err)
return nil, err
}
//log.Info(strout)
return out, nil
}
chat package
type RequestBITO struct{
BitoUserId int `json:"bitoUserId"`
Email string `json:"email"`
IdeName string `json:"ideName"`
Prompt string `json:"prompt"`
UId string `json:"uId"`
WsId int `json:"wsId"`
Stream bool `json:"stream"`
RequestId string `json:"requestId"`
}
func AskChatBITO(question string) string{
fmt.Printf("\033[31mAsk chatBITO,\033[0m question:%s\n", question)
begin := time.Now()
request := RequestBITO{
BitoUserId: xxxxxx,
Email: "[email protected]",
IdeName: "VSCODE",
Prompt: question,
UId: "xxxxx-97ad-4885-897b-xxxx82ce",
WsId: xxxxx,
Stream: false,
RequestId: "xxxx-5e55-8959-fddc-xxxx12b64",
}
req, _ := json.Marshal(request)//将json对象序列化为byte[]
fmt.Printf("req:%s\n", string(req))
response, err := util.ChatHttpsPost(CHATBITOURL, req)
elapsed := time.Since(begin)
//fmt.Println(response, err)
if err != nil {
fmt.Printf("\033[31mError:\033[0m %v\nTime: ", err,elapsed)
return ""
}else{
fmt.Printf("Answer:%s\n\033[32mTime:\033[0m %v\n\n", string(response),elapsed)
return string(response)
}
}
test verification
It can be seen that the response speed is quite fast, taking a total of 1.9 seconds, and the speed is not limited to the number of times.
other resources
Bito - A god-level plug-in beyond Copilot - Yang Linwei's Blog - CSDN Blog
Gospel: IDEA, VSCODE god-level plug-in Bito_Lingxiyun's Blog-CSDN Blog