curl opts go with perform
This commit is contained in:
@@ -39,12 +39,6 @@ void Ollama::onLoad() {
|
|||||||
curl_global_init(CURL_GLOBAL_ALL);
|
curl_global_init(CURL_GLOBAL_ALL);
|
||||||
curl = curl_easy_init();
|
curl = curl_easy_init();
|
||||||
|
|
||||||
if(curl) {
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
|
|
||||||
//curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
|
|
||||||
//curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_POST, 1L);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ollama::run() {
|
void Ollama::run() {
|
||||||
@@ -73,6 +67,12 @@ void Ollama::run() {
|
|||||||
sendObj["model"] = "llama3.2";
|
sendObj["model"] = "llama3.2";
|
||||||
sendObj["stream"] = false;
|
sendObj["stream"] = false;
|
||||||
sendObj["prompt"] = s;
|
sendObj["prompt"] = s;
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_URL, (url + "/api/generate").c_str());
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &oss);
|
||||||
|
//curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
|
||||||
|
//curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_POST, 1L);
|
||||||
curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, sendObj.dump().c_str());
|
curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, sendObj.dump().c_str());
|
||||||
result = std::async(curl_easy_perform, curl);
|
result = std::async(curl_easy_perform, curl);
|
||||||
inFlight = true;
|
inFlight = true;
|
||||||
@@ -84,8 +84,6 @@ void Ollama::run() {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
if(curl) {
|
if(curl) {
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, (url + "/api/generate").c_str());
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &oss);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(inFlight && result.wait_for(std::chrono::seconds(0)) == std::future_status::ready) {
|
if(inFlight && result.wait_for(std::chrono::seconds(0)) == std::future_status::ready) {
|
||||||
|
|||||||
Reference in New Issue
Block a user