auto load environment variables (#72)

* auto load environment variables

* add providers gpt6 & chatxyz
This commit is contained in:
Dmitry Afanasyev
2023-12-26 16:05:35 +03:00
committed by GitHub
parent 460123ef28
commit f17a0a72e4
7 changed files with 199 additions and 41 deletions

View File

@@ -1,24 +1,21 @@
#pragma once
#include <thread>
#include <yaml_cpp_struct.hpp>
struct Config {
std::string client_root_path;
std::size_t interval{300};
std::size_t work_thread_num{std::thread::hardware_concurrency() == 1 ? 2
: std::thread::hardware_concurrency() * 2};
std::string host{"0.0.0.0"};
std::string port{"8858"};
std::string chat_path{"/chat"};
std::size_t interval;
std::size_t work_thread_num;
std::string host;
std::string port;
std::string chat_path;
std::vector<std::string> providers;
bool enable_proxy;
std::string http_proxy;
std::string api_key;
std::vector<std::string> ip_white_list;
std::string zeus{"http://127.0.0.1:8860"};
std::string flaresolverr{"http://127.0.0.1:8191/v1"};
std::string zeus;
std::string flaresolverr;
};
YCS_ADD_STRUCT(Config, client_root_path, interval, work_thread_num, host, port, chat_path, providers, enable_proxy,
http_proxy, api_key, ip_white_list, zeus, flaresolverr)

View File

@@ -33,6 +33,8 @@ public:
boost::asio::awaitable<void> aiChatOnline(std::shared_ptr<Channel>, nlohmann::json);
boost::asio::awaitable<void> fakeGpt(std::shared_ptr<Channel>, nlohmann::json);
boost::asio::awaitable<void> aura(std::shared_ptr<Channel>, nlohmann::json);
boost::asio::awaitable<void> gpt6(std::shared_ptr<Channel>, nlohmann::json);
boost::asio::awaitable<void> chatxyz(std::shared_ptr<Channel>, nlohmann::json);
private:
boost::asio::awaitable<std::expected<boost::beast::ssl_stream<boost::beast::tcp_stream>, std::string>>