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