mirror of
https://github.com/Balshgit/gpt_chat_bot.git
synced 2025-09-11 22:30:41 +03:00
fix chat_microservice bug (#59)
This commit is contained in:
parent
1efbbb27c2
commit
2f2b512129
@ -284,10 +284,10 @@ public:
|
|||||||
curl_easy_setopt(m_curl, CURLOPT_URL, m_url.data());
|
curl_easy_setopt(m_curl, CURLOPT_URL, m_url.data());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
auto& setBody(std::string body) {
|
auto& setBody(std::string body, CURLoption cur_loption = CURLoption::CURLOPT_POSTFIELDS) {
|
||||||
if (!body.empty()) {
|
if (!body.empty()) {
|
||||||
m_body = std::move(body);
|
m_body = std::move(body);
|
||||||
curl_easy_setopt(m_curl, CURLOPT_POSTFIELDS, m_body.c_str());
|
curl_easy_setopt(m_curl, cur_loption, m_body.c_str());
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -1929,6 +1929,11 @@ boost::asio::awaitable<void> FreeGpt::fakeGpt(std::shared_ptr<Channel> ch, nlohm
|
|||||||
if (j["count"].get<int32_t>() == 0)
|
if (j["count"].get<int32_t>() == 0)
|
||||||
random_j.emplace_back(std::move(j));
|
random_j.emplace_back(std::move(j));
|
||||||
}
|
}
|
||||||
|
if (random_j.empty()) {
|
||||||
|
SPDLOG_ERROR("random_j is empty!!!");
|
||||||
|
ch->try_send(err, json_result.dump());
|
||||||
|
co_return;
|
||||||
|
}
|
||||||
std::mt19937 g{std::random_device{}()};
|
std::mt19937 g{std::random_device{}()};
|
||||||
std::uniform_int_distribution<std::size_t> d{0, random_j.size()};
|
std::uniform_int_distribution<std::size_t> d{0, random_j.size()};
|
||||||
auto token_id = random_j[d(g)];
|
auto token_id = random_j[d(g)];
|
||||||
@ -2638,4 +2643,3 @@ boost::asio::awaitable<void> FreeGpt::gptTalkru(std::shared_ptr<Channel> ch, nlo
|
|||||||
}
|
}
|
||||||
co_return;
|
co_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ int main(int, char** argv) {
|
|||||||
ADD_METHOD("gpt-4-ChatGpt4Online", FreeGpt::chatGpt4Online);
|
ADD_METHOD("gpt-4-ChatGpt4Online", FreeGpt::chatGpt4Online);
|
||||||
ADD_METHOD("gpt-3.5-turbo-stream-ChatAnywhere", FreeGpt::chatAnywhere);
|
ADD_METHOD("gpt-3.5-turbo-stream-ChatAnywhere", FreeGpt::chatAnywhere);
|
||||||
ADD_METHOD("gpt-3.5-turbo-ChatgptNext", FreeGpt::chatGptNext);
|
ADD_METHOD("gpt-3.5-turbo-ChatgptNext", FreeGpt::chatGptNext);
|
||||||
ADD_METHOD("gpt-3.5-turbo--stream-gptTalkRu", FreeGpt::gptTalkru);
|
ADD_METHOD("gpt-3.5-turbo-stream-gptTalkRu", FreeGpt::gptTalkru);
|
||||||
|
|
||||||
SPDLOG_INFO("active provider:");
|
SPDLOG_INFO("active provider:");
|
||||||
for (auto& [provider, _] : gpt_function)
|
for (auto& [provider, _] : gpt_function)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user