diff options
Diffstat (limited to 'src/ai_providers/DeepSeek.cpp')
| -rw-r--r-- | src/ai_providers/DeepSeek.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/ai_providers/DeepSeek.cpp b/src/ai_providers/DeepSeek.cpp index 4dd4e0a..a1857e9 100644 --- a/src/ai_providers/DeepSeek.cpp +++ b/src/ai_providers/DeepSeek.cpp @@ -14,15 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _CRT_SECURE_NO_WARNINGS - -#include <fstream> -#include <iostream> -#include <string> - #define CPPHTTPLIB_OPENSSL_SUPPORT #include "httplib.h" #include "strops.hpp" +#include "memops.hpp" #include "logger.hpp" #include "importer.hpp" @@ -41,7 +36,7 @@ static bool _DeepSeek_query_with_file(char* query, size_t query_length, char* fi //cli.enable_server_certificate_verification(false); //char* query_escaped = strops::prep_str_for_json(query, query_length); - //free(query); // TODO why?? + //memops::unalloc(query); // TODO why?? size_t file_size = strlen(query_buffer); sprintf(query_buffer + file_size, "%s", query); @@ -49,7 +44,7 @@ static bool _DeepSeek_query_with_file(char* query, size_t query_length, char* fi char* query_escaped = strops::prep_str_for_json(query_buffer, strlen(query_buffer)); size_t body_size = file_size + QUERY_BUFFER_SIZE; - char* body = (char*)malloc(body_size); + char* body = (char*)memops::alloc(body_size); strops::format(body, body_size, "{\"model\":\"deepseek-reasoner\", \"messages\": [ { \"role\": \"user\", \"content\": \"%s\" } ] }", query_escaped); @@ -59,7 +54,7 @@ static bool _DeepSeek_query_with_file(char* query, size_t query_length, char* fi headers.insert(std::make_pair("Accept", "application/json")); httplib::Result res = cli.Post("/chat/completions", headers, body, "application/json"); - free(body); + memops::unalloc(body); if (!res || res->status != 200) { logger::error("ERROR Failed to query API."); @@ -68,7 +63,7 @@ static bool _DeepSeek_query_with_file(char* query, size_t query_length, char* fi } char* response_body = (char*)res->body.c_str(); - *response = (char*)malloc(100000); + *response = (char*)memops::alloc(100000); memset(*response, 0, 100000); strncpy(*response, response_body, 100000); @@ -95,7 +90,7 @@ static bool _DeepSeek_upload_file(char* file_path, char* file_id, size_t file_id fseek(orig_file, 0, SEEK_SET); size_t buffer_size = sz + QUERY_BUFFER_SIZE; - char* file_content_buffer = (char*)malloc(buffer_size); + char* file_content_buffer = (char*)memops::alloc(buffer_size); memset(file_content_buffer, 0, buffer_size); query_buffer = file_content_buffer; |
