@@ -3201,8 +3201,6 @@ int main(int argc, char ** argv) {
3201
3201
};
3202
3202
3203
3203
const auto handle_set_control_vectors = [&ctx_server, &res_error, &handle_get_control_vectors](const httplib::Request & req, httplib::Response & res) {
3204
- res.set_header (" Access-Control-Allow-Origin" , req.get_header_value (" Origin" ));
3205
-
3206
3204
json data = json::parse (req.body );
3207
3205
std::vector<llama_control_vector_load_info> vec_params;
3208
3206
@@ -3214,12 +3212,14 @@ int main(int argc, char ** argv) {
3214
3212
}
3215
3213
} else {
3216
3214
std::cerr << " No vectors passed\n " ;
3215
+ res.set_header (" Access-Control-Allow-Origin" , req.get_header_value (" Origin" ));
3217
3216
res_error (res, format_error_response (" No vectors passed" , ERROR_TYPE_SERVER));
3218
3217
return ;
3219
3218
}
3220
3219
const auto cvec = llama_control_vector_load (vec_params);
3221
3220
if (cvec.n_embd == -1 ) {
3222
3221
std::cerr << " Could not load control vector\n " ;
3222
+ res.set_header (" Access-Control-Allow-Origin" , req.get_header_value (" Origin" ));
3223
3223
res_error (res, format_error_response (" Could not load control vector" , ERROR_TYPE_SERVER));
3224
3224
return ;
3225
3225
}
@@ -3238,6 +3238,7 @@ int main(int argc, char ** argv) {
3238
3238
ctx_server.params .control_vector_layer_end );
3239
3239
if (err) {
3240
3240
std::cerr << " Could not apply control vector\n " ;
3241
+ res.set_header (" Access-Control-Allow-Origin" , req.get_header_value (" Origin" ));
3241
3242
res_error (res, format_error_response (" Could not apply control vector" , ERROR_TYPE_SERVER));
3242
3243
return ;
3243
3244
}
0 commit comments