@@ -651,9 +651,6 @@ struct server_context {
651
651
std::string system_prompt;
652
652
std::vector<llama_token> system_tokens;
653
653
654
- std::string name_user; // this should be the antiprompt
655
- std::string name_assistant;
656
-
657
654
// slots / clients
658
655
std::vector<server_slot> slots;
659
656
json default_generation_settings_for_props;
@@ -1100,15 +1097,11 @@ struct server_context {
1100
1097
system_need_update = false ;
1101
1098
}
1102
1099
1103
- void system_prompt_set (const json & sys_props) {
1104
- system_prompt = sys_props.value (" prompt" , " " );
1105
- name_user = sys_props.value (" anti_prompt" , " " );
1106
- name_assistant = sys_props.value (" assistant_name" , " " );
1100
+ bool system_prompt_set (const std::string & sys_prompt) {
1101
+ system_prompt = sys_prompt;
1107
1102
1108
1103
LOG_VERBOSE (" system prompt process" , {
1109
1104
{" system_prompt" , system_prompt},
1110
- {" name_user" , name_user},
1111
- {" name_assistant" , name_assistant},
1112
1105
});
1113
1106
1114
1107
// release all slots
@@ -1117,6 +1110,7 @@ struct server_context {
1117
1110
}
1118
1111
1119
1112
system_need_update = true ;
1113
+ return true ;
1120
1114
}
1121
1115
1122
1116
bool process_token (completion_token_output & result, server_slot & slot) {
@@ -1536,7 +1530,8 @@ struct server_context {
1536
1530
}
1537
1531
1538
1532
if (task.data .contains (" system_prompt" )) {
1539
- system_prompt_set (task.data .at (" system_prompt" ));
1533
+ std::string sys_prompt = json_value (task.data , " system_prompt" , std::string ());
1534
+ system_prompt_set (sys_prompt);
1540
1535
1541
1536
for (server_slot & slot : slots) {
1542
1537
slot.n_past = 0 ;
@@ -2920,7 +2915,7 @@ int main(int argc, char ** argv) {
2920
2915
server_params_parse (argc, argv, sparams, params);
2921
2916
2922
2917
if (!sparams.system_prompt .empty ()) {
2923
- ctx_server.system_prompt_set (json::parse ( sparams.system_prompt ) );
2918
+ ctx_server.system_prompt_set (sparams.system_prompt );
2924
2919
}
2925
2920
2926
2921
if (params.model_alias == " unknown" ) {
@@ -3409,8 +3404,7 @@ int main(int argc, char ** argv) {
3409
3404
const auto handle_props = [&ctx_server](const httplib::Request & req, httplib::Response & res) {
3410
3405
res.set_header (" Access-Control-Allow-Origin" , req.get_header_value (" Origin" ));
3411
3406
json data = {
3412
- { " user_name" , ctx_server.name_user .c_str () },
3413
- { " assistant_name" , ctx_server.name_assistant .c_str () },
3407
+ { " system_prompt" , ctx_server.system_prompt .c_str () },
3414
3408
{ " default_generation_settings" , ctx_server.default_generation_settings_for_props },
3415
3409
{ " total_slots" , ctx_server.params .n_parallel }
3416
3410
};
0 commit comments