65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
#ifndef CTAI_BASE_H
|
|
#define CTAI_BASE_H
|
|
|
|
#include <iostream>
|
|
#include <QString>
|
|
|
|
#ifndef QSL
|
|
#define QSL(str) (QString::fromStdString)(str)
|
|
#endif
|
|
|
|
#ifndef QSN
|
|
#define QSN(str) (QString::number)(str)
|
|
#endif
|
|
|
|
typedef enum msg_mode{
|
|
SYSTEM,
|
|
USER
|
|
}msg_type;
|
|
|
|
typedef struct curl_opts
|
|
{
|
|
bool ssl_state = true;
|
|
int timeout = 120;
|
|
bool followlocation = false;
|
|
bool keepalive = true;
|
|
bool verbose = true;
|
|
} curl_opts;
|
|
|
|
typedef struct model_data{
|
|
std::string api_url = "https://api.deepseek.com/chat/completions";
|
|
std::string api_key = "Authorization: Bearer sk-7e6932ed45674c389dea1cd3481e0ec2";
|
|
std::string user_model = "deepseek-chat";
|
|
//std::string api_url="https://api.siliconflow.cn/v1/chat/completions";
|
|
//std::string api_key="Authorization: Bearer sk-oiphigpzqtmkkcoucyakrfevcvndroywvxhprvscjqhdykdb";
|
|
//std::string user_model = "deepseek-ai/DeepSeek-V3";
|
|
std::string send_content_header = "Content-Type: application/json";
|
|
std::string send_accept_header = "Accept: application/json";
|
|
std::string send_user_data;
|
|
std::string send_user_time;
|
|
std::string send_user_id;
|
|
std::string send_user_ico;
|
|
std::string postback_model_data;
|
|
msg_type msg_type_mode;
|
|
std::string send_system_ico;
|
|
bool postback_stream_mode = false;
|
|
std::string postback_time;
|
|
std::string postback_server_model;
|
|
std::string postback_finish_reason;
|
|
std::string postback_send_id;
|
|
std::string postback_system_fingerprint;
|
|
// 提示消耗tokens
|
|
int postback_prompt_tokens;
|
|
// 生成消耗tokens
|
|
int postback_completion_tokens;
|
|
// 总消耗tokens
|
|
int postback_total_tokens;
|
|
// 提示命中缓存tokens
|
|
int postback_prompt_cache_hit_tokens;
|
|
// 生成未命中缓存tokens
|
|
int postback_prompt_cache_miss_tokens;
|
|
//请求体,不可采用临时变量
|
|
std::string request_body;
|
|
}model_data;
|
|
|
|
#endif // CTAI_BASE_H
|