add Ollama
This commit is contained in:
0
modules/Calculator/src/Calculator.h
Normal file
0
modules/Calculator/src/Calculator.h
Normal file
@@ -1,7 +1,5 @@
|
|||||||
#include "Archimedes.h"
|
#include "Archimedes.h"
|
||||||
|
|
||||||
#include "utils/Window/Window.h"
|
|
||||||
|
|
||||||
class MainGUI : public Archimedes::Module {
|
class MainGUI : public Archimedes::Module {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
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();
|
||||||
|
}
|
||||||
18
modules/Ollama/src/Ollama.h
Normal file
18
modules/Ollama/src/Ollama.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include "Archimedes.h"
|
||||||
|
|
||||||
|
class Ollama : public Archimedes::Module {
|
||||||
|
|
||||||
|
public:
|
||||||
|
Ollama(Archimedes::App*, void*);
|
||||||
|
|
||||||
|
~Ollama();
|
||||||
|
|
||||||
|
void onLoad();
|
||||||
|
|
||||||
|
void run();
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef OLLAMA_DYNAMIC
|
||||||
|
#define MODULE_TYPE Ollama
|
||||||
|
#include "endModule.h"
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user