31 lines
597 B
C++
31 lines
597 B
C++
#ifndef JSON_DATA
|
|
#define JSON_DATA
|
|
|
|
#include <nlohmann/json.hpp>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <fstream>
|
|
|
|
struct Message {
|
|
std::string message_content;
|
|
std::string reasoning_content;
|
|
std::string id;
|
|
int prompt_tokens{};
|
|
int completion_tokens{};
|
|
int total_tokens{};
|
|
};
|
|
|
|
using json = nlohmann::json;
|
|
class CJsonOper
|
|
{
|
|
public:
|
|
CJsonOper();
|
|
~CJsonOper();
|
|
|
|
public:
|
|
std::string format_request(const std::string& content);
|
|
Message parse(const std::string& data);
|
|
static bool save_md(const std::string& data, const std::string& id);
|
|
};
|
|
|
|
#endif |