企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## **登录接口** ### 请求URL: POSThttp://36.134.166.120:5002/api/user/login ### Body: Body类型:multipart/form-data | NAME | VALUE | | --- | --- | | username | 15889889052 | | password | 123456 | | type | 0=账号+密码,1=手机号+短信 | | smscode | 0000| | Token | 843b16b1f952328d44b3454979094290(每次登陆都改变) | ### 请求URL: POST http://36.134.166.120:5001/api/index/ ## ****模型接口**** ~~~ prompt:对话内容,例子:你好 history:上下文,例子:[['客户','AI'],['客户','AI'],['客户','AI']] token:登录token,例子:0c916b868bb1b71996ee42f1c127a4bd ~~~ ***** curl ``` curl --location --request POST 'http://36.134.166.120:5001/api/index/' \\ \--header 'Content-Type: application/json' \\ \--header 'Accept: \*/\*' \\ \--header 'Host: 36.134.166.120:5001' \\ \--header 'Connection: keep-alive' \\ \--data-raw '{ "prompt": "你好", "history": \[\], "token":"0c916b868bb1b71996ee42f1c127a4bd" }' ``` ***** javascript ``` var settings = { "url": "http://36.134.166.120:5001/api/index/", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "\*/\*", "Host": "36.134.166.120:5001", "Connection": "keep-alive"    }, "data": JSON.stringify({ "prompt": "你好", "history": \[\], "token": "0c916b868bb1b71996ee42f1c127a4bd"    }), }; $.ajax(settings).done(function (response) {    console.log(response); }); ``` ***** java(Unirest) ``` Unirest.setTimeouts(0, 0); HttpResponse response = Unirest.post("http://36.134.166.120:5001/api/index/")    .header("Content-Type", "application/json")    .header("Accept", "\*/\*")    .header("Host", "36.134.166.120:5001")    .header("Connection", "keep-alive")    .body("{\\r\\n    \\"prompt\\": \\"你好\\",\\r\\n    \\"history\\": \[\],\\r\\n    \\"token\\":\\"0c916b868bb1b71996ee42f1c127a4bd\\"\\r\\n}")    .asString(); ``` ***** PHP(curl) ``` <?php $curl = curl\_init(); curl\_setopt\_array($curl, array( CURLOPT\_URL => 'http://36.134.166.120:5001/api/index/', CURLOPT\_RETURNTRANSFER => true, CURLOPT\_ENCODING => '', CURLOPT\_MAXREDIRS => 10, CURLOPT\_TIMEOUT => 0, CURLOPT\_FOLLOWLOCATION => true,    CURLOPT\_HTTP\_VERSION => CURL\_HTTP\_VERSION\_1\_1, CURLOPT\_CUSTOMREQUEST => 'POST',    CURLOPT\_POSTFIELDS =>'{     "prompt": "你好",     "history": \[\],     "token":"0c916b868bb1b71996ee42f1c127a4bd" }', CURLOPT\_HTTPHEADER => array( 'Content-Type: application/json', 'Accept: \*/\*', 'Host: 36.134.166.120:5001', 'Connection: keep-alive'    ), )); $response = curl\_exec($curl); curl\_close($curl); echo $response; ``` ***** python ``` import http.client import json conn = http.client.HTTPSConnection("36.134.166.120", 5001) payload = json.dumps({ "prompt": "你好", "history": \[\], "token": "0c916b868bb1b71996ee42f1c127a4bd" }) headers = { 'Content-Type': 'application/json', 'Accept': '\*/\*', 'Host': '36.134.166.120:5001', 'Connection': 'keep-alive' } conn.request("POST", "/api/index/", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ***** C# ``` var client = new RestClient("http://36.134.166.120:5001/api/index/"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddHeader("Accept", "\*/\*"); request.AddHeader("Host", "36.134.166.120:5001"); request.AddHeader("Connection", "keep-alive"); var body = @"{ " + "\\n" + @"    ""prompt"": ""你好"", " + "\\n" + @"    ""history"": \[\], " + "\\n" + @"    ""token"":""0c916b868bb1b71996ee42f1c127a4bd"" " + "\\n" + @"}"; request.AddParameter("application/json", body,  ParameterType.RequestBody); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content); ``` ***** #### ’**以上模型接口请求是流响应**