server : add comment about changing slot_state to bool

This commit is contained in:
Georgi Gerganov 2023-10-22 22:24:39 +03:00
parent 83e1490187
commit c0f4d54870
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -158,6 +158,7 @@ struct task_result {
json result_json; json result_json;
}; };
// TODO: can become bool if we can't find use of more states
enum slot_state enum slot_state
{ {
IDLE, IDLE,
@ -188,11 +189,14 @@ struct slot_params
struct slot_image struct slot_image
{ {
clip_image_u8 img_data; int32_t id;
bool request_encode_image = false; bool request_encode_image = false;
float* image_embedding = nullptr; float* image_embedding = nullptr;
int image_tokens = 0; int32_t image_tokens = 0;
int id;
clip_image_u8 img_data;
std::string prefix_prompt; // before of this image std::string prefix_prompt; // before of this image
}; };
@ -769,8 +773,8 @@ struct llama_server_context
{ {
for (const auto &img : *images_data) for (const auto &img : *images_data)
{ {
slot_image img_sl;
std::string data_b64 = img["data"].get<std::string>(); std::string data_b64 = img["data"].get<std::string>();
slot_image img_sl;
img_sl.id = img.count("id") != 0 ? img["id"].get<int>() : slot->images.size(); img_sl.id = img.count("id") != 0 ? img["id"].get<int>() : slot->images.size();
int width, height, channels; int width, height, channels;
std::vector<uint8_t> image_buffer = base64_decode(data_b64); std::vector<uint8_t> image_buffer = base64_decode(data_b64);