fix
This commit is contained in:
@@ -49,7 +49,9 @@ void Ollama::onLoad() {
|
|||||||
|
|
||||||
void Ollama::run() {
|
void Ollama::run() {
|
||||||
|
|
||||||
static std::string s, url, response = "";
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
static std::string s, url = "https://ollama.blunkall.us", response = "";
|
||||||
|
|
||||||
static nlohmann::json sendObj;
|
static nlohmann::json sendObj;
|
||||||
|
|
||||||
@@ -77,16 +79,18 @@ void Ollama::run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Text("%s", jsonObj["response"].dump().c_str());
|
ImGui::Text("%s", jsonObj["response"].dump().c_str());
|
||||||
|
ImGui::Text("ms per frame: %f", 1000 / io.Framerate);
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
if(curl) {
|
if(curl) {
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, (url + "/api/generate").c_str());
|
curl_easy_setopt(curl, CURLOPT_URL, (url + "/api/generate").c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
|
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) {
|
||||||
CURLcode code = result.get();
|
CURLcode code = result.get();
|
||||||
|
response = oss.str();
|
||||||
if(code != CURLE_OK) {
|
if(code != CURLE_OK) {
|
||||||
std::cerr << "curl_easy_perform() failed!: " << curl_easy_strerror(code) << std::endl;
|
std::cerr << "curl_easy_perform() failed!: " << curl_easy_strerror(code) << std::endl;
|
||||||
app->stopModule(getName());
|
app->stopModule(getName());
|
||||||
|
|||||||
Reference in New Issue
Block a user