add Ollama
This commit is contained in:
49
modules/Ollama/src/Ollama.cpp
Normal file
49
modules/Ollama/src/Ollama.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "Ollama.h"
|
||||
#include "modules/ImguiModule/src/ImguiModule.h"
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
Ollama::Ollama(Archimedes::App* a, void* h) : Archimedes::Module(a, h) {
|
||||
|
||||
name = "Ollama";
|
||||
|
||||
ImguiModule* im = new ImguiModule(a, nullptr);
|
||||
deps[im->getName()] = im;
|
||||
}
|
||||
|
||||
Ollama::~Ollama() {
|
||||
|
||||
}
|
||||
|
||||
void Ollama::onLoad() {
|
||||
|
||||
ImguiModule* im = (ImguiModule*) moduleInstances["ImguiModule"];
|
||||
|
||||
if(!im) {
|
||||
std::cout << "No ImguiModule for Ollama!\n";
|
||||
std::abort();
|
||||
}
|
||||
|
||||
ImGui::SetCurrentContext(im->getContext());
|
||||
|
||||
}
|
||||
|
||||
void Ollama::run() {
|
||||
|
||||
static std::string s, url, response = "";
|
||||
|
||||
ImGui::Begin("Ollama Module");
|
||||
|
||||
ImGui::InputText("url: ", &url);
|
||||
|
||||
ImGui::InputTextMultiline("prompt: ", &s);
|
||||
|
||||
if(ImGui::Button("send")) {
|
||||
|
||||
}
|
||||
|
||||
ImGui::Text("%s", response.c_str());
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
Reference in New Issue
Block a user