Refactor to make more sense
This commit is contained in:
+14
-16
@@ -97,11 +97,14 @@ static HarnessState read_harness_state_or_exit(const char* file_path) {
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
HarnessConfig cfg;
|
||||
OllamaConfig ollama_cfg;
|
||||
if (const char* m = std::getenv("OLLAMA_MODEL")) cfg.model = m;
|
||||
if (const char* u = std::getenv("OLLAMA_URL")) cfg.base_url = u;
|
||||
if (const char* a = std::getenv("OLLAMA_AUTHORIZATION_TOKEN")) ollama_cfg.auth_token = a;
|
||||
HarnessConfig harnessConfig = HarnessConfig{
|
||||
.max_tool_iterations = 1000,
|
||||
.verbose = true,
|
||||
};
|
||||
OllamaConfig cfg;
|
||||
if (const char* m = std::getenv("OLLAMA_MODEL")) harnessConfig.model = m;
|
||||
if (const char* u = std::getenv("OLLAMA_URL")) harnessConfig.base_url = u;
|
||||
if (const char* a = std::getenv("OLLAMA_AUTHORIZATION_TOKEN")) cfg.auth_token = a;
|
||||
|
||||
bool use_debug = false;
|
||||
bool debug_paths = false;
|
||||
@@ -141,7 +144,7 @@ int main(int argc, char** argv) {
|
||||
// Add more base tools here:
|
||||
|
||||
for (const auto& profile : profiles)
|
||||
expect_or_exit(master_registery.register_tool(make_agent_tool(profile, master_registery, cfg.base_url)));
|
||||
expect_or_exit(master_registery.register_tool(make_agent_tool(profile, master_registery, harnessConfig.base_url)));
|
||||
|
||||
auto consume_arg = [&](){
|
||||
argc--;
|
||||
@@ -205,7 +208,7 @@ int main(int argc, char** argv) {
|
||||
else if (argv[0] == std::string("-M"))
|
||||
{
|
||||
consume_arg();
|
||||
cfg.model = consume_arg();
|
||||
harnessConfig.model = consume_arg();
|
||||
}
|
||||
else if (argv[0] == std::string("-d"))
|
||||
{
|
||||
@@ -418,7 +421,7 @@ int main(int argc, char** argv) {
|
||||
auto create_client = [&](bool debug) -> std::unique_ptr<Client> {
|
||||
if (debug)
|
||||
return std::make_unique<DebugClient>();
|
||||
return std::make_unique<OllamaClient>(cfg.base_url, cfg.model, ollama_cfg);
|
||||
return std::make_unique<OllamaClient>(harnessConfig.base_url, harnessConfig.model, cfg);
|
||||
};
|
||||
|
||||
// Scan for skills
|
||||
@@ -648,12 +651,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
|
||||
Harness harness(create_client(use_debug), agent_tools, HarnessConfig{
|
||||
.max_tool_iterations = 1000,
|
||||
.verbose = true,
|
||||
.base_url = cfg.base_url,
|
||||
.model = cfg.model
|
||||
});
|
||||
Harness harness(create_client(use_debug), agent_tools, harnessConfig);
|
||||
|
||||
if (!start_new)
|
||||
{
|
||||
@@ -661,8 +659,8 @@ int main(int argc, char** argv) {
|
||||
harness = Harness(create_client(use_debug), master_registery, state_data);
|
||||
}
|
||||
|
||||
std::cerr << "drharness v0.3 | model: " << cfg.model
|
||||
<< " | " << cfg.base_url << "\n\n";
|
||||
std::cerr << "drharness v0.3 | model: " << harnessConfig.model
|
||||
<< " | " << harnessConfig.base_url << "\n\n";
|
||||
|
||||
std::string final_prompt;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user