0772fd5fe8
Add a new overload to Harness::chat that takes a std::string as the user message and a vector<std::string> const& as image paths. The method reads the image files and converts them to data URIs internally, then constructs the multimodal message. This moves all the multimodal message construction logic from main.cpp into Harness, simplifying main.cpp.
32 lines
964 B
C++
32 lines
964 B
C++
#pragma once
|
|
#include "json_types.hpp"
|
|
#include "tool_registry.hpp"
|
|
#include "client.hpp"
|
|
#include <memory>
|
|
#include <string>
|
|
#include <expected>
|
|
|
|
class Harness {
|
|
public:
|
|
Harness(std::unique_ptr<Client> client, const ToolRegistry& registry,
|
|
HarnessConfig config = {});
|
|
|
|
Harness(std::unique_ptr<Client> client, const ToolRegistry& master_reg,
|
|
HarnessState deserialized);
|
|
|
|
std::expected<std::string, std::string> chat(const std::string& user_message);
|
|
std::expected<std::string, std::string> chat(const Message& user_message);
|
|
std::expected<std::string, std::string> chat(const std::string& user_message, const std::vector<std::string>& image_paths);
|
|
void reset();
|
|
|
|
HarnessState serialize() const;
|
|
|
|
private:
|
|
void push_message(const Message& msg);
|
|
|
|
std::unique_ptr<Client> client_;
|
|
ToolRegistry registry_;
|
|
HarnessConfig config_;
|
|
std::vector<Message> history_;
|
|
};
|